xap/zynaddsubfx: Applied program change patch.

slackware-14.2
Damien Goutte-Gattat 11 years ago
parent 93d40351a2
commit 93d412682d
  1. 140
      xap/zynaddsubfx/ZynAddSubFX-2.4.1-program-change.diff
  2. 8
      xap/zynaddsubfx/zynaddsubfx.SlackBuild

@ -0,0 +1,140 @@
diff --git a/src/Input/ALSAMidiIn.cpp b/src/Input/ALSAMidiIn.cpp
index d50795d..53493c6 100644
--- a/src/Input/ALSAMidiIn.cpp
+++ b/src/Input/ALSAMidiIn.cpp
@@ -99,6 +99,11 @@ void ALSAMidiIn::getmidicmd(MidiCmdType &cmdtype,
cmdparams[1] = midievent->data.control.value;
//fprintf(stderr,"t=%d val=%d\n",midievent->data.control.param,midievent->data.control.value);
break;
+ case SND_SEQ_EVENT_PGMCHANGE:
+ cmdtype = MidiPgmChange;
+ cmdchan = midievent->data.control.channel;
+ cmdparams[0] = midievent->data.control.value;
+ break;
}
}
diff --git a/src/Input/MidiIn.cpp b/src/Input/MidiIn.cpp
index 3d7c5b2..a17b89a 100644
--- a/src/Input/MidiIn.cpp
+++ b/src/Input/MidiIn.cpp
@@ -28,6 +28,9 @@ int MidiIn::getcontroller(unsigned char b)
/**\todo there might be a better way to do this*/
int ctl = C_NULL;
switch(b) {
+ case 0:
+ ctl = C_bank_select_msb; //Bank Select MSB
+ break;
case 1:
ctl = C_modwheel; //Modulation Wheel
break;
@@ -40,6 +43,9 @@ int MidiIn::getcontroller(unsigned char b)
case 11:
ctl = C_expression; //Expression
break;
+ case 32:
+ ctl = C_bank_select_lsb; //Bank Select LSB
+ break;
case 64:
ctl = C_sustain; //Sustain pedal
break;
diff --git a/src/Input/MidiIn.h b/src/Input/MidiIn.h
index 5d978ea..a83efac 100644
--- a/src/Input/MidiIn.h
+++ b/src/Input/MidiIn.h
@@ -26,7 +26,7 @@
#include "../globals.h"
enum MidiCmdType {
- MidiNull, MidiNoteOFF, MidiNoteON, MidiController
+ MidiNull, MidiNoteOFF, MidiNoteON, MidiController, MidiPgmChange
};
#define MP_MAX_BYTES 4000 //in case of loooong SYS_EXes
diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp
index fa5e1b0..def5fb5 100644
--- a/src/Misc/Master.cpp
+++ b/src/Misc/Master.cpp
@@ -70,6 +70,8 @@ Master::Master()
sysefx[nefx] = new EffectMgr(0, &mutex);
;
+ bankmsb = 0;
+
defaults();
}
@@ -176,6 +178,15 @@ void Master::SetController(unsigned char chan, unsigned int type, int par)
setcontroller(chan, type, par);
}
+void Master::SetProgram(unsigned char chan, unsigned int pgm)
+{
+ if(bankmsb > 0 && (strcmp(bank.bankfiletitle, bank.banks[bankmsb].dir) != 0))
+ bank.loadbank(bank.banks[bankmsb].dir);
+ for(int npart = 0; npart < NUM_MIDI_PARTS; npart++)
+ if(chan == part[npart]->Prcvchn)
+ bank.loadfromslot(pgm, part[npart]);
+}
+
/*
* Internal Controllers
*/
@@ -202,6 +213,9 @@ void Master::setcontroller(unsigned char chan, unsigned int type, int par)
}
;
}
+ else if(type == C_bank_select_msb) { //Bank Select messages
+ bankmsb = par + 1;
+ }
else { //other controllers
for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) //Send the controller to all part assigned to the channel
if((chan == part[npart]->Prcvchn) && (part[npart]->Penabled != 0))
diff --git a/src/Misc/Master.h b/src/Misc/Master.h
index eb47522..f720082 100644
--- a/src/Misc/Master.h
+++ b/src/Misc/Master.h
@@ -77,6 +77,7 @@ class Master
unsigned char velocity);
void NoteOff(unsigned char chan, unsigned char note);
void SetController(unsigned char chan, unsigned int type, int par);
+ void SetProgram(unsigned char chan, unsigned int pgm);
//void NRPN...
@@ -170,6 +171,8 @@ class Master
unsigned char velocity);
void noteoff(unsigned char chan, unsigned char note);
void setcontroller(unsigned char chan, unsigned int type, int par);
+
+ int bankmsb;
};
diff --git a/src/globals.h b/src/globals.h
index 7c07171..9dc005c 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -201,7 +201,8 @@ enum ONOFFTYPE {
};
enum MidiControllers {
- C_NULL = 0, C_pitchwheel = 1000, C_expression = 11, C_panning = 10,
+ C_bank_select_msb = 0, C_pitchwheel = 1000, C_NULL = 1001,
+ C_expression = 11, C_panning = 10, C_bank_select_lsb = 32,
C_filtercutoff = 74, C_filterq = 71, C_bandwidth = 75, C_modwheel = 1,
C_fmamp = 76,
C_volume = 7, C_sustain = 64, C_allnotesoff = 123, C_allsoundsoff = 120,
diff --git a/src/main.cpp b/src/main.cpp
index 1e0d345..da09d22 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -144,6 +144,8 @@ void *thread1(void *arg)
master->NoteOff(cmdchan, note);
if(cmdtype == MidiController)
master->SetController(cmdchan, cmdparams[0], cmdparams[1]);
+ if(cmdtype == MidiPgmChange)
+ master->SetProgram(cmdchan, cmdparams[0]);
pthread_mutex_unlock(&master->mutex);
}

@ -36,7 +36,7 @@ WGET=${WGET:-http://downloads.sourceforge.net/zynaddsubfx/$ARCHIVE}
# Build infos
NAMEPKG=${NAMEPKG:-zynaddsubfx}
BUILD=${BUILD:-1GGD}
BUILD=${BUILD:-2GGD}
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
JOBS=${JOBS:-1}
EXT=${EXT:-txz}
@ -89,6 +89,8 @@ tar xf $CWD/$ARCHIVE
cd $NAME
# Fix bug #3175784 that prevents compiling against FLTK 1.3.0
patch -p 1 < $CWD/ZynAddSubFX-2.4.1-fltk-1.3.0.diff
# Add support for Program Change and Bank Select messages
patch -p 1 < $CWD/ZynAddSubFX-2.4.1-program-change.diff
mkdir build && cd build
CFLAGS=$CPUOPT \
CXXFLAGS=$CPUOPT \
@ -109,9 +111,9 @@ cp -r ../banks ../examples $PKG/usr/share/zynaddsubfx/
# Install the documentation
mkdir -p $PKG/usr/doc
mv $PKG/usr/share/doc/zynaddsubfx $PKG/usr/doc/$NAME
mv $PKG/usr/share/doc/zynaddsubfx $PKG/usr/doc/$NAMEPKG-$VERSION
rmdir $PKG/usr/share/doc
cp -r ../doc $PKG/usr/doc/$NAME/docs
cp -r ../doc $PKG/usr/doc/$NAMEPKG-$VERSION/docs
# Install desktop files
install -D -m 644 $CWD/zynaddsubfx.png $PKG/usr/share/pixmaps/zynaddsubfx.png

Loading…
Cancel
Save