summaryrefslogtreecommitdiff
path: root/muse_qt4_evolution/synti/zynaddsubfx/Input
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2009-12-27 11:30:35 +0000
committerRobert Jonsson <spamatica@gmail.com>2009-12-27 11:30:35 +0000
commitb703eab295330e6f81564fbb39a10a1a2fdd2f54 (patch)
treee46b5c9a6bc22fd661c15d1d2123f5bf631cef80 /muse_qt4_evolution/synti/zynaddsubfx/Input
parent5d5fa0fdf913907edbc3d2d29a7548f0cb658c94 (diff)
moved old qt4 branch
Diffstat (limited to 'muse_qt4_evolution/synti/zynaddsubfx/Input')
-rw-r--r--muse_qt4_evolution/synti/zynaddsubfx/Input/ALSAMidiIn.C96
-rw-r--r--muse_qt4_evolution/synti/zynaddsubfx/Input/ALSAMidiIn.h42
-rw-r--r--muse_qt4_evolution/synti/zynaddsubfx/Input/MidiIn.C73
-rw-r--r--muse_qt4_evolution/synti/zynaddsubfx/Input/MidiIn.h42
-rw-r--r--muse_qt4_evolution/synti/zynaddsubfx/Input/NULLMidiIn.C43
-rw-r--r--muse_qt4_evolution/synti/zynaddsubfx/Input/NULLMidiIn.h40
-rw-r--r--muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C115
-rw-r--r--muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.h48
-rw-r--r--muse_qt4_evolution/synti/zynaddsubfx/Input/WINMidiIn.C83
-rw-r--r--muse_qt4_evolution/synti/zynaddsubfx/Input/WINMidiIn.h34
10 files changed, 616 insertions, 0 deletions
diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Input/ALSAMidiIn.C b/muse_qt4_evolution/synti/zynaddsubfx/Input/ALSAMidiIn.C
new file mode 100644
index 00000000..13aa14d1
--- /dev/null
+++ b/muse_qt4_evolution/synti/zynaddsubfx/Input/ALSAMidiIn.C
@@ -0,0 +1,96 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ ALSAMidiIn.C - Midi input for ALSA (this creates an ALSA virtual port)
+ Copyright (C) 2002-2005 Nasca Octavian Paul
+ Author: Nasca Octavian Paul
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#include "ALSAMidiIn.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+
+ALSAMidiIn::ALSAMidiIn(){
+ int alsaport;
+ inputok=0;
+ char portname[50];
+ sprintf(portname,"ZynAddSubFX");
+
+ midi_handle=NULL;
+
+ if (snd_seq_open(&midi_handle,"default",SND_SEQ_OPEN_INPUT,0)!=0) return;
+
+ snd_seq_set_client_name(midi_handle,"ZynAddSubFX");//thanks to Frank Neumann
+
+ alsaport = snd_seq_create_simple_port(midi_handle,portname
+ ,SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE
+ ,SND_SEQ_PORT_TYPE_SYNTH);
+ if (alsaport<0) return;
+
+ inputok=1;
+};
+
+ALSAMidiIn::~ALSAMidiIn(){
+ snd_seq_close(midi_handle);
+};
+
+
+/*
+ * Get the midi command,channel and parameters
+ */
+void ALSAMidiIn::getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,int *cmdparams){
+ snd_seq_event_t *midievent=NULL;
+ cmdtype=MidiNull;
+
+ if (inputok==0){
+ return;
+ };
+
+ snd_seq_event_input(midi_handle,&midievent);
+
+ if (midievent==NULL) return;
+ switch (midievent->type){
+ case SND_SEQ_EVENT_NOTEON:
+ cmdtype=MidiNoteON;
+ cmdchan=midievent->data.note.channel;
+ cmdparams[0]=midievent->data.note.note;
+ cmdparams[1]=midievent->data.note.velocity;
+ break;
+ case SND_SEQ_EVENT_NOTEOFF:
+ cmdtype=MidiNoteOFF;
+ cmdchan=midievent->data.note.channel;
+ cmdparams[0]=midievent->data.note.note;
+ break;
+ case SND_SEQ_EVENT_PITCHBEND:
+ cmdtype=MidiController;
+ cmdchan=midievent->data.control.channel;
+ cmdparams[0]=C_pitchwheel;//Pitch Bend
+ cmdparams[1]=midievent->data.control.value;
+ break;
+ case SND_SEQ_EVENT_CONTROLLER:
+ cmdtype=MidiController;
+ cmdchan=midievent->data.control.channel;
+ cmdparams[0]=getcontroller(midievent->data.control.param);
+ cmdparams[1]=midievent->data.control.value;
+ //fprintf(stderr,"t=%d val=%d\n",midievent->data.control.param,midievent->data.control.value);
+ break;
+
+ };
+};
+
+
diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Input/ALSAMidiIn.h b/muse_qt4_evolution/synti/zynaddsubfx/Input/ALSAMidiIn.h
new file mode 100644
index 00000000..dc4a0b0c
--- /dev/null
+++ b/muse_qt4_evolution/synti/zynaddsubfx/Input/ALSAMidiIn.h
@@ -0,0 +1,42 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ ALSAMidiIn.h - Midi input for ALSA (this creates an ALSA virtual port)
+ Copyright (C) 2002-2005 Nasca Octavian Paul
+ Author: Nasca Octavian Paul
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#ifndef ALSA_MIDI_IN_H
+#define ALSA_MIDI_IN_H
+
+#include <alsa/asoundlib.h>
+#include "MidiIn.h"
+
+
+class ALSAMidiIn:public MidiIn{
+ public:
+ ALSAMidiIn();
+ ~ALSAMidiIn();
+ void getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,int *cmdparams);
+
+ private:
+ snd_seq_t *midi_handle;
+};
+
+
+#endif
+
diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Input/MidiIn.C b/muse_qt4_evolution/synti/zynaddsubfx/Input/MidiIn.C
new file mode 100644
index 00000000..3063b793
--- /dev/null
+++ b/muse_qt4_evolution/synti/zynaddsubfx/Input/MidiIn.C
@@ -0,0 +1,73 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ MidiIn.C - This class is inherited by all the Midi input classes
+ Copyright (C) 2002-2005 Nasca Octavian Paul
+ Author: Nasca Octavian Paul
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#include "../globals.h"
+#include "MidiIn.h"
+
+int MidiIn::getcontroller(unsigned char b){
+ int ctl=C_NULL;
+ switch (b){
+ case 1:ctl=C_modwheel;//Modulation Wheel
+ break;
+ case 7:ctl=C_volume;//Volume
+ break;
+ case 10:ctl=C_panning;//Panning
+ break;
+ case 11:ctl=C_expression;//Expression
+ break;
+ case 64:ctl=C_sustain;//Sustain pedal
+ break;
+ case 65:ctl=C_portamento;//Portamento
+ break;
+ case 71:ctl=C_filterq;//Filter Q (Sound Timbre)
+ break;
+ case 74:ctl=C_filtercutoff;//Filter Cutoff (Brightness)
+ break;
+ case 75:ctl=C_bandwidth;//BandWidth
+ break;
+ case 76:ctl=C_fmamp;//FM amplitude
+ break;
+ case 77:ctl=C_resonance_center;//Resonance Center Frequency
+ break;
+ case 78:ctl=C_resonance_bandwidth;//Resonance Bandwith
+ break;
+ case 120:ctl=C_allsoundsoff;//All Sounds OFF
+ break;
+ case 121:ctl=C_resetallcontrollers;//Reset All Controllers
+ break;
+ case 123:ctl=C_allnotesoff;//All Notes OFF
+ break;
+ //RPN and NRPN
+ case 0x06:ctl=C_dataentryhi;//Data Entry (Coarse)
+ break;
+ case 0x26:ctl=C_dataentrylo;//Data Entry (Fine)
+ break;
+ case 99:ctl=C_nrpnhi;//NRPN (Coarse)
+ break;
+ case 98:ctl=C_nrpnlo;//NRPN (Fine)
+ break;
+ default:ctl=C_NULL;//unknown controller
+ //fprintf(stderr,"Controller=%d , par=%d\n",midievent->data.control.param,cmdparams[1]);
+ break;
+ };
+ return(ctl);
+};
diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Input/MidiIn.h b/muse_qt4_evolution/synti/zynaddsubfx/Input/MidiIn.h
new file mode 100644
index 00000000..8a8277d0
--- /dev/null
+++ b/muse_qt4_evolution/synti/zynaddsubfx/Input/MidiIn.h
@@ -0,0 +1,42 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ MidiIn.h - This class is inherited by all the Midi input classes
+ Copyright (C) 2002-2005 Nasca Octavian Paul
+ Author: Nasca Octavian Paul
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#ifndef MIDI_IN_H
+#define MIDI_IN_H
+
+#include "../globals.h"
+
+enum MidiCmdType{MidiNull,MidiNoteOFF,MidiNoteON,MidiController};
+#define MP_MAX_BYTES 4000 //in case of loooong SYS_EXes
+
+class MidiIn{
+ public:
+ virtual void getmidicmd(MidiCmdType &/*cmdtype*/,unsigned char &/*cmdchan*/,int */*cmdparams*/){};
+ virtual ~MidiIn(){};
+ int getcontroller(unsigned char b);
+ protected:
+ int inputok;//1 if I can read midi bytes from input ports
+};
+
+
+#endif
+
diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Input/NULLMidiIn.C b/muse_qt4_evolution/synti/zynaddsubfx/Input/NULLMidiIn.C
new file mode 100644
index 00000000..5c2b56d2
--- /dev/null
+++ b/muse_qt4_evolution/synti/zynaddsubfx/Input/NULLMidiIn.C
@@ -0,0 +1,43 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ NULLMidiIn.C - a dummy Midi port
+ Copyright (C) 2002-2005 Nasca Octavian Paul
+ Author: Nasca Octavian Paul
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#include "NULLMidiIn.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+NULLMidiIn::NULLMidiIn(){
+};
+
+NULLMidiIn::~NULLMidiIn(){
+};
+
+
+/*
+ * Get the midi command,channel and parameters
+ * It returns MidiNull because it is a dummy driver
+ */
+void NULLMidiIn::getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,unsigned char *cmdparams){
+ cmdtype=MidiNull;
+};
+
+
diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Input/NULLMidiIn.h b/muse_qt4_evolution/synti/zynaddsubfx/Input/NULLMidiIn.h
new file mode 100644
index 00000000..6f7b845e
--- /dev/null
+++ b/muse_qt4_evolution/synti/zynaddsubfx/Input/NULLMidiIn.h
@@ -0,0 +1,40 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ NULLMidiIn.h - a dummy Midi port
+ Copyright (C) 2002-2005 Nasca Octavian Paul
+ Author: Nasca Octavian Paul
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#ifndef NULL_MIDI_IN_H
+#define NULL_MIDI_IN_H
+
+#include "MidiIn.h"
+
+
+class NULLMidiIn:public MidiIn{
+ public:
+ NULLMidiIn();
+ ~NULLMidiIn();
+ void getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,unsigned char *cmdparams);
+
+ private:
+};
+
+
+#endif
+
diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C b/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C
new file mode 100644
index 00000000..5a6ae509
--- /dev/null
+++ b/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C
@@ -0,0 +1,115 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ OSSMidiIn.C - Midi input for Open Sound System
+ Copyright (C) 2002-2005 Nasca Octavian Paul
+ Author: Nasca Octavian Paul
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/soundcard.h>
+
+#include "OSSMidiIn.h"
+#include "../Misc/Util.h"
+
+OSSMidiIn::OSSMidiIn(){
+ inputok=0;
+ midi_handle=open(config.cfg.LinuxOSSSeqInDev,O_RDONLY,0);
+ if (midi_handle!=-1) inputok=1;
+
+ lastmidicmd=0;
+ cmdtype=0;
+ cmdchan=0;
+
+};
+
+OSSMidiIn::~OSSMidiIn(){
+ close(midi_handle);
+};
+
+unsigned char OSSMidiIn::readbyte(){
+ unsigned char tmp[4];
+ read(midi_handle,&tmp[0],1);
+ while (tmp[0]!=SEQ_MIDIPUTC){
+ read(midi_handle,&tmp[0],4);
+ };
+ return(tmp[1]);
+};
+
+unsigned char OSSMidiIn::getmidibyte(){
+ unsigned char b;
+ do {
+ b=readbyte();
+ } while (b==0xfe);//drops the Active Sense Messages
+ return(b);
+};
+
+/*
+ * Get the midi command,channel and parameters
+ */
+void OSSMidiIn::getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,int *cmdparams){
+ unsigned char tmp,i;
+ if (inputok==0) {
+ cmdtype=MidiNull;
+ return;
+ };
+ i=0;
+ if (lastmidicmd==0){//asteapta prima data pana cand vine prima comanda midi
+ while (tmp<0x80) tmp=getmidibyte();
+ lastmidicmd=tmp;
+ };
+
+ tmp=getmidibyte();
+
+ if (tmp>=0x80) {
+ lastmidicmd=tmp;
+ tmp=getmidibyte();
+ };
+
+ if ((lastmidicmd>=0x80)&&(lastmidicmd<=0x8f)){//Note OFF
+ cmdtype=MidiNoteOFF;
+ cmdchan=lastmidicmd%16;
+ cmdparams[0]=tmp;//note number
+ };
+
+ if ((lastmidicmd>=0x90)&&(lastmidicmd<=0x9f)){//Note ON
+ cmdtype=MidiNoteON;
+ cmdchan=lastmidicmd%16;
+ cmdparams[0]=tmp;//note number
+ cmdparams[1]=getmidibyte();//velocity
+ if (cmdparams[1]==0) cmdtype=MidiNoteOFF;//if velocity==0 then is note off
+ };
+ if ((lastmidicmd>=0xB0)&&(lastmidicmd<=0xBF)){//Controllers
+ cmdtype=MidiController;
+ cmdchan=lastmidicmd%16;
+ cmdparams[0]=getcontroller(tmp);
+ cmdparams[1]=getmidibyte();
+ };
+ if ((lastmidicmd>=0xE0)&&(lastmidicmd<=0xEF)){//Pitch Wheel
+ cmdtype=MidiController;
+ cmdchan=lastmidicmd%16;
+ cmdparams[0]=C_pitchwheel;
+ cmdparams[1]=(tmp+getmidibyte()*(int) 128)-8192;//hope this is correct
+ };
+};
+
+
diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.h b/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.h
new file mode 100644
index 00000000..302a812e
--- /dev/null
+++ b/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.h
@@ -0,0 +1,48 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ OSSMidiIn.h - Midi input for Open Sound System
+ Copyright (C) 2002-2005 Nasca Octavian Paul
+ Author: Nasca Octavian Paul
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#ifndef OSS_MIDI_IN_H
+#define OSS_MIDI_IN_H
+
+#include "MidiIn.h"
+
+class OSSMidiIn:public MidiIn{
+ public:
+ OSSMidiIn();
+ ~OSSMidiIn();
+ unsigned char getmidibyte();
+ unsigned char readbyte();
+
+ //Midi parser
+ void getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,int *cmdparams);
+ unsigned char cmdtype;//the Message Type (noteon,noteof,sysex..)
+ unsigned char cmdchan;//the channel number
+
+ private:
+ int midi_handle;
+ unsigned char lastmidicmd;//last byte (>=80) received from the Midi
+
+};
+
+
+#endif
+
diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Input/WINMidiIn.C b/muse_qt4_evolution/synti/zynaddsubfx/Input/WINMidiIn.C
new file mode 100644
index 00000000..c20841bb
--- /dev/null
+++ b/muse_qt4_evolution/synti/zynaddsubfx/Input/WINMidiIn.C
@@ -0,0 +1,83 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ WINMidiIn.C - Midi input for Windows
+ Copyright (C) 2002-2005 Nasca Octavian Paul
+ Author: Nasca Octavian Paul
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <windows.h>
+#include <mmsystem.h>
+#include <pthread.h>
+
+#include "WINMidiIn.h"
+#include "MidiIn.h"
+#include "../Misc/Util.h"
+
+Master *winmaster;
+HMIDIIN winmidiinhandle;
+MidiIn midictl;//used to convert the controllers to ZynAddSubFX controllers
+
+void CALLBACK WinMidiInProc(HMIDIIN hMidiIn,UINT wMsg,DWORD dwInstance,
+ DWORD dwParam1,DWORD dwParam2){
+ int midicommand=MidiNull;
+ if (wMsg==MIM_DATA){
+ int cmd,par1,par2;
+ cmd=dwParam1&0xff;
+ if (cmd==0xfe) return;
+ par1=(dwParam1>>8)&0xff;
+ par2=dwParam1>>16;
+ //printf("%x %x %x\n",cmd,par1,par2);fflush(stdout);
+ int cmdchan=cmd&0x0f;
+ int cmdtype=(cmd>>4)&0x0f;
+
+ int tmp=0;
+ pthread_mutex_lock(&winmaster->mutex);
+ switch(cmdtype){
+ case(0x8)://noteon
+ winmaster->NoteOff(cmdchan,par1);
+ break;
+ case(0x9)://noteoff
+ winmaster->NoteOn(cmdchan,par1,par2&0xff);
+ break;
+ case(0xb)://controller
+ winmaster->SetController(cmdchan,midictl.getcontroller(par1),par2&0xff);
+ break;
+ case(0xe)://pitch wheel
+ tmp=(par1+par2*(long int) 128)-8192;
+ winmaster->SetController(cmdchan,C_pitchwheel,tmp);
+ break;
+ default:break;
+ };
+ pthread_mutex_unlock(&winmaster->mutex);
+
+ };
+};
+
+void InitWinMidi(Master *master_){
+ winmaster=master_;
+
+ long int result=midiInOpen(&winmidiinhandle,config.cfg.WindowsMidiInId,(DWORD)WinMidiInProc,0,CALLBACK_FUNCTION);
+ result=midiInStart(winmidiinhandle);
+};
+
+void StopWinMidi(){
+ midiInStop(winmidiinhandle);
+ midiInClose(winmidiinhandle);
+};
diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Input/WINMidiIn.h b/muse_qt4_evolution/synti/zynaddsubfx/Input/WINMidiIn.h
new file mode 100644
index 00000000..95c3791d
--- /dev/null
+++ b/muse_qt4_evolution/synti/zynaddsubfx/Input/WINMidiIn.h
@@ -0,0 +1,34 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ WINMidiIn.h - Midi input for Windows
+ Copyright (C) 2002-2005 Nasca Octavian Paul
+ Author: Nasca Octavian Paul
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#ifndef WIN_MIDI_IN_H
+#define WIN_MIDI_IN_H
+
+
+#include "../Misc/Master.h"
+
+void InitWinMidi(Master *master_);
+void StopWinMidi();
+
+
+#endif
+