summaryrefslogtreecommitdiff
path: root/attic/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-09-15 12:14:55 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-09-15 12:14:55 +0000
commitb0546e5e7f7044019892543c6c82029db8d564a7 (patch)
tree1b96a6260900f3fbf3513fb48a5a72aa89052dc8 /attic/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C
parent583c73d1a07154d3d2672d65d8cce6495f490454 (diff)
moved attic to a branch of it's own
Diffstat (limited to 'attic/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C')
-rw-r--r--attic/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C115
1 files changed, 0 insertions, 115 deletions
diff --git a/attic/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C b/attic/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C
deleted file mode 100644
index 5a6ae509..00000000
--- a/attic/muse_qt4_evolution/synti/zynaddsubfx/Input/OSSMidiIn.C
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- 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
- };
-};
-
-