source: golgotha/src/i4/test/sound_test/sndtst.cc

Last change on this file was 80, checked in by Sam Hocevar, 15 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 "app/app.hh"
10#ifdef _MANGLE_INC
11#include "DRIVE~RO.HH"
12#else
13#include "drive_map.hh"
14#endif
15#include "main/main.hh"
16#include "sound/sound.hh"
17
18class sound_test_class : public i4_application_class
19//{{{
20{
21public:
22  I4_EVENT_HANDLER_NAME("m1_utility_app_class");
23
24  virtual w32 max_memory() const { return 1000 * 1024; }
25 
26  sound_test_class(char *resource_file, void *resource_buffer)
27  {
28    memory_init();
29
30    //    g1_map_drives();
31
32    resource_init(resource_file,resource_buffer);
33    display_init();
34  }
35};
36//}}}
37
38sound_test_class *app;
39
40int my_sleep(int val)
41//{{{
42{
43  int val2 = -1;
44
45  for (int i=0; i<val; i++)
46    val2 *= val2;
47
48  return val2;
49}
50//}}}
51
52void i4_main(w32 argc, i4_const_str *argv)
53//{{{
54{
55  app = new sound_test_class("resource.res",0);
56  i4_voice_class *snd;
57  int i;
58
59  i4_sound_man->load_sounds(16);
60
61  i4_sound_manager_class::sound_parameters param;
62  param.frequency = 11025;
63  param.volume = 63;
64  param.pan = 0;
65  param.looping = i4_T;
66
67  snd = i4_sound_man->play(0, param);
68
69  for (i=10000; i<100000; i+=50)
70  {
71    snd->set_frequency(i);
72    my_sleep(4000);
73  }
74  snd->set_frequency(11025);
75
76  for (i=0; i<=63; i++)
77  {
78    my_sleep(400000);
79    snd->set_volume(i);
80  }
81
82  for (i=-63; i<=63; i++)
83  {
84    my_sleep(400000);
85    snd->set_pan(i);
86  }
87
88  param.frequency = 10000;
89  param.looping = i4_F;
90  i4_sound_man->play(1, param);
91
92  for (i=63; i>=0; i--)
93  {
94    my_sleep(10000);
95    snd->set_volume(i);
96  }
97  snd->set_volume(63);
98
99  param.frequency = 11025;
100  i4_sound_man->play(1, param);
101
102  app->run();
103}
104//}}}
105
106
107//{{{ Emacs Locals
108// Local Variables:
109// folded-file: t
110// End:
111//}}}
Note: See TracBrowser for help on using the repository browser.