Exemplo n.º 1
0
/*****************************************************************************
 * 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 );
    }
}
Exemplo n.º 3
0
static void midNotesOff(CSOUND *csound)
{
    int chan = 0;
    do {
      AllNotesOff(csound, csound->m_chnbp[chan]);
    } while (++chan < MAXCHAN);
}
Exemplo n.º 4
0
void SynthGroupElement::AllSoundOff(UInt32 inFrame)
{
#if DEBUG_PRINT
    printf("SynthGroupElement::AllSoundOff\n");
#endif
    AllNotesOff(inFrame);
}
Exemplo n.º 5
0
/*****************************************************************************
 * 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;
}
Exemplo n.º 6
0
/*****************************************************************************
 * CSynth::Deactivate()
 *****************************************************************************
 * Gag the synth.
 */
HRESULT CSynth::Deactivate()
{
    AllNotesOff();
    return S_OK;
}
Exemplo n.º 7
0
/*****************************************************************************
 * 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;
}
Exemplo n.º 8
0
//-----------------------------------------------------------------------------
void C700Driver::AllSoundOff()
{
    AllNotesOff();
	mDSP.ResetEcho();
}