Esempio n. 1
0
bool GOrgueMidiMerger::Process(GOrgueMidiEvent& e)
{
    if (e.GetMidiType() == MIDI_CTRL_CHANGE && e.GetKey() == MIDI_CTRL_BANK_SELECT_MSB)
    {
        m_BankMsb[e.GetChannel() - 1] = e.GetValue();
        return false;
    }
    if (e.GetMidiType() == MIDI_CTRL_CHANGE && e.GetKey() == MIDI_CTRL_BANK_SELECT_LSB)
    {
        m_BankLsb[e.GetChannel() - 1] = e.GetValue();
        return false;
    }
    if (e.GetMidiType() == MIDI_CTRL_CHANGE && e.GetKey() == MIDI_CTRL_RPN_LSB)
    {
        m_RpnLsb[e.GetChannel() - 1] = e.GetValue();
        m_Rpn = true;
        return false;
    }
    if (e.GetMidiType() == MIDI_CTRL_CHANGE && e.GetKey() == MIDI_CTRL_RPN_MSB)
    {
        m_RpnMsb[e.GetChannel() - 1] = e.GetValue();
        m_Rpn = true;
        return false;
    }
    if (e.GetMidiType() == MIDI_CTRL_CHANGE && e.GetKey() == MIDI_CTRL_NRPN_LSB)
    {
        m_NrpnLsb[e.GetChannel() - 1] = e.GetValue();
        m_Rpn = false;
        return false;
    }
    if (e.GetMidiType() == MIDI_CTRL_CHANGE && e.GetKey() == MIDI_CTRL_NRPN_MSB)
    {
        m_NrpnMsb[e.GetChannel() - 1] = e.GetValue();
        m_Rpn = false;
        return false;
    }
    if (e.GetMidiType() == MIDI_PGM_CHANGE)
        e.SetKey(((e.GetKey() - 1) | (m_BankLsb[e.GetChannel() - 1] << 7) | (m_BankMsb[e.GetChannel() - 1] << 14)) + 1);

    if (e.GetMidiType() == MIDI_CTRL_CHANGE && e.GetKey() == MIDI_CTRL_DATA_ENTRY)
    {
        if (m_Rpn)
        {
            e.SetMidiType(MIDI_RPN);
            e.SetKey((m_RpnLsb[e.GetChannel() - 1] << 0) | (m_RpnMsb[e.GetChannel() - 1] << 7));
        }
        else
        {
            e.SetMidiType(MIDI_NRPN);
            e.SetKey((m_NrpnLsb[e.GetChannel() - 1] << 0) | (m_NrpnMsb[e.GetChannel() - 1] << 7));
        }
    }

    return true;
}
Esempio n. 2
0
void GOrgueMidiRecorder::Clear()
{
	m_Mappings.clear();
	m_Preconfig.clear();
	m_NextChannel = 1;
	m_NextNRPN = 0;

	GOrgueMidiEvent e;
	e.SetMidiType(MIDI_SYSEX_GO_CLEAR);
	e.SetTime(wxGetLocalTimeMillis());
	SendEvent(e);
}