source: golgotha/src/i4/test/sound3d/snd3dtst.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 14 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.2 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "drive_map.hh"
10#include "main/main.hh"
11#include "sound/sound3d.hh"
12
13#ifdef WIN32
14
15#include "app/app.hh"
16
17class sound_test_class : public i4_application_class
18//{{{
19{
20public:
21  I4_EVENT_HANDLER_NAME("m1_utility_app_class");
22
23  virtual w32 max_memory() const { return 1000 * 1024; }
24 
25  sound_test_class(char *resource_file, void *resource_buffer)
26  {
27    memory_init();
28
29    g1_map_drives();
30
31    resource_init(resource_file,resource_buffer);
32    display_init();
33  }
34};
35//}}}
36
37sound_test_class *app;
38
39#endif
40
41int my_sleep(int val)
42//{{{
43{
44  int val2 = -1;
45
46#ifdef __linux
47  val *= 10;
48#else
49  val *= 10;
50#endif
51
52  for (int i=0; i<val; i++)
53    val2 *= val2;
54
55  return val2;
56}
57//}}}
58
59void i4_main(w32 argc, i4_const_str *argv)
60//{{{
61{
62#ifdef WIN32
63  app = new sound_test_class("resource.res",0);
64#endif
65  i4_3d_voice_class *snd;
66  int i;
67
68  i4_init();
69
70#ifndef WIN32
71  g1_map_drives();
72#endif
73
74  i4_string_man.load(0, "resource.res");
75
76  i4_3d_sound_man->load_sounds(16);
77
78  i4_3d_sound_parameters param(11025,63);
79  param.looping = i4_T;
80
81  snd = i4_3d_sound_man->play(0, param);
82
83  for (i=-1000; i<1000; i+=50)
84  {
85    snd->position.x = i;
86    snd->update();
87    my_sleep(40000);
88  }
89  snd->position.z = 100;
90  snd->velocity.x = 100;
91
92  for (i=-1000; i<1000; i+=50)
93  {
94    snd->position.x = i;
95    snd->update();
96    my_sleep(40000);
97  }
98
99  snd->position.x = 100;
100  snd->velocity.z = 100;
101  snd->velocity.x = 0;
102
103  for (i=-1000; i<1000; i+=50)
104  {
105    snd->position.z = i;
106    snd->update();
107    my_sleep(40000);
108  }
109  i4_uninit();
110}
111//}}}
112
113//{{{ Emacs Locals
114// Local Variables:
115// folded-file: t
116// End:
117//}}}
Note: See TracBrowser for help on using the repository browser.