Csound Csound-dev Csound-tekno Search About

[Cs-dev] how do I enable MIDI input without using "-M" flag?

Date2006-02-06 09:16
FromDavis Pyon
Subject[Cs-dev] how do I enable MIDI input without using "-M" flag?
Hi,

I have a question regarding the function csoundSetExternalMidiReadCallback().  I am developing
a MaxMSP external similar to Matt Ingalls' csound~.  I'm trying to figure out a way to enable MIDI
input so that my callback function gets called whenever Csound wants to "sense" MIDI events.
The only way I can get my callback function to be called is if I add "-M0" or something similar
to the arguments list, then call csoundCompile(), then csoundSetExternalMidiReadCallback().
I would rather not have Csound try to open some MIDI device just so I can pass MIDI data
to Csound.

Is there a way to enable MIDI input without passing the "-M" flag to csoundCompile()?  Sorry if
this question has already been answered.  BTW, I'm using the Csound5 library framework on 
Mac OS 10.4.4 with Xcode 2.2.

Thanks,

Davis





-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-02-06 10:05
FromVictor Lazzarini
SubjectRe: [Cs-dev] how do I enable MIDI input without using "-M" flag?
Did you try setting the call back before csoundCompile() ? In any event,
it is probably more suitable to set all callbacks before compilation (although
in some cases it might not matter).

Looking at argdecode.c in the sources, indeed looks like you need  -M 
device_num for
midi input to be enabled. However, if you create a callback for opening 
MIDI input,
then this will be called instead of the one in portmidi (the MIDI module),
so no external devices will be open (unless you write the code for it
in your callback). Your callback then can be just a dummy; if you then
start csound with -M0 (or whatever number), you'll get realtime MIDI
enabled.

On another matter, also you can use csoundSetHostImplementedAudioIO() so 
that your input/output
is handled by your MSP class and Csound does not try to open the audio
device.

Good luck with your work, it's great to see people starting to use the API.

Victor

At 09:16 06/02/2006, you wrote:
>Hi,
>
>I have a question regarding the function 
>csoundSetExternalMidiReadCallback().  I am developing
>a MaxMSP external similar to Matt Ingalls' csound~.  I'm trying to figure 
>out a way to enable MIDI
>input so that my callback function gets called whenever Csound wants to 
>"sense" MIDI events.
>The only way I can get my callback function to be called is if I add "-M0" 
>or something similar
>to the arguments list, then call csoundCompile(), then 
>csoundSetExternalMidiReadCallback().
>I would rather not have Csound try to open some MIDI device just so I can 
>pass MIDI data
>to Csound.
>
>Is there a way to enable MIDI input without passing the "-M" flag to 
>csoundCompile()?  Sorry if
>this question has already been answered.  BTW, I'm using the Csound5 
>library framework on
>Mac OS 10.4.4 with Xcode 2.2.
>
>Thanks,
>
>Davis
>
>
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>for problems?  Stop!  Download the new AJAX search engine that makes
>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-02-06 10:37
FromIstvan Varga
SubjectRe: [Cs-dev] how do I enable MIDI input without using "-M" flag?
AttachmentsNone  

Date2006-02-07 11:16
FromDavis Pyon
SubjectRe: [Cs-dev] how do I enable MIDI input without using "-M" flag?
Thanks for the replies.  I am now able to get Csound to call my MidiReadCallback
function without ever "opening" any midi devices.  I added "-M0" and "-+rtmidi=null" to the
list of arguments.  I put:

csoundSetExternalMidiInOpenCallback()
csoundSetExternalMidiInCloseCallback()
csoundSetExternalMidiReadCallback()

between csoundPreCompile() and csoundCompile().  Of course the MidiInOpen/Close
functions don't do anything except return 0 for success.

Thanks guys,

Davis



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net