home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Audio Version 4.94
/
audioversion4.94knowledgemediaresourcelibraryoctober1994.iso
/
amiga
/
midi
/
midilib.lzh
/
MIDILIB
/
BASIC
/
CHANGE
next >
Wrap
Text File
|
1991-08-16
|
980b
|
41 lines
'**** CHANGE - sends program changes via MIDI
'Assumes exec.bmap and midi.bmap in current directory
LIBRARY "exec.library"
LIBRARY "midi.library"
DECLARE FUNCTION AllocMem&() LIBRARY
memf.public& = 1
memf.clear& = 65536&
DECLARE FUNCTION CreateMSource&() LIBRARY
DECLARE FUNCTION MRouteSource&() LIBRARY
DestName$="MidiOut"+CHR$(0)
RouteInfo&=AllocMem&(14&,memf.public&+memf.clear&)
POKEW RouteInfo& ,-1
POKEW RouteInfo&+2,-1
Main:
INPUT "Program to change to? ",Program%
IF Program%<1 THEN CloseDown
buf$=CHR$(&HC0)+CHR$(Program%-1)
Source&=CreateMSource&(0&,0&)
IF Source&=0 THEN PRINT"Can't create Source":GOTO CloseDown
Route&=MRouteSource&(Source&,SADD(DestName$),RouteInfo&)
IF Route&=0 THEN PRINT"Can't create Route":GOTO CloseDown
CALL PutMidiMsg(Source&,SADD(buf$))
CloseDown:
IF Route&<>0 THEN CALL DeleteMRoute(Route&)
IF Source&<>0 THEN CALL DeleteMSource(Source&)
CALL FreeMem(RouteInfo&,14&)
LIBRARY CLOSE
PRINT"Program changed to preset # "Program%"!"