From: Laszlo T. <ave...@us...> - 2004-04-09 13:52:03
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/ACMImporter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23366 Modified Files: ACMImp.cpp ACMImp.h Log Message: Cleaned up ACMImp (removed unused code) Index: ACMImp.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/ACMImporter/ACMImp.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ACMImp.cpp 24 Feb 2004 22:20:37 -0000 1.37 --- ACMImp.cpp 9 Apr 2004 13:38:36 -0000 1.38 *************** *** 40,47 **** static AudioStream music; static ALuint MusicSource, MusicBuffers[MUSICBUFERS]; - static int BufferDuration, BufferStartPlayTime; static SDL_mutex* musicMutex; static bool musicPlaying; - static int musicIndex; static SDL_Thread* musicThread; static unsigned char* static_memory; --- 40,45 ---- *************** *** 111,118 **** int ACMImp::PlayListManager(void* data) { - ALuint count = 0; ALuint buffersreturned = 0; ALboolean bFinished = AL_FALSE; - ALuint buffersinqueue = MUSICBUFERS; while (true) { SDL_mutexP( musicMutex ); --- 109,114 ---- *************** *** 130,140 **** { printf( "Music in INITIAL State. AutoStarting\n" ); - int size = ACM_BUFFERSIZE; unsigned char * memory = new unsigned char[ACM_BUFFERSIZE]; for (int i = 0; i < MUSICBUFERS; i++) { ! int cnt = music.reader->read_samples( ( short* ) ! memory, ! ACM_BUFFERSIZE >> ! 1 ); alBufferData( MusicBuffers[i], AL_FORMAT_STEREO16, memory, ACM_BUFFERSIZE, --- 126,132 ---- { printf( "Music in INITIAL State. AutoStarting\n" ); unsigned char * memory = new unsigned char[ACM_BUFFERSIZE]; for (int i = 0; i < MUSICBUFERS; i++) { ! music.reader->read_samples( ( short* ) memory, ACM_BUFFERSIZE >> 1 ); alBufferData( MusicBuffers[i], AL_FORMAT_STEREO16, memory, ACM_BUFFERSIZE, *************** *** 142,155 **** } delete( memory ); ! alSourceQueueBuffers( MusicSource, MUSICBUFERS, ! MusicBuffers ); ! if (alIsSource( MusicSource )) alSourcePlay( MusicSource ); } break; case AL_STOPPED: printf( "WARNING: Buffer Underrun. AutoRestarting Stream Playback\n" ); ! if (alIsSource( MusicSource )) alSourcePlay( MusicSource ); break; case AL_PLAYING: --- 134,148 ---- } delete( memory ); ! alSourceQueueBuffers( MusicSource, MUSICBUFERS, MusicBuffers ); ! if (alIsSource( MusicSource )) { alSourcePlay( MusicSource ); + } } break; case AL_STOPPED: printf( "WARNING: Buffer Underrun. AutoRestarting Stream Playback\n" ); ! if (alIsSource( MusicSource )) { alSourcePlay( MusicSource ); + } break; case AL_PLAYING: *************** *** 172,178 **** int size = ACM_BUFFERSIZE; int cnt = music.reader->read_samples( ( short* ) ! static_memory, ! ACM_BUFFERSIZE >> ! 1 ); size -= ( cnt * 2 ); if (size != 0) --- 165,169 ---- int size = ACM_BUFFERSIZE; int cnt = music.reader->read_samples( ( short* ) ! static_memory, ACM_BUFFERSIZE >> 1 ); size -= ( cnt * 2 ); if (size != 0) *************** *** 184,192 **** if (music.reader) { printf( "Queuing New Music\n" ); ! int cnt1 = music.reader->read_samples( ( short* ) ! ( static_memory + ! ( cnt*2 ) ), ! size >> ! 1 ); printf( "Added %d Samples", cnt1 ); bFinished = false; --- 175,179 ---- if (music.reader) { printf( "Queuing New Music\n" ); ! int cnt1 = music.reader->read_samples( ( short* ) ( static_memory + ( cnt*2 ) ), size >> 1 ); printf( "Added %d Samples", cnt1 ); bFinished = false; *************** *** 284,289 **** unsigned long ACMImp::Play(const char* ResRef, int XPos, int YPos) { ! DataStream* stream = core->GetResourceMgr()->GetResource( ResRef, ! IE_WAV_CLASS_ID ); if (!stream) { return 0; --- 271,275 ---- unsigned long ACMImp::Play(const char* ResRef, int XPos, int YPos) { ! DataStream* stream = core->GetResourceMgr()->GetResource( ResRef, IE_WAV_CLASS_ID ); if (!stream) { return 0; *************** *** 309,314 **** } if (error != AL_NO_ERROR) { ! DisplayALError( "Cannot Create a Buffer for this sound. Skipping", ! error ); return 0; } --- 295,299 ---- } if (error != AL_NO_ERROR) { ! DisplayALError( "Cannot Create a Buffer for this sound. Skipping", error ); return 0; } *************** *** 326,332 **** memset( memory, 0, cnt * 2 ); long cnt1 = acm->read_samples( ( short* ) memory, cnt ); ! int duration = ( ( cnt* riff_chans ) * 1000 ) / samplerate; ! alBufferData( Buffer, GetFormatEnum( riff_chans, bits ), memory, cnt * 2, ! samplerate ); if (( error = alGetError() ) != AL_NO_ERROR) { DisplayALError( "[ACMImp::Play] alBufferData : ", error ); --- 311,316 ---- memset( memory, 0, cnt * 2 ); long cnt1 = acm->read_samples( ( short* ) memory, cnt ); ! int duration = ( ( cnt1 * riff_chans ) * 1000 ) / samplerate; ! alBufferData( Buffer, GetFormatEnum( riff_chans, bits ), memory, cnt1 * 2, samplerate ); if (( error = alGetError() ) != AL_NO_ERROR) { DisplayALError( "[ACMImp::Play] alBufferData : ", error ); *************** *** 388,392 **** char path[_MAX_PATH]; ALenum error; - ALint state; strcpy( path, core->GamePath ); --- 372,375 ---- *************** *** 402,407 **** delete( music.reader ); } - ALuint* Buffer; - if (MusicBuffers[0] == 0) { alGenBuffers( MUSICBUFERS, MusicBuffers ); --- 385,388 ---- Index: ACMImp.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/ACMImporter/ACMImp.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ACMImp.h 24 Feb 2004 22:20:37 -0000 1.17 --- ACMImp.h 9 Apr 2004 13:38:43 -0000 1.18 *************** *** 46,64 **** #define MAX_STREAMS 30 - /* - typedef struct AudioStream { - FSOUND_STREAM * stream; - FSOUND_DSPUNIT * dsp; - bool playing; - bool end; - bool free; - int channel; - } AudioStream; - */ - - static ALfloat ListenerPos[3]; - static ALfloat ListenerVel[3]; - static ALfloat ListenerOri[6]; - typedef struct AudioStream { ALuint Buffer; --- 46,49 ---- |