mirror of https://github.com/AxioDL/amuse.git
Support for N64 SNG Control and Program Change encoding
This commit is contained in:
parent
0c606fa9b7
commit
22a8534887
|
@ -846,6 +846,19 @@ std::vector<uint8_t> SongConverter::SongToMIDI(const unsigned char* data, Target
|
|||
uint8_t vel = trk->m_data[3] & 0x7f;
|
||||
events.emplace(regStart + trk->m_eventWaitCountdown, Event{NoteEvent{}, trk->m_midiChan, note, vel, length});
|
||||
}
|
||||
else if (trk->m_data[2] & 0x80 && trk->m_data[3] & 0x80)
|
||||
{
|
||||
/* Control change */
|
||||
uint8_t val = trk->m_data[2] & 0x7f;
|
||||
uint8_t ctrl = trk->m_data[3] & 0x7f;
|
||||
events.emplace(regStart + trk->m_eventWaitCountdown, Event{CtrlEvent{}, trk->m_midiChan, ctrl, val, 0});
|
||||
}
|
||||
else if (trk->m_data[2] & 0x80)
|
||||
{
|
||||
/* Program change */
|
||||
uint8_t prog = trk->m_data[2] & 0x7f;
|
||||
events.emplace(regStart + trk->m_eventWaitCountdown, Event{ProgEvent{}, trk->m_midiChan, prog});
|
||||
}
|
||||
trk->m_data += 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -381,6 +381,19 @@ bool SongState::Track::advance(Sequencer& seq, int32_t ticks)
|
|||
seq.keyOn(m_midiChan, note, vel);
|
||||
m_remNoteLengths[note] = length;
|
||||
}
|
||||
else if (m_data[2] & 0x80 && m_data[3] & 0x80)
|
||||
{
|
||||
/* Control change */
|
||||
uint8_t val = m_data[2] & 0x7f;
|
||||
uint8_t ctrl = m_data[3] & 0x7f;
|
||||
seq.setCtrlValue(m_midiChan, ctrl, val);
|
||||
}
|
||||
else if (m_data[2] & 0x80)
|
||||
{
|
||||
/* Program change */
|
||||
uint8_t prog = m_data[2] & 0x7f;
|
||||
seq.setChanProgram(m_midiChan, prog);
|
||||
}
|
||||
m_data += 4;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue