61 #ifndef __FMOD_AUDIO_SOUND_H__
62 #define __FMOD_AUDIO_SOUND_H__
71 #include <fmod_errors.h>
87 void set_loop(
bool loop=
true);
88 bool get_loop()
const;
91 void set_loop_count(
unsigned long loop_count=1);
92 unsigned long get_loop_count()
const;
95 void set_time(PN_stdfloat start_time=0.0);
96 PN_stdfloat get_time()
const;
99 void set_volume(PN_stdfloat volume=1.0);
100 PN_stdfloat get_volume()
const;
103 void set_balance(PN_stdfloat balance_right=0.0);
104 PN_stdfloat get_balance()
const;
107 void set_play_rate(PN_stdfloat play_rate=1.0f);
108 PN_stdfloat get_play_rate()
const;
110 const std::string &get_name()
const;
113 PN_stdfloat length()
const;
118 void set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz);
119 void get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz);
121 void set_3d_min_distance(PN_stdfloat dist);
122 PN_stdfloat get_3d_min_distance()
const;
124 void set_3d_max_distance(PN_stdfloat dist);
125 PN_stdfloat get_3d_max_distance()
const;
127 AudioSound::SoundStatus status()
const;
130 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);
132 void set_active(
bool active=
true);
133 bool get_active()
const;
136 void set_finished_event(
const std::string& event);
137 const std::string& get_finished_event()
const;
142 FMOD::Channel *_channel;
150 float _mix[AudioManager::SPK_COUNT];
152 float _sampleFrequency;
153 mutable float _length;
155 FMOD_SPEAKERMODE _speakermode;
157 FMOD_VECTOR _location;
158 FMOD_VECTOR _velocity;
160 PN_stdfloat _min_dist;
161 PN_stdfloat _max_dist;
163 void start_playing();
164 void set_volume_on_channel();
165 void set_balance_on_channel();
166 void set_play_rate_on_channel();
167 void set_speaker_mix_on_channel();
168 void set_3d_attributes_on_channel();
170 void set_speaker_mix_or_balance_on_channel();
172 virtual int get_priority();
173 virtual void set_priority(
int priority);
177 PN_stdfloat _start_time;
179 std::string _finished_event;
188 static FMOD_RESULT F_CALLBACK
189 sound_end_callback(FMOD_CHANNEL * channel,
190 FMOD_CHANNEL_CALLBACKTYPE type,
194 static FMOD_RESULT F_CALLBACK
195 open_callback(
const char *name,
int unicode,
unsigned int *file_size,
196 void **handle,
void **user_data);
198 static FMOD_RESULT F_CALLBACK
199 close_callback(
void *handle,
void *user_data);
201 static FMOD_RESULT F_CALLBACK
202 read_callback(
void *handle,
void *buffer,
unsigned int size_bytes,
203 unsigned int *bytes_read,
void *user_data);
205 static FMOD_RESULT F_CALLBACK
206 seek_callback(
void *handle,
unsigned int pos,
void *user_data);
215 static void init_type() {
216 AudioSound::init_type();
217 register_type(_type_handle,
"FmodAudioSound", AudioSound::get_class_type());
220 return get_class_type();
224 return get_class_type();
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
virtual void set_time(PN_stdfloat start_time=0.0)=0
Control time position within the sound, in seconds.
virtual PN_stdfloat get_speaker_mix(int speaker)
For use only with FMOD.
The name of a file, such as a texture file or an Egg file.
TypeHandle is the identifier used to differentiate C++ class types.
The abstract base class for a file or directory within the VirtualFileSystem.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...