From 3d7cd89633f960a8ceba65eda423e5aefcf692ea Mon Sep 17 00:00:00 2001 From: spacy51 Date: Thu, 27 Dec 2007 15:20:28 +0000 Subject: [PATCH] Logging: New messages will not replace old messages anymore when window is opened OpenAL: Corrected some comments git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@243 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/win32/Logging.cpp | 7 ++++--- src/win32/OpenAL.cpp | 11 +++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/win32/Logging.cpp b/src/win32/Logging.cpp index bc243b50..5aa89308 100644 --- a/src/win32/Logging.cpp +++ b/src/win32/Logging.cpp @@ -237,9 +237,10 @@ BOOL Logging::OnInitDialog() void Logging::log(const char *s) { - DWORD size = (DWORD)::SendMessage(m_log, WM_GETTEXTLENGTH, 0, 0); - m_log.SetSel(size, size); - m_log.ReplaceSel(s); + CString text; + m_log.GetWindowText( text ); + text.Insert( 0, s ); + m_log.SetWindowText( text ); } void Logging::OnClose() diff --git a/src/win32/OpenAL.cpp b/src/win32/OpenAL.cpp index 190e731e..831b4294 100644 --- a/src/win32/OpenAL.cpp +++ b/src/win32/OpenAL.cpp @@ -43,6 +43,7 @@ #include #ifndef LOGALL +// replace logging functions with comments #define winlog // #define debugState() // #endif @@ -53,11 +54,11 @@ public: OpenAL(); virtual ~OpenAL(); - bool init(); // initialize the primary and secondary sound buffer + bool init(); // initialize the sound buffer queue void pause(); // pause the secondary sound buffer void reset(); // stop and reset the secondary sound buffer - void resume(); // resume the secondary sound buffer - void write(); // write the emulated sound to the secondary sound buffer + void resume(); // play/resume the secondary sound buffer + void write(); // write the emulated sound to a sound buffer private: OPENALFNTABLE ALFunction; @@ -189,6 +190,7 @@ bool OpenAL::init() assert( AL_NO_ERROR == ALFunction.alGetError() ); freq = 44100 / soundQuality; + // calculate the number of samples per frame first // then multiply it with the size of a sample frame (16 bit * stereo) soundBufferLen = ( freq / 60 ) * 4; @@ -270,7 +272,8 @@ void OpenAL::write() // ==initial buffer filling== winlog( " initial buffer filling\n" ); for( int i = 0 ; i < theApp.oalBufferCount ; i++ ) { - // filling the buffers explicitly with silence would be cleaner... + // Filling the buffers explicitly with silence would be cleaner, + // but the very first sample is usually silence anyway. ALFunction.alBufferData( buffer[i], AL_FORMAT_STEREO16, soundFinalWave, soundBufferLen, freq ); assert( AL_NO_ERROR == ALFunction.alGetError() ); }