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
This commit is contained in:
spacy51 2007-12-27 15:20:28 +00:00
parent 9b808813d4
commit 3d7cd89633
2 changed files with 11 additions and 7 deletions

View File

@ -237,9 +237,10 @@ BOOL Logging::OnInitDialog()
void Logging::log(const char *s) void Logging::log(const char *s)
{ {
DWORD size = (DWORD)::SendMessage(m_log, WM_GETTEXTLENGTH, 0, 0); CString text;
m_log.SetSel(size, size); m_log.GetWindowText( text );
m_log.ReplaceSel(s); text.Insert( 0, s );
m_log.SetWindowText( text );
} }
void Logging::OnClose() void Logging::OnClose()

View File

@ -43,6 +43,7 @@
#include <assert.h> #include <assert.h>
#ifndef LOGALL #ifndef LOGALL
// replace logging functions with comments
#define winlog // #define winlog //
#define debugState() // #define debugState() //
#endif #endif
@ -53,11 +54,11 @@ public:
OpenAL(); OpenAL();
virtual ~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 pause(); // pause the secondary sound buffer
void reset(); // stop and reset the secondary sound buffer void reset(); // stop and reset the secondary sound buffer
void resume(); // resume the secondary sound buffer void resume(); // play/resume the secondary sound buffer
void write(); // write the emulated sound to the secondary sound buffer void write(); // write the emulated sound to a sound buffer
private: private:
OPENALFNTABLE ALFunction; OPENALFNTABLE ALFunction;
@ -189,6 +190,7 @@ bool OpenAL::init()
assert( AL_NO_ERROR == ALFunction.alGetError() ); assert( AL_NO_ERROR == ALFunction.alGetError() );
freq = 44100 / soundQuality; freq = 44100 / soundQuality;
// calculate the number of samples per frame first // calculate the number of samples per frame first
// then multiply it with the size of a sample frame (16 bit * stereo) // then multiply it with the size of a sample frame (16 bit * stereo)
soundBufferLen = ( freq / 60 ) * 4; soundBufferLen = ( freq / 60 ) * 4;
@ -270,7 +272,8 @@ void OpenAL::write()
// ==initial buffer filling== // ==initial buffer filling==
winlog( " initial buffer filling\n" ); winlog( " initial buffer filling\n" );
for( int i = 0 ; i < theApp.oalBufferCount ; i++ ) { 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 ); ALFunction.alBufferData( buffer[i], AL_FORMAT_STEREO16, soundFinalWave, soundBufferLen, freq );
assert( AL_NO_ERROR == ALFunction.alGetError() ); assert( AL_NO_ERROR == ALFunction.alGetError() );
} }