From a1c9ec0e76ce9b7188f7a6cc422778119721938f Mon Sep 17 00:00:00 2001 From: BeZo Date: Thu, 9 Jun 2022 01:21:04 +0200 Subject: [PATCH] Sysex patches --- .gitignore | 3 +++ build.sh | 11 +++++++++++ rebuild.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ src/mididevice.cpp | 40 +++++++++++++++++++++++++++++++++++++++- 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 rebuild.sh diff --git a/.gitignore b/.gitignore index 62c5120..6f289d8 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,6 @@ MiniDexed* sdcard *.zip *.img + +# Visual Studio artefacts +.vs diff --git a/build.sh b/build.sh index 271501a..ae3e928 100755 --- a/build.sh +++ b/build.sh @@ -3,6 +3,7 @@ set -e set -x +echo "Clean: ${CLEAN}" if [ -z "${RPI}" ] ; then echo "\$RPI missing, exting" exit 1 @@ -22,19 +23,27 @@ fi # Build circle-stdlib library cd circle-stdlib/ +if [ ! -z "${CLEAN}" ] ; then make mrproper || true +fi ./configure -r ${RPI} --prefix "${TOOLCHAIN_PREFIX}" ${OPTIONS} -o KERNEL_MAX_SIZE=0x400000 make -j # Build additional libraries cd libs/circle/addon/display/ +if [ ! -z "${CLEAN}" ] ; then make clean || true +fi make -j cd ../sensor/ +if [ ! -z "${CLEAN}" ] ; then make clean || true +fi make -j cd ../Properties/ +if [ ! -z "${CLEAN}" ] ; then make clean || true +fi make -j cd ../../../.. @@ -42,7 +51,9 @@ cd .. # Build MiniDexed cd src +if [ ! -z "${CLEAN}" ] ; then make clean || true +fi make -j ls *.img cd .. diff --git a/rebuild.sh b/rebuild.sh new file mode 100644 index 0000000..99358dd --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,42 @@ +export RPI=3 + +export CLEAN="true" + +export PATH=$(readlink -f ./gcc-*/bin/):$PATH + +# Build dependencies and MiniDexed +./build.sh +cp ./src/kernel*.img ./kernels/ +if [[ $? -ne 0 ]] ; then +exit +fi +# Get Raspberry Pi boot files +cd ./circle-stdlib/libs/circle/boot +make +if [ "${RPI}" -gt 2 ] +then + make armstub64 +fi +cd - + +# Make zip that contains Raspberry Pi 4 boot files. The contents can be copied to a FAT32 formatted partition on a microSD card +#cd sdcard +#../getsysex.sh +#cd .. +cp -r ./circle-stdlib/libs/circle/boot/* sdcard +if [[ $? -ne 0 ]] ; then +exit +fi +rm -rf sdcard/config*.txt sdcard/README sdcard/Makefile sdcard/armstub sdcard/COPYING.linux +cp ./src/config.txt ./src/*img sdcard/ +if [[ $? -ne 0 ]] ; then +exit +fi +echo "usbspeed=full" > sdcard/cmdline.txt +cd sdcard +cp ../kernels/* . || true +if [[ $? -ne 0 ]] ; then +exit +fi +zip -r ../MiniDexed_$(date +%Y-%m-%d).zip * +cd - diff --git a/src/mididevice.cpp b/src/mididevice.cpp index 4e15cf1..b32d610 100644 --- a/src/mididevice.cpp +++ b/src/mididevice.cpp @@ -174,6 +174,7 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign { float32_t nMasterVolume=((pMessage[5] & 0x7c) & ((pMessage[6] & 0x7c) <<7))/(1<<14); LOGNOTE("Master volume: %f",nMasterVolume); + printf("Master volume: %f",nMasterVolume); m_pSynthesizer->setMasterVolume(nMasterVolume); } else @@ -187,6 +188,7 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign if (m_ChannelMap[nTG] == ucSysExChannel || m_ChannelMap[nTG] == OmniMode) { LOGNOTE("MIDI-SYSEX: channel: %u, len: %u, TG: %u",m_ChannelMap[nTG],nLength,nTG); + printf("MIDI-SYSEX: channel: %lu, len: %lu, TG: %lu\n",m_ChannelMap[nTG],nLength,nTG); HandleSystemExclusive(pMessage, nLength, nCable, nTG); } } @@ -334,8 +336,11 @@ void CMIDIDevice::HandleSystemExclusive(const uint8_t* pMessage, const size_t nL int16_t sysex_return; sysex_return = m_pSynthesizer->checkSystemExclusive(pMessage, nLength, nTG); + uint8_t instanceID = pMessage[2]&0xF; LOGDBG("SYSEX handler return value: %d", sysex_return); - + printf("SYSEX handler return value: %d\n", sysex_return); + printf("TG %i\n", nTG); + printf("%02X\n", instanceID); switch (sysex_return) { case -1: @@ -426,6 +431,39 @@ void CMIDIDevice::HandleSystemExclusive(const uint8_t* pMessage, const size_t nL LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); m_pSynthesizer->setAftertouchTarget(pMessage[5],nTG); break; +/* BeZo patches */ + case 80: // Set midi channel + m_ChannelMap[instanceID] = pMessage[5]; + break; + case 81: // Reverb level + m_pSynthesizer->SetReverbSend (maplong (pMessage[5], 0, 127, 0, 99), instanceID); + break; + case 82: // Compressor toggle + break; + case 83: // Transpose + break; + case 84: // Detune + if (pMessage[5] == 0) + { + // "0 to 127, with 0 being no celeste (detune) effect applied at all." + m_pSynthesizer->SetMasterTune (0, instanceID); + } + else + { + m_pSynthesizer->SetMasterTune (maplong (pMessage[5], 1, 127, -99, 99), instanceID); + } + break; + case 85: // Panning + m_pSynthesizer->SetPan(pMessage[5], instanceID); + break; + case 86: // Volume + m_pSynthesizer->SetVol(pMessage[5], instanceID); + break; + case 87: // Pitch Bend + break; + case 88: // Portamento + break; +/* End of BeZo patches */ case 100: // load sysex-data into voice memory LOGDBG("One Voice bulk upload");