Browse Source

Tidied up MIDI code a bit

master
edgeeffect 21 years ago
parent
commit
08cbc9dacb
2 changed files with 13 additions and 7 deletions
  1. +12
    -6
      SpiralSound/Midi.C
  2. +1
    -1
      SpiralSound/Midi.h

+ 12
- 6
SpiralSound/Midi.C View File

@@ -162,23 +162,29 @@ void MidiDevice::SendEvent(int Device,const MidiEvent &Event)
snd_seq_ev_set_direct (&ev);
snd_seq_ev_set_subs (&ev);
snd_seq_ev_set_source (&ev, 0);
switch (Event.GetType())
{
case MidiEvent::ON : ev.type = SND_SEQ_EVENT_NOTEON;
case MidiEvent::OFF : ev.type = SND_SEQ_EVENT_NOTEOFF;
case MidiEvent::ON:
ev.type = SND_SEQ_EVENT_NOTEON;
break;
case MidiEvent::OFF:
ev.type = SND_SEQ_EVENT_NOTEOFF;
break;
default:
break;
}
ev.data.note.velocity = (char)Event.GetVolume()*127;
ev.data.control.channel = Device;
ev.data.note.note=Event.GetNote();
int ret=snd_seq_event_output(seq_handle, &ev);
snd_seq_drain_output(seq_handle);
#else
if (Device<0 || Device>15)
{
cerr<<"SendEvent: Invalid Midi device "<<Device<<endl;
cerr<<"SendEvent: Invalid Midi device "<<Device<<endl;
}

char message[3];


+ 1
- 1
SpiralSound/Midi.h View File

@@ -14,7 +14,7 @@
* 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.
*/
*/

#include <sys/types.h>
#include <stdio.h>


Loading…
Cancel
Save