16 #ifndef __MILES_AUDIO_MANAGER_H__ //[ 17 #define __MILES_AUDIO_MANAGER_H__ 19 #include "pandabase.h" 20 #ifdef HAVE_RAD_MSS //[ 22 #include "audioManager.h" 30 #include "lightReMutex.h" 31 #include "conditionVar.h" 33 class MilesAudioSound;
35 class EXPCL_MILES_AUDIO MilesAudioManager:
public AudioManager {
40 virtual ~MilesAudioManager();
44 virtual bool is_valid();
46 virtual PT(
AudioSound) get_sound(
const string &file_name,
bool positional =
false,
int mode=SM_heuristic);
47 virtual PT(
AudioSound) get_sound(
MovieAudio *sound,
bool positional =
false,
int mode=SM_heuristic);
48 virtual void uncache_sound(
const string &file_name);
49 virtual void clear_cache();
50 virtual void set_cache_limit(
unsigned int count);
51 virtual unsigned int get_cache_limit()
const;
53 virtual void set_volume(PN_stdfloat volume);
54 virtual PN_stdfloat get_volume()
const;
56 void set_play_rate(PN_stdfloat play_rate);
57 PN_stdfloat get_play_rate()
const;
59 virtual void set_active(
bool active);
60 virtual bool get_active()
const;
62 virtual void set_concurrent_sound_limit(
unsigned int limit = 0);
63 virtual unsigned int get_concurrent_sound_limit()
const;
65 virtual void reduce_sounds_playing_to(
unsigned int count);
66 virtual void stop_all_sounds();
71 void release_sound(MilesAudioSound *audioSound);
78 virtual void audio_3d_set_listener_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat xy, PN_stdfloat xz, PN_stdfloat fx, PN_stdfloat fy, PN_stdfloat fz, PN_stdfloat ux, PN_stdfloat uy, PN_stdfloat uz);
79 virtual void audio_3d_get_listener_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz, PN_stdfloat *fx, PN_stdfloat *fy, PN_stdfloat *fz, PN_stdfloat *ux, PN_stdfloat *uy, PN_stdfloat *uz);
80 virtual void audio_3d_set_distance_factor(PN_stdfloat factor);
81 virtual PN_stdfloat audio_3d_get_distance_factor()
const;
82 virtual void audio_3d_set_doppler_factor(PN_stdfloat factor);
83 virtual PN_stdfloat audio_3d_get_doppler_factor()
const;
84 virtual void audio_3d_set_drop_off_factor(PN_stdfloat factor);
85 virtual PN_stdfloat audio_3d_get_drop_off_factor()
const;
88 virtual void output(ostream &out)
const;
89 virtual void write(ostream &out)
const;
93 void do_reduce_sounds_playing_to(
unsigned int count);
94 void do_clear_cache();
96 void start_service_stream(HSTREAM stream);
97 void stop_service_stream(HSTREAM stream);
99 void most_recently_used(
const string &path);
100 void uncache_a_sound();
102 void starting_sound(MilesAudioSound *audio);
103 void stopping_sound(MilesAudioSound *audio);
106 PT(SoundData) load(
const Filename &file_name);
108 void thread_main(
volatile bool &keep_running);
109 void do_service_streams();
112 class StreamThread :
public Thread {
114 StreamThread(MilesAudioManager *mgr);
115 virtual void thread_main();
117 MilesAudioManager *_mgr;
118 volatile bool _keep_running;
126 PN_stdfloat get_length();
127 void set_length(PN_stdfloat length);
140 AudioSet _sounds_on_loan;
144 SoundsPlaying _sounds_playing;
151 PN_stdfloat _play_rate;
154 bool _cleanup_required;
155 unsigned int _concurrent_sound_limit;
162 bool _sounds_finished;
165 PT(StreamThread) _stream_thread;
174 static void init_type() {
175 AudioManager::init_type();
176 register_type(_type_handle,
"MilesAudioManager",
177 AudioManager::get_class_type());
180 return get_class_type();
182 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
187 friend class MilesAudioSound;
188 friend class MilesAudioSample;
189 friend class MilesAudioSequence;
190 friend class MilesAudioStream;
193 EXPCL_MILES_AUDIO
AudioManager *Create_MilesAudioManager();
This is the base class for all three-component vectors and points.
This is our own Panda specialization on the default STL map.
A lightweight reentrant mutex.
A standard mutex, or mutual exclusion lock.
This is our own Panda specialization on the default STL deque.
A condition variable, usually used to communicate information about changing state to a thread that i...
virtual void update()
Must be called every frame.
The name of a file, such as a texture file or an Egg file.
virtual void shutdown()
Call this at exit time to shut down the audio system.
A base class for all things that want to be reference-counted.
A thread; that is, a lightweight process.
This is our own Panda specialization on the default STL set.
TypeHandle is the identifier used to differentiate C++ class types.
A MovieAudio is actually any source that provides a sequence of audio samples.
virtual void set_speaker_configuration(LVecBase3 *speaker1, LVecBase3 *speaker2=NULL, LVecBase3 *speaker3=NULL, LVecBase3 *speaker4=NULL, LVecBase3 *speaker5=NULL, LVecBase3 *speaker6=NULL, LVecBase3 *speaker7=NULL, LVecBase3 *speaker8=NULL, LVecBase3 *speaker9=NULL)
For use only with Miles.