/usr/include/SndObj/SndMidi.h is in libsndobj-dev 2.6.6.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
////////////////////////////////////////////////////////////////////////
// This file is part of the SndObj library
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// 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 for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Copyright (c)Victor Lazzarini, 1997-2004
// See License.txt for a disclaimer of all warranties
// and licensing information
/***************************************************/
// SndMidi.h: interface of the SndMidi /
// (LINUX/CYGWIN/SGI)abstract class, MIDI IO /
// /
/***************************************************/
#ifndef _SNDMIDI_H
#define _SNDMIDI_H
#include "SndIO.h"
#if defined(OSS) || defined (SGI)
#include <stropts.h>
#include <poll.h>
#ifndef SGI
#include <unistd.h>
#endif
#ifndef OSS
#include <dmedia/midi.h>
#endif
#endif // OSS SGI
#ifdef WIN
#include <windows.h>
#include <mmsystem.h>
void MidiDeviceList();
char* MidiInputDeviceName(int dev, char* name);
#endif
enum { NOTE_MESSAGE = -1, PBEND_MESSAGE,
MOD_MESSAGE, BREATH_MESSAGE, FREE1, FOOT_MESSAGE,
PORT_MESSAGE, VOL_MESSAGE, BAL_MESSAGE,
FREE2, PAN_MESSAGE, EXPR_MESSAGE };
const int POLYAFTOUCH_MESSAGE = 129;
const int PROGRAM_MESSAGE = 130;
const int AFTOUCH_MESSAGE = 128;
const int VELOCITY_MESSAGE = 255;
const int NOTEOFF_MESSAGE = 256;
const int OUTOFRANGE = -128;
#ifdef OSS
typedef struct __mdevent{ // SGI's midi event struc, borrowed for compat
unsigned char msg[4]; // message bytes
char* sysexmsg; // system excl (currently not supported)
unsigned long long stamp; // time stamp (not used)
int msglen; // system excl msg length
} MDevent;
#endif
#ifdef WIN
typedef struct {
unsigned char msg[4];
} MIDI_event;
typedef union {
MIDI_event event;
DWORD dword;
} midi_msg;
#endif
class SndMidi : public SndIO {
protected:
short m_noteon;
short m_noteoff;
unsigned char *m_vel;
unsigned char *m_aft;
short* m_message;
unsigned char m_status;
unsigned char m_type;
unsigned char m_note;
int m_read;
int m_count;
int m_buffsize;
short m_chans; // channels in the range of 0-15
short m_msgflag; // flag to check for new messages
#if defined(OSS) || defined(SGI) // OSS& SGI MIDI
int m_fd;
#ifndef SGI
char* m_port; // midi device
#endif
#ifndef OSS
MDport m_port;
#endif
MDevent* m_event;
pollfd m_midifd;
#endif // OSS & SGI MIDI
#ifdef WIN // Windows MME MIDI
MIDI_event* m_event;
#endif // Windows MME MIDI
public:
short NoteOn();
short NoteOff();
char LastNote() { return m_note; }
char Velocity(char note){
return m_vel[note];}
char LastNoteVelocity(){ return m_vel[m_note];}
char Aftertouch(char note) {
return m_aft[note];
}
char LastNoteAftertouch(){ return m_aft[m_note];}
short GetMessage(short channel) { if(channel > 0 && channel <= 16)
return m_message[channel-1];
else return OUTOFRANGE;}
bool NewMessage(short channel){
channel--;
if((1<<channel) & m_msgflag){
m_msgflag = m_msgflag ^ (1<<channel);
return true;
}
else return false;
}
SndMidi(int buffsize, float sr=DEF_SR);
~SndMidi();
char* ErrorMessage();
};
#endif
|