/***************************************************************************** * CSynth::Close() ***************************************************************************** * Close down the synth:, silence it, delete the list of CControlLogic objects. */ HRESULT CSynth::Close() { ::EnterCriticalSection(&m_CriticalSection); AllNotesOff(); DWORD dwX; for (dwX = 0; dwX < m_dwControlCount; dwX++) { if (m_ppControl[dwX]) { delete m_ppControl[dwX]; } } m_dwControlCount = 0; if (m_ppControl) { delete [] m_ppControl; m_ppControl = NULL; } m_stLastStats = 0; m_stLastTime = 0; ::LeaveCriticalSection(&m_CriticalSection); return S_OK; }
void MIDIDriver::AllNotesOff() { for ( int i = 0; i < 16; ++i ) { AllNotesOff ( i ); } }
static void midNotesOff(CSOUND *csound) { int chan = 0; do { AllNotesOff(csound, csound->m_chnbp[chan]); } while (++chan < MAXCHAN); }
void SynthGroupElement::AllSoundOff(UInt32 inFrame) { #if DEBUG_PRINT printf("SynthGroupElement::AllSoundOff\n"); #endif AllNotesOff(inFrame); }
/***************************************************************************** * CSynth::SetSampleRate() ***************************************************************************** * Set the sample rate of the synth. This silences the synth. The SR is * forwarded to the instrument manager. */ HRESULT CSynth::SetSampleRate(DWORD dwSampleRate) { HRESULT hr = S_OK; ::EnterCriticalSection(&m_CriticalSection); AllNotesOff(); m_stLastTime *= dwSampleRate; m_stLastTime /= m_dwSampleRate; // m_stLastTime = MulDiv(m_stLastTime,dwSampleRate,m_dwSampleRate); m_stLastStats = 0; m_dwSampleRate = dwSampleRate; m_stMinSpan = dwSampleRate / 100; // 10 ms. m_stMaxSpan = (dwSampleRate + 19) / 20; // 50 ms. ::LeaveCriticalSection(&m_CriticalSection); m_Instruments.SetSampleRate(dwSampleRate); return hr; }
/***************************************************************************** * CSynth::Deactivate() ***************************************************************************** * Gag the synth. */ HRESULT CSynth::Deactivate() { AllNotesOff(); return S_OK; }
/***************************************************************************** * CSynth::SetNumChannelGroups() ***************************************************************************** * Set the number of channel groups (virtual MIDI cables). For each channel * group, there is a separate CControlLogic object. */ HRESULT CSynth::SetNumChannelGroups(DWORD dwCableCount) { HRESULT hr = S_OK; CControlLogic **ppControl; if ((dwCableCount < 1) || (dwCableCount > MAX_CHANNEL_GROUPS)) { return E_INVALIDARG; } ::EnterCriticalSection(&m_CriticalSection); if (m_dwControlCount != dwCableCount) { ppControl = new(NonPagedPool,'PSmD') CControlLogic *[dwCableCount]; // DmSP if (ppControl) { DWORD dwX; for (dwX = 0; dwX < dwCableCount; dwX++) { ppControl[dwX] = NULL; } if (m_dwControlCount < dwCableCount) { for (dwX = 0; dwX < m_dwControlCount; dwX++) { ppControl[dwX] = m_ppControl[dwX]; } for (;dwX < dwCableCount; dwX++) { ppControl[dwX] = new(NonPagedPool,'CSmD') CControlLogic; // DmSC if (ppControl[dwX]) { hr = ppControl[dwX]->Init(&m_Instruments, this); if (FAILED(hr)) { delete ppControl[dwX]; ppControl[dwX] = NULL; dwCableCount = dwX; break; } ppControl[dwX]->SetGainAdjust(m_vrGainAdjust); } else { dwCableCount = dwX; break; } } } else { AllNotesOff(); for (dwX = 0; dwX < dwCableCount; dwX++) { ppControl[dwX] = m_ppControl[dwX]; } for (; dwX < m_dwControlCount; dwX++) { if (m_ppControl[dwX]) { delete m_ppControl[dwX]; } } } if (m_ppControl) { delete m_ppControl; } m_ppControl = ppControl; m_dwControlCount = dwCableCount; } else { hr = E_OUTOFMEMORY; } } ::LeaveCriticalSection(&m_CriticalSection); return hr; }
//----------------------------------------------------------------------------- void C700Driver::AllSoundOff() { AllNotesOff(); mDSP.ResetEcho(); }