Work on MIDI-to-SNG conversion

This commit is contained in:
Jack Andersen 2016-06-21 18:18:28 -10:00
parent a0bb35433a
commit bd10015024
4 changed files with 779 additions and 106 deletions

View File

@ -49,7 +49,7 @@ void RegisterAudioUnit();
- (nullable id)initWithComponentDescription:(AudioComponentDescription)componentDescription
error:(NSError * __nullable * __nonnull)outError
viewController:(AudioUnitViewController* __nonnull)vc;
- (void)requestAudioGroup:(AudioGroupToken*)group;
- (void)requestAudioGroup:(AudioGroupToken* _Nonnull)group;
@end
#endif

View File

@ -17,7 +17,7 @@ public:
PC
};
static std::vector<uint8_t> SongToMIDI(const unsigned char* data, Target& targetOut);
static std::vector<uint8_t> MIDIToSong(const unsigned char* data, Target target);
static std::vector<uint8_t> MIDIToSong(const std::vector<uint8_t>& data, Target target);
};
}

File diff suppressed because it is too large Load Diff

View File

@ -302,7 +302,7 @@ bool SongState::Track::advance(Sequencer& seq, int32_t ticks)
m_data = nullptr;
return !m_nextRegion->indexValid();
}
else if (m_data[0] & 0x80)
else if (m_data[0] & 0x80 && m_data[1] & 0x80)
{
/* Control change */
uint8_t val = m_data[0] & 0x7f;
@ -310,6 +310,13 @@ bool SongState::Track::advance(Sequencer& seq, int32_t ticks)
seq.setCtrlValue(m_midiChan, ctrl, val);
m_data += 2;
}
else if (m_data[0] & 0x80)
{
/* Program change */
uint8_t prog = m_data[0] & 0x7f;
seq.setChanProgram(m_midiChan, prog);
m_data += 2;
}
else
{
/* Note */
@ -347,7 +354,7 @@ bool SongState::Track::advance(Sequencer& seq, int32_t ticks)
m_data = nullptr;
return !m_nextRegion->indexValid();
}
else if (m_data[0] & 0x80)
else if (m_data[0] & 0x80 && m_data[1] & 0x80)
{
/* Control change */
uint8_t val = m_data[0] & 0x7f;
@ -355,6 +362,13 @@ bool SongState::Track::advance(Sequencer& seq, int32_t ticks)
seq.setCtrlValue(m_midiChan, ctrl, val);
m_data += 2;
}
else if (m_data[0] & 0x80)
{
/* Program change */
uint8_t prog = m_data[0] & 0x7f;
seq.setChanProgram(m_midiChan, prog);
m_data += 2;
}
else
{
if ((m_data[2] & 0x80) != 0x80)