49 devicetype=KMID_EXTERNAL_MIDI;
53 if (map==NULL) { printfdebug(
"ERROR : midiOut : Map is NULL\n");
return; };
65#ifdef HAVE_OSS_SUPPORT
70 printfdebug(
"ERROR: Could not open /dev/sequencer\n");
88#ifdef HAVE_OSS_SUPPORT
91 uchar gm_reset[5]={0x7e, 0x7f, 0x09, 0x01, 0xf7};
92 sysex(gm_reset,
sizeof(gm_reset));
93 for (chn=0;chn<16;chn++)
121 SEQ_MIDIOUT(device, MIDI_NOTEON + map->channel(chn));
122 SEQ_MIDIOUT(device, map->key(chn,chnpatch[chn],note));
123 SEQ_MIDIOUT(device, vel);
126 printfdebug(
"Note ON >\t chn : %d\tnote : %d\tvel: %d\n",chn,note,vel);
132 SEQ_MIDIOUT(device, MIDI_NOTEOFF + map->channel(chn));
133 SEQ_MIDIOUT(device, map->key(chn,chnpatch[chn],note));
134 SEQ_MIDIOUT(device, vel);
136 printfdebug(
"Note OFF >\t chn : %d\tnote : %d\tvel: %d\n",chn,note,vel);
142 SEQ_MIDIOUT(device, MIDI_KEY_PRESSURE + map->channel(chn));
143 SEQ_MIDIOUT(device, map->key(chn,chnpatch[chn],note));
144 SEQ_MIDIOUT(device, vel);
150 printfdebug(
"PATCHCHANGE [%d->%d] %d -> %d\n",
151 chn,map->channel(chn),patch,map->patch(chn,patch));
153 SEQ_MIDIOUT(device, MIDI_PGM_CHANGE + map->channel(chn));
154 SEQ_MIDIOUT(device, map->patch(chn,patch));
160 SEQ_MIDIOUT(device, MIDI_CHN_PRESSURE + map->channel(chn));
161 SEQ_MIDIOUT(device, vel);
163 chnpressure[chn]=vel;
168 SEQ_MIDIOUT(device, MIDI_PITCH_BEND + map->channel(chn));
180 map->pitchBender(chn,lsb,msb);
181 SEQ_MIDIOUT(device, lsb);
182 SEQ_MIDIOUT(device, msb);
183 chnbender[chn]=(msb << 8) | (lsb & 0xFF);
188 SEQ_MIDIOUT(device, MIDI_CTL_CHANGE + map->channel(chn));
192 map->controller(chn,ctl,v);
193 if ((ctl==11)||(ctl==7))
195 v=(v*volumepercentage)/100;
199 SEQ_MIDIOUT(device, ctl);
200 SEQ_MIDIOUT(device, v);
202 chncontroller[chn][ctl]=v;
208 SEQ_MIDIOUT(device, MIDI_SYSTEM_PREFIX);
211 SEQ_MIDIOUT(device, *data);
216 printfdebug(
"sysex\n");
222 for (
int i=0; i<16; i++)
233 for ( i=0; i<127; i++)
254void MidiOut::seqbuf_dump (
void)
256#ifdef HAVE_OSS_SUPPORT
257 if (_seqbufptr && seqfd!=-1 && seqfd!=0)
258 if (write (seqfd, _seqbuf, _seqbufptr) == -1)
260 printfdebug(
"Error writing to /dev/sequencer in MidiOut::seq_buf_dump\n");
261 perror (
"write /dev/sequencer in seqBufDump\n");
268void MidiOut::seqbuf_clean(
void)
270#ifdef HAVE_OSS_SUPPORT
277 return (map!=NULL) ? map->filename() :
"";
284 case (KMID_EXTERNAL_MIDI) :
return "External Midi";
285 case (KMID_SYNTH) :
return "Synth";
286 case (KMID_FM) :
return "FM";
287 case (KMID_GUS) :
return "GUS";
288 case (KMID_AWE) :
return "AWE";
Sends MIDI events to a MIDI devices using ALSA.
A Midi Mapper class which defines the way MIDI events are translated (or "mapped") to different ones.
virtual void chnPitchBender(uchar chn, uchar lsb, uchar msb)
See DeviceManager::chnPitchBender().
const char * deviceName(void) const
Returns the name and type of this MIDI device.
void allNotesOff(void)
Send a All Notes Off event to every channel.
void sync(int i=0)
Sends the buffer to the device and returns when it's played, so you can synchronize XXX: sync should ...
virtual void noteOn(uchar chn, uchar note, uchar vel)
See DeviceManager::noteOn().
virtual ~MidiOut()
Destructor.
void setMidiMapper(MidiMapper *map)
Sets a MidiMapper object to be used to modify the midi events before sending them.
MidiOut(int d=0)
Constructor.
virtual void chnPatchChange(uchar chn, uchar patch)
See DeviceManager::chnPatchChange().
virtual void initDev()
Initializes the device sending generic standard midi events and controllers, such as changing the pat...
const char * midiMapFilename()
Returns the path to the file where the current used MidiMapper object reads the configuration from,...
virtual void openDev(int sqfd)
Opens the device.
virtual void closeDev()
Closes the device.
virtual void chnPressure(uchar chn, uchar vel)
See DeviceManager::chnPressure().
virtual void channelMute(uchar chn, int b)
Mute or "unmute" a given channel .
virtual void keyPressure(uchar chn, uchar note, uchar vel)
See DeviceManager::keyPressure().
virtual void noteOff(uchar chn, uchar note, uchar vel)
See DeviceManager::noteOff().
virtual void channelSilence(uchar chn)
Mutes all notes being played on a given channel.
int ok(void)
Returns true if everything's ok and false if there has been any problem.
virtual void chnController(uchar chn, uchar ctl, uchar v)
See DeviceManager::chnController().
virtual void sysex(uchar *data, ulong size)
See DeviceManager::sysex().