From 550fab17d2d80329f7b70a59dfbe8b731de28d11 Mon Sep 17 00:00:00 2001 From: arsamus Date: Tue, 24 May 2022 23:56:43 -0300 Subject: [PATCH] Update minidexed.cpp --- src/minidexed.cpp | 69 ++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 44c8e1a..36b2fb9 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -1162,6 +1162,41 @@ int16_t CMiniDexed::checkSystemExclusive(const uint8_t* pMessage,const uint16_t return(m_pTG[nTG]->checkSystemExclusive(pMessage, nLength)); } +void CMiniDexed::getSysExVoiceDump(uint8_t* dest, uint8_t nTG) +{ + uint8_t checksum = 0; + uint8_t data[155]; + + assert (nTG < CConfig::ToneGenerators); + assert (m_pTG[nTG]); + + m_pTG[nTG]->getVoiceData(data); + + dest[0] = 0xF0; // SysEx start + dest[1] = 0x43; // ID=Yamaha + dest[2] = GetTGParameter(TGParameterMIDIChannel, nTG); // Sub-status and MIDI channel + dest[3] = 0x00; // Format number (0=1 voice) + dest[4] = 0x01; // Byte count MSB + dest[5] = 0x1B; // Byte count LSB + for (uint8_t n = 0; n < 155; n++) + { + checksum -= data[n]; + dest[6 + n] = data[n]; + } + dest[161] = checksum & 0x7f; // Checksum + dest[162] = 0xF7; // SysEx end +} + +void CMiniDexed::setMasterVolume (float32_t vol) +{ + if(vol < 0.0) + vol = 0.0; + else if(vol > 1.0) + vol = 1.0; + + nMasterVolume=vol; +} + std::string CMiniDexed::GetPerformanceFileName(unsigned nID) { return m_PerformanceConfig.GetPerformanceFileName(nID); @@ -1297,37 +1332,3 @@ void CMiniDexed::LoadPerformanceParameters(void) SetParameter (ParameterReverbLevel, m_PerformanceConfig.GetReverbLevel ()); } -void CMiniDexed::getSysExVoiceDump(uint8_t* dest, uint8_t nTG) -{ - uint8_t checksum = 0; - uint8_t data[155]; - - assert (nTG < CConfig::ToneGenerators); - assert (m_pTG[nTG]); - - m_pTG[nTG]->getVoiceData(data); - - dest[0] = 0xF0; // SysEx start - dest[1] = 0x43; // ID=Yamaha - dest[2] = GetTGParameter(TGParameterMIDIChannel, nTG); // Sub-status and MIDI channel - dest[3] = 0x00; // Format number (0=1 voice) - dest[4] = 0x01; // Byte count MSB - dest[5] = 0x1B; // Byte count LSB - for (uint8_t n = 0; n < 155; n++) - { - checksum -= data[n]; - dest[6 + n] = data[n]; - } - dest[161] = checksum & 0x7f; // Checksum - dest[162] = 0xF7; // SysEx end -} - -void CMiniDexed::setMasterVolume (float32_t vol) -{ - if(vol < 0.0) - vol = 0.0; - else if(vol > 1.0) - vol = 1.0; - - nMasterVolume=vol; -}