61#ifndef __FMOD_AUDIO_SOUND_H__
62#define __FMOD_AUDIO_SOUND_H__
71#include <fmod_errors.h>
95 void set_time(PN_stdfloat start_time=0.0);
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);
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);
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.
void set_active(bool active=true)
Sets whether the sound is marked "active".
PN_stdfloat get_3d_max_distance() const
Get the distance that this sound stops falling off.
void set_3d_min_distance(PN_stdfloat dist)
Set the distance that this sound begins to fall off.
void set_3d_max_distance(PN_stdfloat dist)
Set the distance that this sound stops falling off.
PN_stdfloat get_balance() const
-1.0 to 1.0 scale -1 should be all the way left.
PN_stdfloat get_time() const
Gets the play position within the sound.
void set_loop(bool loop=true)
Turns looping on and off.
void finished()
Not implemented.
PN_stdfloat length() const
Get length FMOD returns the time in MS so we have to convert to seconds.
void set_loop_count(unsigned long loop_count=1)
Panda uses 0 to mean loop forever.
AudioSound::SoundStatus status() const
Get status of the sound.
void get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz)
Get position and velocity of this sound Currently unimplemented.
PN_stdfloat get_3d_min_distance() const
Get the distance that this sound begins to fall off.
void set_volume(PN_stdfloat volume=1.0)
0.0 to 1.0 scale of volume converted to Fmod's internal 0.0 to 255.0 scale.
const std::string & get_name() const
Get name of sound file.
const std::string & get_finished_event() const
NOT USED ANYMORE!
PN_stdfloat get_volume() const
Gets the current volume of a sound.
void play()
Plays a sound.
void set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz)
Set position and velocity of this sound NOW LISTEN UP!
unsigned long get_loop_count() const
Return how many times a sound will loop.
void set_finished_event(const std::string &event)
NOT USED ANYMORE!
bool get_active() const
Returns whether the sound has been marked "active".
FmodAudioSound(AudioManager *manager, VirtualFile *file, bool positional)
Constructor All sound will DEFAULT load as a 2D sound unless otherwise specified.
void set_balance(PN_stdfloat balance_right=0.0)
-1.0 to 1.0 scale
void set_play_rate(PN_stdfloat play_rate=1.0f)
Sets the speed at which a sound plays back.
bool get_loop() const
Returns whether looping is on or off.
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(),...