13 #ifndef __OPENAL_AUDIO_SOUND_H__
14 #define __OPENAL_AUDIO_SOUND_H__
24 #ifdef HAVE_OPENAL_FRAMEWORK
25 #include <OpenAL/al.h>
26 #include <OpenAL/alc.h>
46 void set_loop(
bool loop=
true);
47 bool get_loop()
const;
50 void set_loop_count(
unsigned long loop_count=1);
51 unsigned long get_loop_count()
const;
55 PN_stdfloat get_time()
const;
62 void set_balance(PN_stdfloat balance_right=0.0);
63 PN_stdfloat get_balance()
const;
71 bool get_active()
const;
75 void set_finished_event(
const std::string& event);
76 const std::string& get_finished_event()
const;
78 const std::string &get_name()
const;
81 PN_stdfloat length()
const;
86 void set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz);
87 void get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz);
89 void set_3d_min_distance(PN_stdfloat dist);
90 PN_stdfloat get_3d_min_distance()
const;
92 void set_3d_max_distance(PN_stdfloat dist);
93 PN_stdfloat get_3d_max_distance()
const;
95 void set_3d_drop_off_factor(PN_stdfloat factor);
96 PN_stdfloat get_3d_drop_off_factor()
const;
98 AudioSound::SoundStatus status()
const;
107 INLINE
void set_calibrated_clock(
double rtc,
double t,
double playrate);
108 INLINE
double get_calibrated_clock(
double rtc)
const;
109 void correct_calibrated_clock(
double rtc,
double t);
110 void cache_time(
double rtc);
112 void restart_stalled_audio();
113 void delete_queued_buffers();
114 ALuint make_buffer(
int samples,
int channels,
int rate,
unsigned char *data);
115 void queue_buffer(ALuint buffer,
int samples,
int loop_index,
double time_offset);
116 int read_stream_data(
int bytelen,
unsigned char *data);
117 void pull_used_buffers();
118 void push_fresh_buffers();
119 INLINE
bool require_sound_data();
120 INLINE
void release_sound_data(
bool force);
123 INLINE
bool is_playing()
const;
124 INLINE
bool has_sound_data()
const;
129 OpenALAudioManager::SoundData *_sd;
131 struct QueuedBuffer {
139 PN_stdfloat _playing_rate;
142 int _loops_completed;
148 PN_stdfloat _balance;
149 PN_stdfloat _play_rate;
152 ALfloat _location[3];
153 ALfloat _velocity[3];
155 PN_stdfloat _min_dist;
156 PN_stdfloat _max_dist;
157 PN_stdfloat _drop_off_factor;
166 double _calibrated_clock_base;
167 double _calibrated_clock_scale;
168 double _calibrated_clock_decavg;
176 PN_stdfloat _current_time;
180 std::string _finished_event;
194 static void init_type() {
195 AudioSound::init_type();
196 register_type(_type_handle,
"OpenALAudioSound", AudioSound::get_class_type());
199 return get_class_type();
203 return get_class_type();
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void set_time(PN_stdfloat start_time=0.0)=0
Control time position within the sound, in seconds.
The name of a file, such as a texture file or an Egg file.
A MovieAudio is actually any source that provides a sequence of audio samples.
virtual void set_active(bool)
Turn on/off Warning: not implemented.
virtual bool is_valid()
This is mostly for debugging, but it it could be used to detect errors in a release build if you don'...
virtual PN_stdfloat get_volume() const
Gets listener gain.
void set_play_rate(PN_stdfloat play_rate)
set the overall play rate
PN_stdfloat get_play_rate() const
get the overall speed/pitch/play rate
virtual void set_volume(PN_stdfloat)
Sets listener gain.
TypeHandle is the identifier used to differentiate C++ class types.
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(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.