69 #ifndef __FMOD_AUDIO_SOUND_H__ 70 #define __FMOD_AUDIO_SOUND_H__ 72 #include <pandabase.h> 74 #include "audioSound.h" 76 #include "fmodAudioManager.h" 79 #include <fmod_errors.h> 96 void set_loop(
bool loop=
true);
97 bool get_loop()
const;
101 void set_loop_count(
unsigned long loop_count=1);
102 unsigned long get_loop_count()
const;
106 void set_time(PN_stdfloat start_time=0.0);
107 PN_stdfloat get_time()
const;
111 void set_volume(PN_stdfloat volume=1.0);
112 PN_stdfloat get_volume()
const;
118 void set_balance(PN_stdfloat balance_right=0.0);
119 PN_stdfloat get_balance()
const;
123 void set_play_rate(PN_stdfloat play_rate=1.0f);
124 PN_stdfloat get_play_rate()
const;
126 const string &get_name()
const;
129 PN_stdfloat length()
const;
134 void set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz);
135 void get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz);
137 void set_3d_min_distance(PN_stdfloat dist);
138 PN_stdfloat get_3d_min_distance()
const;
140 void set_3d_max_distance(PN_stdfloat dist);
141 PN_stdfloat get_3d_max_distance()
const;
143 AudioSound::SoundStatus status()
const;
146 virtual void set_speaker_mix(PN_stdfloat frontleft, PN_stdfloat frontright, PN_stdfloat center, PN_stdfloat sub, PN_stdfloat backleft, PN_stdfloat backright, PN_stdfloat sideleft, PN_stdfloat sideright);
148 void set_active(
bool active=
true);
149 bool get_active()
const;
152 void set_finished_event(
const string& event);
153 const string& get_finished_event()
const;
158 FMOD::Channel *_channel;
166 float _mix[AudioManager::SPK_COUNT];
168 float _sampleFrequency;
169 mutable float _length;
171 FMOD_SPEAKERMODE _speakermode;
173 FMOD_VECTOR _location;
174 FMOD_VECTOR _velocity;
176 PN_stdfloat _min_dist;
177 PN_stdfloat _max_dist;
179 void start_playing();
180 void set_volume_on_channel();
181 void set_balance_on_channel();
182 void set_play_rate_on_channel();
183 void set_speaker_mix_on_channel();
184 void set_3d_attributes_on_channel();
186 void set_speaker_mix_or_balance_on_channel();
188 virtual int get_priority();
189 virtual void set_priority(
int priority);
193 PN_stdfloat _start_time;
195 string _finished_event;
205 static FMOD_RESULT F_CALLBACK
206 sound_end_callback(FMOD_CHANNEL * channel,
207 FMOD_CHANNEL_CALLBACKTYPE type,
211 static FMOD_RESULT F_CALLBACK
212 open_callback(
const char *name,
int unicode,
unsigned int *file_size,
213 void **handle,
void **user_data);
215 static FMOD_RESULT F_CALLBACK
216 close_callback(
void *handle,
void *user_data);
218 static FMOD_RESULT F_CALLBACK
219 read_callback(
void *handle,
void *buffer,
unsigned int size_bytes,
220 unsigned int *bytes_read,
void *user_data);
222 static FMOD_RESULT F_CALLBACK
223 seek_callback(
void *handle,
unsigned int pos,
void *user_data);
234 static void init_type() {
235 AudioSound::init_type();
236 register_type(_type_handle,
"FmodAudioSound", AudioSound::get_class_type());
239 return get_class_type();
243 return get_class_type();
254 #include "fmodAudioSound.I"
virtual void set_speaker_mix(PN_stdfloat frontleft, PN_stdfloat frontright, PN_stdfloat center, PN_stdfloat sub, PN_stdfloat backleft, PN_stdfloat backright, PN_stdfloat sideleft, PN_stdfloat sideright)
For use only with FMOD.
The name of a file, such as a texture file or an Egg file.
virtual PN_stdfloat get_speaker_mix(int speaker)
For use only with FMOD.
TypeHandle is the identifier used to differentiate C++ class types.