@@ -25,8 +25,7 @@ static WAVEHDR* waveBlocks;
2525static volatile int waveFreeBlockCount;
2626static int waveCurrentBlock;
2727
28- static bool m_SoundGenInitialized = FALSE ;
29-
28+ static bool m_SoundGenInitialized = false ;
3029
3130HWAVEOUT hWaveOut;
3231
@@ -56,17 +55,14 @@ void SoundGen_Initialize(WORD volume)
5655 if (m_SoundGenInitialized)
5756 return ;
5857
59- unsigned char * mbuffer;
60-
6158 DWORD totalBufferSize = (BLOCK_SIZE + sizeof (WAVEHDR)) * BLOCK_COUNT;
6259
63- mbuffer = (unsigned char *) HeapAlloc (
60+ unsigned char * mbuffer = (unsigned char *) HeapAlloc (
6461 GetProcessHeap (),
6562 HEAP_ZERO_MEMORY,
6663 totalBufferSize);
6764 if (mbuffer == NULL )
6865 {
69- // ExitProcess(1);
7066 return ;
7167 }
7268
@@ -97,13 +93,12 @@ void SoundGen_Initialize(WORD volume)
9793 return ;
9894 }
9995
100- waveOutSetVolume (hWaveOut, (DWORD)volume);
96+ waveOutSetVolume (hWaveOut, (( DWORD)volume << 16 ) | ((DWORD)volume) );
10197
10298 InitializeCriticalSection (&waveCriticalSection);
10399 bufcurpos = 0 ;
104100
105101 m_SoundGenInitialized = true ;
106- // waveOutSetPlaybackRate(hWaveOut,0x00008000);
107102}
108103
109104void SoundGen_Finalize ()
@@ -126,15 +121,15 @@ void SoundGen_Finalize()
126121 HeapFree (GetProcessHeap (), 0 , waveBlocks);
127122 waveBlocks = NULL ;
128123
129- m_SoundGenInitialized = FALSE ;
124+ m_SoundGenInitialized = false ;
130125}
131126
132127void SoundGen_SetVolume (WORD volume)
133128{
134129 if (!m_SoundGenInitialized)
135130 return ;
136131
137- waveOutSetVolume (hWaveOut, (DWORD)volume);
132+ waveOutSetVolume (hWaveOut, (( DWORD)volume << 16 ) | ((DWORD)volume) );
138133}
139134
140135void CALLBACK SoundGen_FeedDAC (unsigned short L, unsigned short R)
0 commit comments