#include "Player.h" using namespace GSL; GSLPlayer *_player = 0; #ifdef WIN32 void CALLBACK AudioOutProc( HWAVEOUT hOut, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 ) { _player->sendSoundMSG( hOut, uMsg, dwInstance, dwParam1, dwParam2 ); } #endif // Inhalt der GSLPlayer Klasse aus Player.h // Konstruktor GSLPlayer::GSLPlayer() { } // Destruktor GSLPlayer::~GSLPlayer() { sounds.leeren(); } // nicht constant bool GSLPlayer::addSound( GSLSound *snd ) { cs.lock(); int anz = sounds.getEintragAnzahl(); for( int i = 0; i < anz; i++ ) { if( sounds.z( i ) == snd ) { snd->release(); cs.unlock(); return 0; } } sounds.add( snd ); cs.unlock(); return 1; } void GSLPlayer::removeSound( GSLSound *zSnd ) { cs.lock(); int anz = sounds.getEintragAnzahl(); for( int i = 0; i < anz; i++ ) { if( sounds.z( i ) == zSnd ) { cs.unlock(); sounds.remove( i ); return; } } cs.unlock(); } #ifdef WIN32 void GSLPlayer::sendSoundMSG( HWAVEOUT hOut, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 ) { cs.lock(); int anz = sounds.getEintragAnzahl(); for( int i = 0; i < anz; i++ ) { if( sounds.z( i ) && sounds.z( i )->getHandle() == hOut ) { sounds.z( i )->msg( uMsg, dwInstance, dwParam1, dwParam2 ); break; } } cs.unlock(); } #endif