[80] | 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 | #ifndef SOUND3D_HH
|
---|
| 10 | #define SOUND3D_HH
|
---|
| 11 |
|
---|
| 12 | #include "sound/sound_types.hh"
|
---|
| 13 | #include "init/init.hh"
|
---|
| 14 | #include "math/vector.hh"
|
---|
| 15 |
|
---|
| 16 | class i4_3d_sound_parameters
|
---|
| 17 | //{{{
|
---|
| 18 | {
|
---|
| 19 | protected:
|
---|
| 20 | i4_3d_sound_parameters() {}
|
---|
| 21 | public:
|
---|
| 22 | static i4_3d_vector null;
|
---|
| 23 |
|
---|
| 24 | i4_frequency frequency;
|
---|
| 25 | i4_volume volume;
|
---|
| 26 | i4_3d_vector position, velocity;
|
---|
| 27 | i4_bool looping, reverb;
|
---|
| 28 |
|
---|
| 29 | i4_3d_sound_parameters(i4_frequency freq,
|
---|
| 30 | i4_volume vol = I4_SOUND_VOLUME_LEVELS-1,
|
---|
| 31 | const i4_3d_vector& pos = null,
|
---|
| 32 | const i4_3d_vector& vel = null,
|
---|
| 33 | i4_bool looping = i4_F,
|
---|
| 34 | i4_bool reverb = i4_F)
|
---|
| 35 | : frequency(freq),
|
---|
| 36 | volume(vol),
|
---|
| 37 | position(pos),
|
---|
| 38 | velocity(vel),
|
---|
| 39 | looping(looping),
|
---|
| 40 | reverb(reverb) {}
|
---|
| 41 |
|
---|
| 42 | void set(const i4_3d_sound_parameters ¶m)
|
---|
| 43 | //{{{
|
---|
| 44 | {
|
---|
| 45 | frequency = param.frequency;
|
---|
| 46 | volume = param.volume;
|
---|
| 47 | position = param.position;
|
---|
| 48 | velocity = param.velocity;
|
---|
| 49 | looping = param.looping;
|
---|
| 50 | reverb = param.reverb;
|
---|
| 51 | }
|
---|
| 52 | //}}}
|
---|
| 53 | };
|
---|
| 54 | //}}}
|
---|
| 55 |
|
---|
| 56 | class i4_3d_voice_class : public i4_3d_sound_parameters
|
---|
| 57 | {
|
---|
| 58 | protected:
|
---|
| 59 | i4_3d_voice_class() : i4_3d_sound_parameters() {}
|
---|
| 60 | public:
|
---|
| 61 | i4_3d_voice_class(const i4_3d_sound_parameters ¶m)
|
---|
| 62 | : i4_3d_sound_parameters(param.frequency,
|
---|
| 63 | param.volume,
|
---|
| 64 | param.position,
|
---|
| 65 | param.velocity,
|
---|
| 66 | param.looping,
|
---|
| 67 | param.reverb) {}
|
---|
| 68 |
|
---|
| 69 | typedef i4_bool (*completion_function_type)(void *_context);
|
---|
| 70 |
|
---|
| 71 | virtual void set_completer(completion_function_type completer, void *_context) = 0;
|
---|
| 72 | virtual void play() = 0;
|
---|
| 73 | virtual void update() = 0;
|
---|
| 74 | };
|
---|
| 75 |
|
---|
| 76 | class i4_3d_sound_manager_class;
|
---|
| 77 | extern i4_3d_sound_manager_class *i4_3d_sound_man;
|
---|
| 78 |
|
---|
| 79 | class i4_3d_sound_manager_class : public i4_init_class
|
---|
| 80 | {
|
---|
| 81 | protected:
|
---|
| 82 | public:
|
---|
| 83 | virtual void init() { i4_3d_sound_man = this; }
|
---|
| 84 | virtual void load_sounds(w32 max_sounds) = 0;
|
---|
| 85 | virtual i4_3d_voice_class *alloc(i4_sound_id sound_id, const i4_3d_sound_parameters& param) = 0;
|
---|
| 86 | i4_3d_voice_class *play(i4_sound_id sound_id, const i4_3d_sound_parameters& param)
|
---|
| 87 | //{{{
|
---|
| 88 | {
|
---|
| 89 | i4_3d_voice_class *voc = alloc(sound_id,param);
|
---|
| 90 |
|
---|
| 91 | if (voc)
|
---|
| 92 | voc->play();
|
---|
| 93 |
|
---|
| 94 | return voc;
|
---|
| 95 | }
|
---|
| 96 | //}}}
|
---|
| 97 |
|
---|
| 98 | #ifndef I4_RETAIL
|
---|
| 99 | virtual char *name() const = 0;
|
---|
| 100 | #endif
|
---|
| 101 | };
|
---|
| 102 |
|
---|
| 103 | class i4_null_3d_sound_class;
|
---|
| 104 | extern class i4_null_3d_sound_class i4_null_3d_sound;
|
---|
| 105 |
|
---|
| 106 | #endif
|
---|
| 107 |
|
---|
| 108 | //{{{ Emacs Locals
|
---|
| 109 | // Local Variables:
|
---|
| 110 | // folded-file: t
|
---|
| 111 | // End:
|
---|
| 112 | //}}}
|
---|