|
|
@ -20,9 +20,9 @@ |
|
|
|
#include "minidexed.h" |
|
|
|
#include "minidexed.h" |
|
|
|
#include <circle/logger.h> |
|
|
|
#include <circle/logger.h> |
|
|
|
#include <circle/memory.h> |
|
|
|
#include <circle/memory.h> |
|
|
|
#include <circle/pwmsoundbasedevice.h> |
|
|
|
#include <circle/sound/pwmsoundbasedevice.h> |
|
|
|
#include <circle/i2ssoundbasedevice.h> |
|
|
|
#include <circle/sound/i2ssoundbasedevice.h> |
|
|
|
#include <circle/hdmisoundbasedevice.h> |
|
|
|
#include <circle/sound/hdmisoundbasedevice.h> |
|
|
|
#include <circle/gpiopin.h> |
|
|
|
#include <circle/gpiopin.h> |
|
|
|
#include <string.h> |
|
|
|
#include <string.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdio.h> |
|
|
@ -434,6 +434,8 @@ void CMiniDexed::BankSelectLSB (unsigned nBankLSB, unsigned nTG) |
|
|
|
|
|
|
|
|
|
|
|
void CMiniDexed::ProgramChange (unsigned nProgram, unsigned nTG) |
|
|
|
void CMiniDexed::ProgramChange (unsigned nProgram, unsigned nTG) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
assert (m_pConfig); |
|
|
|
|
|
|
|
|
|
|
|
nProgram=constrain((int)nProgram,0,31); |
|
|
|
nProgram=constrain((int)nProgram,0,31); |
|
|
|
|
|
|
|
|
|
|
|
assert (nTG < CConfig::ToneGenerators); |
|
|
|
assert (nTG < CConfig::ToneGenerators); |
|
|
@ -444,7 +446,16 @@ void CMiniDexed::ProgramChange (unsigned nProgram, unsigned nTG) |
|
|
|
|
|
|
|
|
|
|
|
assert (m_pTG[nTG]); |
|
|
|
assert (m_pTG[nTG]); |
|
|
|
m_pTG[nTG]->loadVoiceParameters (Buffer); |
|
|
|
m_pTG[nTG]->loadVoiceParameters (Buffer); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pConfig->GetMIDIAutoVoiceDumpOnPC()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Only do the voice dump back out over MIDI if we have a specific
|
|
|
|
|
|
|
|
// MIDI channel configured for this TG
|
|
|
|
|
|
|
|
if (m_nMIDIChannel[nTG] < CMIDIDevice::Channels) |
|
|
|
|
|
|
|
{ |
|
|
|
m_SerialMIDI.SendSystemExclusiveVoice(nProgram,0,nTG); |
|
|
|
m_SerialMIDI.SendSystemExclusiveVoice(nProgram,0,nTG); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_UI.ParameterChanged (); |
|
|
|
m_UI.ParameterChanged (); |
|
|
|
} |
|
|
|
} |
|
|
@ -531,6 +542,8 @@ void CMiniDexed::SetResonance (int nResonance, unsigned nTG) |
|
|
|
void CMiniDexed::SetMIDIChannel (uint8_t uchChannel, unsigned nTG) |
|
|
|
void CMiniDexed::SetMIDIChannel (uint8_t uchChannel, unsigned nTG) |
|
|
|
{ |
|
|
|
{ |
|
|
|
assert (nTG < CConfig::ToneGenerators); |
|
|
|
assert (nTG < CConfig::ToneGenerators); |
|
|
|
|
|
|
|
assert (uchChannel < CMIDIDevice::ChannelUnknown); |
|
|
|
|
|
|
|
|
|
|
|
m_nMIDIChannel[nTG] = uchChannel; |
|
|
|
m_nMIDIChannel[nTG] = uchChannel; |
|
|
|
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < CConfig::MaxUSBMIDIDevices; i++) |
|
|
|
for (unsigned i = 0; i < CConfig::MaxUSBMIDIDevices; i++) |
|
|
@ -1234,13 +1247,7 @@ void CMiniDexed::ProcessSound (void) |
|
|
|
|
|
|
|
|
|
|
|
assert (CConfig::ToneGenerators == 8); |
|
|
|
assert (CConfig::ToneGenerators == 8); |
|
|
|
|
|
|
|
|
|
|
|
// swap stereo channels if needed
|
|
|
|
|
|
|
|
uint8_t indexL=0, indexR=1; |
|
|
|
uint8_t indexL=0, indexR=1; |
|
|
|
if (m_bChannelsSwapped) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
indexL=1; |
|
|
|
|
|
|
|
indexR=0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// BEGIN TG mixing
|
|
|
|
// BEGIN TG mixing
|
|
|
|
float32_t tmp_float[nFrames*2]; |
|
|
|
float32_t tmp_float[nFrames*2]; |
|
|
@ -1302,6 +1309,14 @@ void CMiniDexed::ProcessSound (void) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
// END adding FXRack
|
|
|
|
// END adding FXRack
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// swap stereo channels if needed prior to writing back out
|
|
|
|
|
|
|
|
if (m_bChannelsSwapped) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
indexL=1; |
|
|
|
|
|
|
|
indexR=0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Convert dual float array (left, right) to single int16 array (left/right)
|
|
|
|
// Convert dual float array (left, right) to single int16 array (left/right)
|
|
|
|
for(uint16_t i=0; i<nFrames;i++) |
|
|
|
for(uint16_t i=0; i<nFrames;i++) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1659,7 +1674,7 @@ void CMiniDexed::getSysExVoiceDump(uint8_t* dest, uint8_t nTG) |
|
|
|
|
|
|
|
|
|
|
|
dest[0] = 0xF0; // SysEx start
|
|
|
|
dest[0] = 0xF0; // SysEx start
|
|
|
|
dest[1] = 0x43; // ID=Yamaha
|
|
|
|
dest[1] = 0x43; // ID=Yamaha
|
|
|
|
dest[2] = GetTGParameter(TGParameterMIDIChannel, nTG); // Sub-status and MIDI channel
|
|
|
|
dest[2] = 0x00 | m_nMIDIChannel[nTG]; // 0x0c Sub-status 0 and MIDI channel
|
|
|
|
dest[3] = 0x00; // Format number (0=1 voice)
|
|
|
|
dest[3] = 0x00; // Format number (0=1 voice)
|
|
|
|
dest[4] = 0x01; // Byte count MSB
|
|
|
|
dest[4] = 0x01; // Byte count MSB
|
|
|
|
dest[5] = 0x1B; // Byte count LSB
|
|
|
|
dest[5] = 0x1B; // Byte count LSB
|
|
|
|