Minor adjustments to test PC SNG data extract

This commit is contained in:
Jack Andersen 2016-06-27 11:02:10 -10:00
parent 22a8534887
commit c7f093c5ee
2 changed files with 8 additions and 2 deletions

View File

@ -814,12 +814,14 @@ std::vector<uint8_t> SongConverter::SongToMIDI(const unsigned char* data, Target
while (true) while (true)
{ {
/* Load next command */ /* Load next command */
if (*reinterpret_cast<const uint32_t*>(trk->m_data) == 0xffff0000) if ((song.m_bigEndian && *reinterpret_cast<const uint32_t*>(trk->m_data) == 0xffff0000) ||
(!song.m_bigEndian && *reinterpret_cast<const uint32_t*>(trk->m_data) == 0xffff))
{ {
/* End of channel */ /* End of channel */
trk->m_data = nullptr; trk->m_data = nullptr;
break; break;
} }
#if 0
else if (trk->m_data[0] & 0x80 && trk->m_data[1] & 0x80) else if (trk->m_data[0] & 0x80 && trk->m_data[1] & 0x80)
{ {
/* Control change */ /* Control change */
@ -835,6 +837,7 @@ std::vector<uint8_t> SongConverter::SongToMIDI(const unsigned char* data, Target
events.emplace(regStart + trk->m_eventWaitCountdown, Event{ProgEvent{}, trk->m_midiChan, prog}); events.emplace(regStart + trk->m_eventWaitCountdown, Event{ProgEvent{}, trk->m_midiChan, prog});
trk->m_data += 2; trk->m_data += 2;
} }
#endif
else else
{ {
if ((trk->m_data[2] & 0x80) != 0x80) if ((trk->m_data[2] & 0x80) != 0x80)

View File

@ -348,12 +348,14 @@ bool SongState::Track::advance(Sequencer& seq, int32_t ticks)
} }
/* Load next command */ /* Load next command */
if (*reinterpret_cast<const uint32_t*>(m_data) == 0xffff0000) if ((m_parent.m_bigEndian && *reinterpret_cast<const uint32_t*>(m_data) == 0xffff0000) ||
(!m_parent.m_bigEndian && *reinterpret_cast<const uint32_t*>(m_data) == 0xffff))
{ {
/* End of channel */ /* End of channel */
m_data = nullptr; m_data = nullptr;
return !m_nextRegion->indexValid(); return !m_nextRegion->indexValid();
} }
# if 0
else if (m_data[0] & 0x80 && m_data[1] & 0x80) else if (m_data[0] & 0x80 && m_data[1] & 0x80)
{ {
/* Control change */ /* Control change */
@ -369,6 +371,7 @@ bool SongState::Track::advance(Sequencer& seq, int32_t ticks)
seq.setChanProgram(m_midiChan, prog); seq.setChanProgram(m_midiChan, prog);
m_data += 2; m_data += 2;
} }
#endif
else else
{ {
if ((m_data[2] & 0x80) != 0x80) if ((m_data[2] & 0x80) != 0x80)