MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / ClearBuffer

Method ClearBuffer

Source/DirectSound.cpp:237–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237bool CDSoundChannel::ClearBuffer()
238{
239 LPVOID pAudioPtr1, pAudioPtr2;
240 DWORD AudioBytes1, AudioBytes2;
241
242 if (IsPlaying())
243 if (!Stop())
244 return false;
245
246 if (FAILED(m_lpDirectSoundBuffer->Lock(0, m_iSoundBufferSize, &pAudioPtr1, &AudioBytes1, &pAudioPtr2, &AudioBytes2, 0)))
247 return false;
248
249 if (m_iSampleSize == 8) {
250 std::memset(pAudioPtr1, 0x80, AudioBytes1);
251 if (pAudioPtr2)
252 std::memset(pAudioPtr2, 0x80, AudioBytes2);
253 }
254 else {
255 std::memset(pAudioPtr1, 0x00, AudioBytes1);
256 if (pAudioPtr2)
257 std::memset(pAudioPtr2, 0x00, AudioBytes2);
258 }
259
260 if (FAILED(m_lpDirectSoundBuffer->Unlock((void*)pAudioPtr1, AudioBytes1, (void*)pAudioPtr2, AudioBytes2)))
261 return false;
262
263 m_lpDirectSoundBuffer->SetCurrentPosition(0);
264 m_iCurrentWriteBlock = 0;
265
266 return true;
267}
268
269bool CDSoundChannel::WriteBuffer(array_view<char> Buffer) // // //
270{

Callers 1

OpenChannelMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected