mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
openal: assert -> nassert
This commit is contained in:
parent
c89bb3d030
commit
99dc462174
@ -524,7 +524,7 @@ get_sound(const string &file_name, bool positional, int mode) {
|
||||
void OpenALAudioManager::
|
||||
uncache_sound(const string& file_name) {
|
||||
ReMutexHolder holder(_lock);
|
||||
assert(is_valid());
|
||||
nassertv(is_valid());
|
||||
Filename path = file_name;
|
||||
|
||||
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||
@ -910,7 +910,7 @@ reduce_sounds_playing_to(unsigned int count) {
|
||||
int limit = _sounds_playing.size() - count;
|
||||
while (limit-- > 0) {
|
||||
SoundsPlaying::iterator sound = _sounds_playing.begin();
|
||||
assert(sound != _sounds_playing.end());
|
||||
nassertv(sound != _sounds_playing.end());
|
||||
// When the user stops a sound, there is still a PT in the user's hand.
|
||||
// When we stop a sound here, however, this can remove the last PT. This
|
||||
// can cause an ugly recursion where stop calls the destructor, and the
|
||||
@ -1111,8 +1111,8 @@ discard_excess_cache(int sample_limit) {
|
||||
|
||||
while (((int)_expiring_samples.size()) > sample_limit) {
|
||||
SoundData *sd = (SoundData*)(_expiring_samples.front());
|
||||
assert(sd->_client_count == 0);
|
||||
assert(sd->_expire == _expiring_samples.begin());
|
||||
nassertv(sd->_client_count == 0);
|
||||
nassertv(sd->_expire == _expiring_samples.begin());
|
||||
_expiring_samples.pop_front();
|
||||
_sample_cache.erase(_sample_cache.find(sd->_movie->get_filename()));
|
||||
audio_debug("Expiring: " << sd->_movie->get_filename().get_basename());
|
||||
@ -1121,8 +1121,8 @@ discard_excess_cache(int sample_limit) {
|
||||
|
||||
while (((int)_expiring_streams.size()) > stream_limit) {
|
||||
SoundData *sd = (SoundData*)(_expiring_streams.front());
|
||||
assert(sd->_client_count == 0);
|
||||
assert(sd->_expire == _expiring_streams.begin());
|
||||
nassertv(sd->_client_count == 0);
|
||||
nassertv(sd->_expire == _expiring_streams.begin());
|
||||
_expiring_streams.pop_front();
|
||||
audio_debug("Expiring: " << sd->_movie->get_filename().get_basename());
|
||||
delete sd;
|
||||
|
@ -201,7 +201,7 @@ stop() {
|
||||
if (is_playing()) {
|
||||
_manager->make_current();
|
||||
|
||||
assert(has_sound_data());
|
||||
nassertv(has_sound_data());
|
||||
|
||||
alGetError(); // clear errors
|
||||
alSourceStop(_source);
|
||||
@ -290,7 +290,7 @@ restart_stalled_audio() {
|
||||
ALenum status;
|
||||
|
||||
if (!is_valid()) return;
|
||||
assert(is_playing());
|
||||
nassertv(is_playing());
|
||||
|
||||
if (_stream_queued.size() == 0) {
|
||||
return;
|
||||
@ -310,7 +310,7 @@ void OpenALAudioSound::
|
||||
queue_buffer(ALuint buffer, int samples, int loop_index, double time_offset) {
|
||||
ReMutexHolder holder(OpenALAudioManager::_lock);
|
||||
|
||||
assert(is_playing());
|
||||
nassertv(is_playing());
|
||||
|
||||
// Now push the buffer into the stream queue.
|
||||
alGetError();
|
||||
@ -336,7 +336,7 @@ ALuint OpenALAudioSound::
|
||||
make_buffer(int samples, int channels, int rate, unsigned char *data) {
|
||||
ReMutexHolder holder(OpenALAudioManager::_lock);
|
||||
|
||||
assert(is_playing());
|
||||
nassertr(is_playing(), 0);
|
||||
|
||||
// Allocate a buffer to hold the data.
|
||||
alGetError();
|
||||
@ -370,7 +370,7 @@ int OpenALAudioSound::
|
||||
read_stream_data(int bytelen, unsigned char *buffer) {
|
||||
ReMutexHolder holder(OpenALAudioManager::_lock);
|
||||
|
||||
assert(has_sound_data());
|
||||
nassertr(has_sound_data(), 0);
|
||||
|
||||
MovieAudioCursor *cursor = _sd->_stream;
|
||||
double length = cursor->length();
|
||||
@ -423,7 +423,7 @@ void OpenALAudioSound::
|
||||
correct_calibrated_clock(double rtc, double t) {
|
||||
ReMutexHolder holder(OpenALAudioManager::_lock);
|
||||
|
||||
assert(is_playing());
|
||||
nassertv(is_playing());
|
||||
|
||||
double cc = (rtc - _calibrated_clock_base) * _calibrated_clock_scale;
|
||||
double diff = cc-t;
|
||||
@ -458,8 +458,8 @@ pull_used_buffers() {
|
||||
ReMutexHolder holder(OpenALAudioManager::_lock);
|
||||
|
||||
if (!is_valid()) return;
|
||||
assert(is_playing());
|
||||
assert(has_sound_data());
|
||||
nassertv(is_playing());
|
||||
nassertv(has_sound_data());
|
||||
|
||||
while (_stream_queued.size()) {
|
||||
ALuint buffer = 0;
|
||||
@ -517,8 +517,8 @@ push_fresh_buffers() {
|
||||
static unsigned char data[65536];
|
||||
|
||||
if (!is_valid()) return;
|
||||
assert(is_playing());
|
||||
assert(has_sound_data());
|
||||
nassertv(is_playing());
|
||||
nassertv(has_sound_data());
|
||||
|
||||
if (_sd->_sample) {
|
||||
while ((_loops_completed < _playing_loops) &&
|
||||
@ -545,7 +545,7 @@ push_fresh_buffers() {
|
||||
break;
|
||||
}
|
||||
ALuint buffer = make_buffer(samples, channels, rate, data);
|
||||
if (!is_valid()) return;
|
||||
if (!is_valid() || !buffer) return;
|
||||
queue_buffer(buffer, samples, loop_index, time_offset);
|
||||
if (!is_valid()) return;
|
||||
fill += samples;
|
||||
@ -582,7 +582,7 @@ void OpenALAudioSound::
|
||||
cache_time(double rtc) {
|
||||
ReMutexHolder holder(OpenALAudioManager::_lock);
|
||||
|
||||
assert(is_playing());
|
||||
nassertv(is_playing());
|
||||
|
||||
double t=get_calibrated_clock(rtc);
|
||||
double max = _length * _playing_loops;
|
||||
|
Loading…
x
Reference in New Issue
Block a user