Implement Pitch Bend, Modulation, and Sustain

#9 and #10
Thanks @rsta2
pull/50/head
probonopd 3 years ago committed by GitHub
parent 87513f4736
commit a08604df8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/dexedadapter.h
  2. 24
      src/mididevice.cpp
  3. 3
      src/minidexed.cpp

@ -63,6 +63,13 @@ public:
m_SpinLock.Release (); m_SpinLock.Release ();
} }
void ControllersRefresh (void)
{
m_SpinLock.Acquire ();
Dexed::ControllersRefresh ();
m_SpinLock.Release ();
}
private: private:
CSpinLock m_SpinLock; CSpinLock m_SpinLock;
}; };

@ -31,8 +31,10 @@
#define MIDI_AFTERTOUCH 0b1010 // TODO #define MIDI_AFTERTOUCH 0b1010 // TODO
#define MIDI_CONTROL_CHANGE 0b1011 #define MIDI_CONTROL_CHANGE 0b1011
#define MIDI_CC_BANK_SELECT_MSB 0 // TODO #define MIDI_CC_BANK_SELECT_MSB 0 // TODO
#define MIDI_CC_MODULATION 1
#define MIDI_CC_VOLUME 7 #define MIDI_CC_VOLUME 7
#define MIDI_CC_BANK_SELECT_LSB 32 #define MIDI_CC_BANK_SELECT_LSB 32
#define MIDI_CC_BANK_SUSTAIN 64
#define MIDI_PROGRAM_CHANGE 0b1100 #define MIDI_PROGRAM_CHANGE 0b1100
#define MIDI_PITCH_BEND 0b1110 #define MIDI_PITCH_BEND 0b1110
@ -131,6 +133,11 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
switch (pMessage[1]) switch (pMessage[1])
{ {
case MIDI_CC_MODULATION:
m_pSynthesizer->setModWheel (pMessage[2]);
m_pSynthesizer->ControllersRefresh ();
break;
case MIDI_CC_VOLUME: case MIDI_CC_VOLUME:
m_pSynthesizer->SetVolume (pMessage[2]); m_pSynthesizer->SetVolume (pMessage[2]);
break; break;
@ -138,6 +145,10 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
case MIDI_CC_BANK_SELECT_LSB: case MIDI_CC_BANK_SELECT_LSB:
m_pSynthesizer->BankSelectLSB (pMessage[2]); m_pSynthesizer->BankSelectLSB (pMessage[2]);
break; break;
case MIDI_CC_BANK_SUSTAIN:
m_pSynthesizer->setSustain (pMessage[2] >= 64);
break;
} }
break; break;
@ -145,9 +156,18 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
m_pSynthesizer->ProgramChange (pMessage[1]); m_pSynthesizer->ProgramChange (pMessage[1]);
break; break;
case MIDI_PITCH_BEND: case MIDI_PITCH_BEND: {
m_pSynthesizer->setPitchbend (pMessage[1]); if (nLength < 3)
{
break; break;
}
s16 nValue = pMessage[1];
nValue |= (s16) pMessage[2] << 7;
nValue -= 0x2000;
m_pSynthesizer->setPitchbend (nValue);
} break;
default: default:
break; break;

@ -102,6 +102,9 @@ bool CMiniDexed::Initialize (void)
ProgramChange (0); ProgramChange (0);
setTranspose (24); setTranspose (24);
setPBController (12, 1);
setMWController (99, 7, 0);
// setup and start the sound device // setup and start the sound device
if (!m_pSoundDevice->AllocateQueueFrames (m_pConfig->GetChunkSize ())) if (!m_pSoundDevice->AllocateQueueFrames (m_pConfig->GetChunkSize ()))
{ {

Loading…
Cancel
Save