16 #ifndef __OPENAL_AUDIO_SOUND_H__
17 #define __OPENAL_AUDIO_SOUND_H__
19 #include "pandabase.h"
21 #include "audioSound.h"
22 #include "movieAudioCursor.h"
23 #include "trueClock.h"
24 #include "openalAudioManager.h"
28 #include <OpenAL/al.h>
29 #include <OpenAL/alc.h>
51 void set_loop(
bool loop=
true);
52 bool get_loop()
const;
56 void set_loop_count(
unsigned long loop_count=1);
57 unsigned long get_loop_count()
const;
61 void set_time(PN_stdfloat time=0.0);
62 PN_stdfloat get_time()
const;
73 void set_balance(PN_stdfloat balance_right=0.0);
74 PN_stdfloat get_balance()
const;
83 bool get_active()
const;
88 void set_finished_event(
const string& event);
89 const string& get_finished_event()
const;
91 const string &get_name()
const;
94 PN_stdfloat length()
const;
99 void set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz);
100 void get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz);
102 void set_3d_min_distance(PN_stdfloat dist);
103 PN_stdfloat get_3d_min_distance()
const;
105 void set_3d_max_distance(PN_stdfloat dist);
106 PN_stdfloat get_3d_max_distance()
const;
108 void set_3d_drop_off_factor(PN_stdfloat factor);
109 PN_stdfloat get_3d_drop_off_factor()
const;
111 AudioSound::SoundStatus status()
const;
120 INLINE
void set_calibrated_clock(
double rtc,
double t,
double playrate);
121 INLINE
double get_calibrated_clock(
double rtc)
const;
122 void correct_calibrated_clock(
double rtc,
double t);
123 void cache_time(
double rtc);
125 void restart_stalled_audio();
126 void delete_queued_buffers();
127 ALuint make_buffer(
int samples,
int channels,
int rate,
unsigned char *data);
128 void queue_buffer(ALuint buffer,
int samples,
int loop_index,
double time_offset);
129 int read_stream_data(
int bytelen,
unsigned char *data);
130 void pull_used_buffers();
131 void push_fresh_buffers();
132 INLINE
void require_sound_data();
133 INLINE
void release_sound_data();
140 OpenALAudioManager::SoundData *_sd;
142 struct QueuedBuffer {
150 PN_stdfloat _playing_rate;
153 int _loops_completed;
159 PN_stdfloat _balance;
160 PN_stdfloat _play_rate;
163 ALfloat _location[3];
164 ALfloat _velocity[3];
166 PN_stdfloat _min_dist;
167 PN_stdfloat _max_dist;
168 PN_stdfloat _drop_off_factor;
178 double _calibrated_clock_base;
179 double _calibrated_clock_scale;
180 double _calibrated_clock_decavg;
189 PN_stdfloat _current_time;
194 string _finished_event;
209 static void init_type() {
210 AudioSound::init_type();
211 register_type(_type_handle,
"OpenALAudioSound", AudioSound::get_class_type());
214 return get_class_type();
218 return get_class_type();
229 #include "openalAudioSound.I"
virtual void set_volume(PN_stdfloat)
Sets listener gain.
PN_stdfloat get_play_rate() const
get the overall speed/pitch/play rate
virtual PN_stdfloat get_volume() const
Gets listener gain.
The name of a file, such as a texture file or an Egg file.
void set_play_rate(PN_stdfloat play_rate)
set the overall play rate
virtual void set_active(bool)
Turn on/off Warning: not implemented.
TypeHandle is the identifier used to differentiate C++ class types.
A MovieAudio is actually any source that provides a sequence of audio samples.