[Gcblue-commits] gcb_wx/src/common tcOggStreamer.cpp,1.6,1.7 tcOptions.cpp,1.5,1.6 tcOptionsView.cpp
Status: Alpha
Brought to you by:
ddcforge
|
From: <ddc...@us...> - 2004-02-29 23:02:10
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13290/src/common Modified Files: tcOggStreamer.cpp tcOptions.cpp tcOptionsView.cpp tcSound.cpp tcSoundConsole.cpp Log Message: Index: tcOggStreamer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOggStreamer.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcOggStreamer.cpp 22 Dec 2003 02:32:37 -0000 1.6 --- tcOggStreamer.cpp 29 Feb 2004 22:51:35 -0000 1.7 *************** *** 87,95 **** --- 87,98 ---- void tcOggStreamer::Init() { + std::cout << "Generating buffers" << std::endl; alGenBuffers(NUM_BUFFERS, buffers); Check(); + std::cout << "Generating source" << std::endl; alGenSources(1, &source); Check(); + std::cout << "Configuring source" << std::endl; alSource3f(source, AL_POSITION, 0.0, 0.0, 0.0); alSource3f(source, AL_VELOCITY, 0.0, 0.0, 0.0); Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcOptions.cpp 9 Dec 2003 00:36:03 -0000 1.5 --- tcOptions.cpp 29 Feb 2004 22:51:35 -0000 1.6 *************** *** 59,62 **** --- 59,70 ---- oi.mnStateCount = 2; oi.mnValue = 0; + oi.mpAssociated = &disableSound; + oi.mzCaption[0] = "Sound Enabled"; + oi.mzCaption[1] = "Sound Disabled"; + AddOption(oi); + + oi.meType = tsOptionInfo::OT_RADIOBUTTON; + oi.mnStateCount = 2; + oi.mnValue = 0; oi.mpAssociated = &mbPlayMusic; oi.mzCaption[0] = "Music OFF"; Index: tcOptionsView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptionsView.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcOptionsView.cpp 30 Nov 2003 17:23:52 -0000 1.3 --- tcOptionsView.cpp 29 Feb 2004 22:51:35 -0000 1.4 *************** *** 209,215 **** } mpOptions->Serialize(false); // create new options file ! if (mpSound != NULL) { ! mpSound->PlayEffect(SEFFECT_BEEP2); ! } } else --- 209,214 ---- } mpOptions->Serialize(false); // create new options file ! ! tcSound::Get()->PlayEffect(SEFFECT_BEEP2); } else *************** *** 258,262 **** mpFont = NULL; mpBrush = NULL; - mpSound = NULL; mnXStart = 100; mnYStart = 100; --- 257,260 ---- Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcSound.cpp 13 Feb 2004 01:31:33 -0000 1.12 --- tcSound.cpp 29 Feb 2004 22:51:35 -0000 1.13 *************** *** 106,111 **** if((alGetError())!=AL_NO_ERROR) { ! printf("error loading waves "); ! } --- 106,110 ---- if((alGetError())!=AL_NO_ERROR) { ! fprintf(stderr, "Error loading wav files.\n"); } *************** *** 229,232 **** --- 228,233 ---- void tcSound::PlayMusic(std::string song) { + if (!mbInitialized) return; + std::string musicPath = OGG_PATH; musicPath += song; *************** *** 241,244 **** --- 242,246 ---- void tcSound::QueueMusic(std::string song) { + if (!mbInitialized) return; oggStreamer->Queue(song); } *************** *** 246,249 **** --- 248,253 ---- void tcSound::QueueRandomMusic() { + if (!mbInitialized) return; + wxArrayString fileList; int fileCount = (int)wxDir::GetAllFiles(OGG_PATH, &fileList, "*.ogg", wxDIR_FILES); *************** *** 257,260 **** --- 261,265 ---- void tcSound::SeekMusic(double seekTime) { + if (!mbInitialized) return; oggStreamer->Seek(seekTime); } *************** *** 262,265 **** --- 267,271 ---- void tcSound::SetMusicPause(bool state) { + if (!mbInitialized) return; oggStreamer->SetPause(state); } *************** *** 269,272 **** --- 275,279 ---- void tcSound::SetMusicVolume(float vol) { + if (!mbInitialized) return; oggStreamer->SetVolume(vol); } *************** *** 284,287 **** --- 291,295 ---- void tcSound::StopMusic() { + if (!mbInitialized) return; if (meMusicState != MS_STOPPED) { *************** *** 304,307 **** --- 312,316 ---- void tcSound::UpdateAutoMusic(double afStatusTime) { + if (!mbInitialized) return; if (meMusicState == MS_STOPPED) return; if (!oggStreamer->Update()) *************** *** 440,443 **** --- 449,487 ---- + + void tcSound::UnInit() + { + int i; + + if (!mbInitialized) return; + + oggStreamer->Release(); + + for(i=0;i<N_EFFECT_BUFFERS;i++) + { + alSourceStop(SourceEffect[i]); + alDeleteSources(1,&SourceEffect[i]); + } + for(i=0;i<N_SEFFECT;i++) + { + + alDeleteBuffers(1,&BufferEffect[i]); + } + + alutExit(); + mbInitialized = false; + + } + + /** + * Method for accessing singleton instance. + */ + tcSound* tcSound::Get() + { + static tcSound instance; + + return &instance; + } + tcSound::tcSound() { *************** *** 458,488 **** mnEffectVolume = 1; // 3 dB attenuation oggStreamer = new tcOggStreamer(); } ! void tcSound::UnInit() { ! int i; ! ! oggStreamer->Release(); ! ! for(i=0;i<N_EFFECT_BUFFERS;i++) ! { ! alSourceStop(SourceEffect[i]); ! alDeleteSources(1,&SourceEffect[i]); ! } ! for(i=0;i<N_SEFFECT;i++) ! { ! ! alDeleteBuffers(1,&BufferEffect[i]); ! } ! ! alutExit(); ! mbInitialized = false; ! } - tcSound::~tcSound() { --- 502,519 ---- mnEffectVolume = 1; // 3 dB attenuation + std::cout << "Creating OGG streamer" << std::endl; oggStreamer = new tcOggStreamer(); + std::cout << "Success - Create OGG streamer" << std::endl; } ! /** ! * Should never be called. ! */ ! tcSound::tcSound(const tcSound& source) { ! wxASSERT(false); } tcSound::~tcSound() { Index: tcSoundConsole.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSoundConsole.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcSoundConsole.cpp 3 Jan 2004 00:45:12 -0000 1.5 --- tcSoundConsole.cpp 29 Feb 2004 22:51:36 -0000 1.6 *************** *** 37,45 **** int tcSoundConsole::Draw() { - wxASSERT(mpSound); - if (Redraw()) { ! mpSound->PlayEffect(mnSoundEffect); } --- 37,43 ---- int tcSoundConsole::Draw() { if (Redraw()) { ! tcSound::Get()->PlayEffect(mnSoundEffect); } *************** *** 48,55 **** /********************************************************************/ ! int tcSoundConsole::Print(const char* line) { ! if (mpSound != NULL) { ! mpSound->PlayEffect(mnSoundEffect); ! } return tcConsole::Print(line); } --- 46,53 ---- /********************************************************************/ ! int tcSoundConsole::Print(const char* line) ! { ! tcSound::Get()->PlayEffect(mnSoundEffect); ! return tcConsole::Print(line); } *************** *** 61,65 **** tcConsole(parent, pos, size, name) { - mpSound = NULL; mnSoundEffect = SEFFECT_CONSOLE; } --- 59,62 ---- |