mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
*** empty log message ***
This commit is contained in:
parent
dc229aacb8
commit
2df60fded8
@ -56,6 +56,8 @@ bool AudioPool::ns_has_sound(Filename filename) {
|
|||||||
// Description: The nonstatic implementation of load_sound().
|
// Description: The nonstatic implementation of load_sound().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
AudioSound* AudioPool::ns_load_sound(Filename filename) {
|
AudioSound* AudioPool::ns_load_sound(Filename filename) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in AudioPool::ns_load_sound" << endl;
|
||||||
filename.resolve_filename(get_sound_path());
|
filename.resolve_filename(get_sound_path());
|
||||||
|
|
||||||
SoundMap::const_iterator si;
|
SoundMap::const_iterator si;
|
||||||
@ -63,8 +65,14 @@ AudioSound* AudioPool::ns_load_sound(Filename filename) {
|
|||||||
if (si != _sounds.end()) {
|
if (si != _sounds.end()) {
|
||||||
// this sound was previously loaded
|
// this sound was previously loaded
|
||||||
AudioTraits::SoundClass* sc = (*si).second;
|
AudioTraits::SoundClass* sc = (*si).second;
|
||||||
return new AudioSound(sc, sc->get_state(), sc->get_player(),
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "sound is already loaded (0x" << (void*)sc
|
||||||
|
<< ")" << endl;
|
||||||
|
AudioSound* ret = new AudioSound(sc, sc->get_state(), sc->get_player(),
|
||||||
sc->get_delstate(), filename);
|
sc->get_delstate(), filename);
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "AudioPool: returning 0x" << (void*)ret << endl;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
if (!filename.exists()) {
|
if (!filename.exists()) {
|
||||||
audio_cat.info() << "'" << filename << "' does not exist" << endl;
|
audio_cat.info() << "'" << filename << "' does not exist" << endl;
|
||||||
@ -85,9 +93,12 @@ AudioSound* AudioPool::ns_load_sound(Filename filename) {
|
|||||||
audio_cat->error() << "could not load '" << filename << "'" << endl;
|
audio_cat->error() << "could not load '" << filename << "'" << endl;
|
||||||
return (AudioSound*)0L;
|
return (AudioSound*)0L;
|
||||||
}
|
}
|
||||||
PT(AudioSound) the_sound = new AudioSound(sound, sound->get_state(),
|
AudioSound* the_sound = new AudioSound(sound, sound->get_state(),
|
||||||
sound->get_player(),
|
sound->get_player(),
|
||||||
sound->get_delstate(), filename);
|
sound->get_delstate(), filename);
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "AudioPool: returning 0x" << (void*)the_sound
|
||||||
|
<< endl;
|
||||||
_sounds[filename] = sound;
|
_sounds[filename] = sound;
|
||||||
return the_sound;
|
return the_sound;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ TypeHandle AudioSound::_type_handle;
|
|||||||
// destroy this structure
|
// destroy this structure
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
AudioSound::~AudioSound(void) {
|
AudioSound::~AudioSound(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "AudioSound destructor" << endl;
|
||||||
(*_delstate)(_state);
|
(*_delstate)(_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ static IDirectSound* musicDirectSound = NULL;
|
|||||||
#define MULTI_TO_WIDE(x,y) MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, y, -1, x, _MAX_PATH);
|
#define MULTI_TO_WIDE(x,y) MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, y, -1, x, _MAX_PATH);
|
||||||
|
|
||||||
static void update_win(void) {
|
static void update_win(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in update_win" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initialize(void) {
|
static void initialize(void) {
|
||||||
@ -132,9 +134,15 @@ static void initialize(void) {
|
|||||||
|
|
||||||
AudioManager::set_update_func(update_win);
|
AudioManager::set_update_func(update_win);
|
||||||
have_initialized = true;
|
have_initialized = true;
|
||||||
|
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "out of winAudio initialize" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shutdown(void) {
|
static void shutdown(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in winaudio shutdown" << endl;
|
||||||
|
|
||||||
// release the primary sound buffer
|
// release the primary sound buffer
|
||||||
if (soundPrimaryBuffer) {
|
if (soundPrimaryBuffer) {
|
||||||
soundPrimaryBuffer->Release();
|
soundPrimaryBuffer->Release();
|
||||||
@ -160,30 +168,50 @@ static void shutdown(void) {
|
|||||||
|
|
||||||
// shutdown COM
|
// shutdown COM
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "out of winaudio shutdown" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinSample::~WinSample(void) {
|
WinSample::~WinSample(void) {
|
||||||
// we may or may not be leaking the _data
|
// we may or may not be leaking the _data
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsample destructor called" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
float WinSample::length(void) const {
|
float WinSample::length(void) const {
|
||||||
// DO THIS
|
// DO THIS
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsample length called" << endl;
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioTraits::PlayingClass* WinSample::get_state(void) const {
|
AudioTraits::PlayingClass* WinSample::get_state(void) const {
|
||||||
return new WinSamplePlaying((WinSample*)this);
|
WinSamplePlaying* ret = new WinSamplePlaying((WinSample*)this);
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsample get_state returning 0x" << (void*)ret
|
||||||
|
<< endl;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioTraits::PlayerClass* WinSample::get_player(void) const {
|
AudioTraits::PlayerClass* WinSample::get_player(void) const {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsample get_player returning 0x"
|
||||||
|
<< (void*)(WinSamplePlayer::get_instance()) << endl;
|
||||||
return WinSamplePlayer::get_instance();
|
return WinSamplePlayer::get_instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioTraits::DeleteSoundFunc* WinSample::get_destroy(void) const {
|
AudioTraits::DeleteSoundFunc* WinSample::get_destroy(void) const {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsample get_destroy returning 0x"
|
||||||
|
<< (void*)(WinSample::destroy) << endl;
|
||||||
return WinSample::destroy;
|
return WinSample::destroy;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioTraits::DeletePlayingFunc* WinSample::get_delstate(void) const {
|
AudioTraits::DeletePlayingFunc* WinSample::get_delstate(void) const {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsample get_delstate returning 0x"
|
||||||
|
<< (void*)(WinSamplePlaying::destroy) << endl;
|
||||||
return WinSamplePlaying::destroy;
|
return WinSamplePlaying::destroy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +353,8 @@ HRESULT wave_load(const CHAR* filename, WAVEFORMATEX& wavInfo, BYTE*& wavData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
WinSample* WinSample::load_wav(Filename filename) {
|
WinSample* WinSample::load_wav(Filename filename) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in winsample load_wav" << endl;
|
||||||
WinSample* ret = (WinSample*)0L;
|
WinSample* ret = (WinSample*)0L;
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
@ -336,6 +366,8 @@ WinSample* WinSample::load_wav(Filename filename) {
|
|||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
if (wavData)
|
if (wavData)
|
||||||
delete [] wavData;
|
delete [] wavData;
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "wave_load failed, returning NULL" << endl;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,10 +376,14 @@ WinSample* WinSample::load_wav(Filename filename) {
|
|||||||
ret->_data = wavData;
|
ret->_data = wavData;
|
||||||
ret->_len = wavSize;
|
ret->_len = wavSize;
|
||||||
|
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "returning 0x" << (void*)ret << endl;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinSample* WinSample::load_raw(unsigned char* data, unsigned long size) {
|
WinSample* WinSample::load_raw(unsigned char* data, unsigned long size) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in winsample load_raw" << endl;
|
||||||
WinSample* ret = (WinSample*)0L;
|
WinSample* ret = (WinSample*)0L;
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
@ -362,18 +398,27 @@ WinSample* WinSample::load_raw(unsigned char* data, unsigned long size) {
|
|||||||
wavInfo.nBlockAlign = wavInfo.wBitsPerSample / 8 * wavInfo.nChannels;
|
wavInfo.nBlockAlign = wavInfo.wBitsPerSample / 8 * wavInfo.nChannels;
|
||||||
wavInfo.nAvgBytesPerSec = wavInfo.nSamplesPerSec * wavInfo.nBlockAlign;
|
wavInfo.nAvgBytesPerSec = wavInfo.nSamplesPerSec * wavInfo.nBlockAlign;
|
||||||
|
|
||||||
if (data == (unsigned char*)0L)
|
if (data == (unsigned char*)0L) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "data is null, returning same" << endl;
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// create a direct sound channel for this data
|
// create a direct sound channel for this data
|
||||||
ret = new WinSample();
|
ret = new WinSample();
|
||||||
memcpy(&(ret->_info), &wavInfo, sizeof(WAVEFORMATEX));
|
memcpy(&(ret->_info), &wavInfo, sizeof(WAVEFORMATEX));
|
||||||
ret->_data = data;
|
ret->_data = data;
|
||||||
ret->_len = size;
|
ret->_len = size;
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "WinSample::load_raw returning 0x" << (void*)ret
|
||||||
|
<< endl;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinSample::destroy(AudioTraits::SoundClass* sample) {
|
void WinSample::destroy(AudioTraits::SoundClass* sample) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsample destroy deleting 0x" << (void*)sample
|
||||||
|
<< endl;
|
||||||
delete sample;
|
delete sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,26 +530,43 @@ void WinMusic::init(void) {
|
|||||||
|
|
||||||
float WinMusic::length(void) const {
|
float WinMusic::length(void) const {
|
||||||
// DO THIS
|
// DO THIS
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winmusic length" << endl;
|
||||||
return -1.;
|
return -1.;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioTraits::PlayingClass* WinMusic::get_state(void) const {
|
AudioTraits::PlayingClass* WinMusic::get_state(void) const {
|
||||||
return new WinMusicPlaying((WinMusic*)this);
|
WinMusicPlaying* ret = new WinMusicPlaying((WinMusic*)this);
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winmusic get_state returning 0x"
|
||||||
|
<< (void*)ret << endl;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioTraits::PlayerClass* WinMusic::get_player(void) const {
|
AudioTraits::PlayerClass* WinMusic::get_player(void) const {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winmusic get_player returning 0x"
|
||||||
|
<< (void*)(WinMusicPlayer::get_instance()) << endl;
|
||||||
return WinMusicPlayer::get_instance();
|
return WinMusicPlayer::get_instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioTraits::DeleteSoundFunc* WinMusic::get_destroy(void) const {
|
AudioTraits::DeleteSoundFunc* WinMusic::get_destroy(void) const {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winmusic get_destroy returning 0x"
|
||||||
|
<< (void*)(WinMusic::destroy) << endl;
|
||||||
return WinMusic::destroy;
|
return WinMusic::destroy;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioTraits::DeletePlayingFunc* WinMusic::get_delstate(void) const {
|
AudioTraits::DeletePlayingFunc* WinMusic::get_delstate(void) const {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winmusic get_delstate returning 0x"
|
||||||
|
<< (void*)(WinMusicPlaying::destroy) << endl;
|
||||||
return WinMusicPlaying::destroy;
|
return WinMusicPlaying::destroy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinMusic::destroy(AudioTraits::SoundClass* music) {
|
void WinMusic::destroy(AudioTraits::SoundClass* music) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winmusic destroy got 0x" << (void*)music << endl;
|
||||||
delete music;
|
delete music;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,14 +639,24 @@ WinMusic* WinMusic::load_midi(Filename filename) {
|
|||||||
|
|
||||||
WinSamplePlaying::WinSamplePlaying(AudioTraits::SoundClass* s)
|
WinSamplePlaying::WinSamplePlaying(AudioTraits::SoundClass* s)
|
||||||
: AudioTraits::PlayingClass(s) {
|
: AudioTraits::PlayingClass(s) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in WinSamplePlaying constructor" << endl;
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
WinSample* ws = (WinSample*)s;
|
WinSample* ws = (WinSample*)s;
|
||||||
|
|
||||||
if (ws == (WinSample*)0L)
|
if (ws == (WinSample*)0L) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "the sample we were handed is NULL, returning"
|
||||||
|
<< endl;
|
||||||
return;
|
return;
|
||||||
if (ws->_data == (unsigned char*)0L)
|
}
|
||||||
|
if (ws->_data == (unsigned char*)0L) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "the sample has null data, returning" << endl;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DSBUFFERDESC dsbdDesc;
|
DSBUFFERDESC dsbdDesc;
|
||||||
ZeroMemory(&dsbdDesc, sizeof(DSBUFFERDESC));
|
ZeroMemory(&dsbdDesc, sizeof(DSBUFFERDESC));
|
||||||
@ -598,38 +670,62 @@ WinSamplePlaying::WinSamplePlaying(AudioTraits::SoundClass* s)
|
|||||||
|
|
||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
_channel = NULL;
|
_channel = NULL;
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "failed to create a channel" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BYTE* dst = NULL;
|
BYTE* dst = NULL;
|
||||||
dst = this->lock();
|
dst = this->lock();
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "WinSamplePlaying::WinSamplePlaying _data = 0x"
|
||||||
|
<< (void*)(ws->_data) << " dst = 0x"
|
||||||
|
<< (void*)dst << endl;
|
||||||
try {
|
try {
|
||||||
memcpy(dst, ws->_data, ws->_len);
|
memcpy(dst, ws->_data, ws->_len);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
_channel = NULL;
|
_channel = NULL;
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "memcpy failed. dst = 0x" << (void*)dst
|
||||||
|
<< " data = 0x" << (void*)(ws->_data)
|
||||||
|
<< " len = " << ws->_len << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->unlock();
|
this->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
WinSamplePlaying::~WinSamplePlaying(void) {
|
WinSamplePlaying::~WinSamplePlaying(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsampleplaying destructor" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinSamplePlaying::destroy(AudioTraits::PlayingClass* play) {
|
void WinSamplePlaying::destroy(AudioTraits::PlayingClass* play) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsampleplaying destroy got 0x" << (void*)play
|
||||||
|
<< endl;
|
||||||
delete play;
|
delete play;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioTraits::PlayingClass::PlayingStatus WinSamplePlaying::status(void) {
|
AudioTraits::PlayingClass::PlayingStatus WinSamplePlaying::status(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsampleplaying status returning ";
|
||||||
if (_channel) {
|
if (_channel) {
|
||||||
DWORD dwStatus;
|
DWORD dwStatus;
|
||||||
_channel->GetStatus(&dwStatus);
|
_channel->GetStatus(&dwStatus);
|
||||||
if (dwStatus & DSBSTATUS_PLAYING)
|
if (dwStatus & DSBSTATUS_PLAYING) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug(false) << "PLAYING" << endl;
|
||||||
return AudioTraits::PlayingClass::PLAYING;
|
return AudioTraits::PlayingClass::PLAYING;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug(false) << "READY" << endl;;
|
||||||
return AudioTraits::PlayingClass::READY;
|
return AudioTraits::PlayingClass::READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE* WinSamplePlaying::lock(void) {
|
BYTE* WinSamplePlaying::lock(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in winsampleplaying lock" << endl;
|
||||||
WinSample* s = (WinSample*)(_sound);
|
WinSample* s = (WinSample*)(_sound);
|
||||||
HRESULT result = _channel->Lock(0, 0, (void**)&(s->_data), &(s->_len), NULL,
|
HRESULT result = _channel->Lock(0, 0, (void**)&(s->_data), &(s->_len), NULL,
|
||||||
0, DSBLOCK_ENTIREBUFFER);
|
0, DSBLOCK_ENTIREBUFFER);
|
||||||
@ -637,23 +733,39 @@ BYTE* WinSamplePlaying::lock(void) {
|
|||||||
audio_cat->error() << "failed to lock buffer" << endl;
|
audio_cat->error() << "failed to lock buffer" << endl;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "returning 0x" << (void*)(s->_data) << endl;
|
||||||
return (s->_data);
|
return (s->_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinSamplePlaying::unlock(void) {
|
void WinSamplePlaying::unlock(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in winsampleplaying unlock" << endl;
|
||||||
WinSample* s = (WinSample*)(_sound);
|
WinSample* s = (WinSample*)(_sound);
|
||||||
HRESULT result = _channel->Unlock(s->_data, s->_len, NULL, 0);
|
HRESULT result = _channel->Unlock(s->_data, s->_len, NULL, 0);
|
||||||
CHECK_RESULT(result, "failed to unlock buffer");
|
CHECK_RESULT(result, "failed to unlock buffer");
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "out of winsampleplaying unlock" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinMusicPlaying::WinMusicPlaying(AudioTraits::SoundClass* s) : AudioTraits::PlayingClass(s) {
|
WinMusicPlaying::WinMusicPlaying(AudioTraits::SoundClass* s)
|
||||||
|
: AudioTraits::PlayingClass(s) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in winmusicplaying constructor" << endl;
|
||||||
initialize();
|
initialize();
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "out of winmusicplaying constructor" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinMusicPlaying::~WinMusicPlaying(void) {
|
WinMusicPlaying::~WinMusicPlaying(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winmusicplaying destructor" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinMusicPlaying::destroy(AudioTraits::PlayingClass* play) {
|
void WinMusicPlaying::destroy(AudioTraits::PlayingClass* play) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winmusicplaying destroy got 0x" << (void*)play
|
||||||
|
<< endl;
|
||||||
delete play;
|
delete play;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,10 +791,14 @@ AudioTraits::PlayingClass::PlayingStatus WinMusicPlaying::status(void) {
|
|||||||
WinSamplePlayer* WinSamplePlayer::_global_instance = (WinSamplePlayer*)0L;
|
WinSamplePlayer* WinSamplePlayer::_global_instance = (WinSamplePlayer*)0L;
|
||||||
|
|
||||||
WinSamplePlayer::~WinSamplePlayer(void) {
|
WinSamplePlayer::~WinSamplePlayer(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in winsampleplayer destructor" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinSamplePlayer::play_sound(AudioTraits::SoundClass* sample,
|
void WinSamplePlayer::play_sound(AudioTraits::SoundClass* sample,
|
||||||
AudioTraits::PlayingClass* play) {
|
AudioTraits::PlayingClass* play) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in winsampleplayer play_sound" << endl;
|
||||||
initialize();
|
initialize();
|
||||||
WinSample* wsample = (WinSample*)sample;
|
WinSample* wsample = (WinSample*)sample;
|
||||||
WinSamplePlaying* wplay = (WinSamplePlaying*)play;
|
WinSamplePlaying* wplay = (WinSamplePlaying*)play;
|
||||||
@ -693,26 +809,37 @@ void WinSamplePlayer::play_sound(AudioTraits::SoundClass* sample,
|
|||||||
if (FAILED(result))
|
if (FAILED(result))
|
||||||
audio_cat->error() << "sample play failed" << endl;
|
audio_cat->error() << "sample play failed" << endl;
|
||||||
}
|
}
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "out of winsampleplayer play_sound" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinSamplePlayer::set_volume(AudioTraits::PlayingClass*, int) {
|
void WinSamplePlayer::set_volume(AudioTraits::PlayingClass*, int) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsampleplayer set_volume" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinSamplePlayer* WinSamplePlayer::get_instance(void) {
|
WinSamplePlayer* WinSamplePlayer::get_instance(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in winsampleplayer get_instance" << endl;
|
||||||
if (_global_instance == (WinSamplePlayer*)0L)
|
if (_global_instance == (WinSamplePlayer*)0L)
|
||||||
_global_instance = new WinSamplePlayer();
|
_global_instance = new WinSamplePlayer();
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "winsampleplayer returning 0x"
|
||||||
|
<< (void*)_global_instance << endl;
|
||||||
return _global_instance;
|
return _global_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinMusicPlayer* WinMusicPlayer::_global_instance = (WinMusicPlayer*)0L;
|
WinMusicPlayer* WinMusicPlayer::_global_instance = (WinMusicPlayer*)0L;
|
||||||
|
|
||||||
WinMusicPlayer::~WinMusicPlayer(void) {
|
WinMusicPlayer::~WinMusicPlayer(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in winmusicplayer destructor" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinMusicPlayer::play_sound(AudioTraits::SoundClass* music,
|
void WinMusicPlayer::play_sound(AudioTraits::SoundClass* music,
|
||||||
AudioTraits::PlayingClass*) {
|
AudioTraits::PlayingClass*) {
|
||||||
if (audio_cat->is_debug())
|
if (audio_cat->is_debug())
|
||||||
audio_cat->debug() << "in WinMusicPlayer::play_music()" << endl;
|
audio_cat->debug() << "in WinMusicPlayer::play_sound()" << endl;
|
||||||
initialize();
|
initialize();
|
||||||
WinMusic* wmusic = (WinMusic*)music;
|
WinMusic* wmusic = (WinMusic*)music;
|
||||||
IDirectMusicPerformance* _perf = wmusic->get_performance();
|
IDirectMusicPerformance* _perf = wmusic->get_performance();
|
||||||
@ -744,15 +871,22 @@ void WinMusicPlayer::play_sound(AudioTraits::SoundClass* music,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (audio_cat->is_debug())
|
if (audio_cat->is_debug())
|
||||||
audio_cat->debug() << "out of WinMusicPlayer::play_music()" << endl;
|
audio_cat->debug() << "out of WinMusicPlayer::play_sound()" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinMusicPlayer::set_volume(AudioTraits::PlayingClass*, int) {
|
void WinMusicPlayer::set_volume(AudioTraits::PlayingClass*, int) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "WinMusicPlayer::set_volume()" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinMusicPlayer* WinMusicPlayer::get_instance(void) {
|
WinMusicPlayer* WinMusicPlayer::get_instance(void) {
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "in WinMusicPlayer::get_instance" << endl;
|
||||||
if (_global_instance == (WinMusicPlayer*)0L)
|
if (_global_instance == (WinMusicPlayer*)0L)
|
||||||
_global_instance = new WinMusicPlayer();
|
_global_instance = new WinMusicPlayer();
|
||||||
|
if (audio_cat->is_debug())
|
||||||
|
audio_cat->debug() << "WinMusicPlayer::get_instance returning 0x"
|
||||||
|
<< (void*)_global_instance << endl;
|
||||||
return _global_instance;
|
return _global_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user