Csound Csound-dev Csound-tekno Search About

Re: API MIDI functions

Date2007-08-01 20:10
FromVictor Lazzarini
SubjectRe: API MIDI functions
yes, I think -+rtmidi=NULL -M0. Rory Walsh used
this in something he was doing last month, perhaps he
can tell us more.

By the way, can we move these discussions to the
Csound-devel list? I am a little bit conscious of
users being turned off this list with all this
code-talk.

Victor

>
>
> I'm interested in passing MIDI events via the API
>
> I assume I use the following callbacks to do this.
>
>      csoundSetExternalMidiInOpenCallback(instance->csound,
> midiInOpen);
>      csoundSetExternalMidiReadCallback(instance->csound,
> midiInRead);
>      csoundSetExternalMidiInCloseCallback(instance->csound
> ,   midiInClose);
>
>
> int midiInOpen(CSOUND *csound, void **userData, const char
> *devName) {
>      printf("midiInOpen\n");
>
>      return 0;
> }
>
> int midiInRead(CSOUND *csound, void *userData,
>                        unsigned char *buf, int nBytes) {
>      printf("midiInRead\n");
>
>      return 0;
> }
>
> int midiInClose(CSOUND *csound, void *userData) {
>      printf("midiInClose\n");
>
>      return 0;
> }
>
>
> I've snooped around and found the pmidi.c file which
> provides a   reasonable example of how to use them.
>
> What I'm wondering is how do I get the API to use my
> callback   functions.  So far I can't get any of those
> functions to be called by   Csound.
>
> I thought it was controlled by the command line ... but
> I'm not sure   exactly how it should be done:
> -+rtmidi=null -M0
> ??
>
>
> Any guidance here would be appreciated.
>
> thanks
> greg
>

Date2007-08-01 23:04
FromGreg Thompson
SubjectRe: API MIDI functions
Ya - it does seem to work (so far).  The way I was passing arguments  
through the API was the problem.  Each argument must be a separate  
index in the argv array .. should have known I couldn't combine  
them .. anyway - sure, sorry about posting this in the main list ..  
I'll post the API questions on the dev list.

thanks
greg

On Aug 1, 2007, at 3:10 PM, Victor Lazzarini wrote:

> yes, I think -+rtmidi=NULL -M0. Rory Walsh used
> this in something he was doing last month, perhaps he
> can tell us more.
>
> By the way, can we move these discussions to the
> Csound-devel list? I am a little bit conscious of
> users being turned off this list with all this
> code-talk.
>
> Victor
>
>>
>>
>> I'm interested in passing MIDI events via the API
>>
>> I assume I use the following callbacks to do this.
>>
>>      csoundSetExternalMidiInOpenCallback(instance->csound,
>> midiInOpen);
>>      csoundSetExternalMidiReadCallback(instance->csound,
>> midiInRead);
>>      csoundSetExternalMidiInCloseCallback(instance->csound
>> ,   midiInClose);
>>
>>
>> int midiInOpen(CSOUND *csound, void **userData, const char
>> *devName) {
>>      printf("midiInOpen\n");
>>
>>      return 0;
>> }
>>
>> int midiInRead(CSOUND *csound, void *userData,
>>                        unsigned char *buf, int nBytes) {
>>      printf("midiInRead\n");
>>
>>      return 0;
>> }
>>
>> int midiInClose(CSOUND *csound, void *userData) {
>>      printf("midiInClose\n");
>>
>>      return 0;
>> }
>>
>>
>> I've snooped around and found the pmidi.c file which
>> provides a   reasonable example of how to use them.
>>
>> What I'm wondering is how do I get the API to use my
>> callback   functions.  So far I can't get any of those
>> functions to be called by   Csound.
>>
>> I thought it was controlled by the command line ... but
>> I'm not sure   exactly how it should be done:
>> -+rtmidi=null -M0
>> ??
>>
>>
>> Any guidance here would be appreciated.
>>
>> thanks
>> greg
>>
> -- 
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>

Date2007-08-02 11:53
FromRory Walsh
SubjectRe: [Cs-dev] [Csnd] API MIDI functions
Hi Greg. So you did get it working in the end? I was trying to do this 
some weeks ago as Victor mentioned and I found the best source files to 
look through were Steven fltk keyboard sources and Mike CsoundVST 
sources. They both provide good examples of how to pass MIDI from a host 
to an instance of Csound. Good luck.

Rory.


Greg Thompson wrote:
> Ya - it does seem to work (so far).  The way I was passing arguments 
> through the API was the problem.  Each argument must be a separate index 
> in the argv array .. should have known I couldn't combine them .. anyway 
> - sure, sorry about posting this in the main list .. I'll post the API 
> questions on the dev list.
> 
> thanks
> greg
> 
> On Aug 1, 2007, at 3:10 PM, Victor Lazzarini wrote:
> 
>> yes, I think -+rtmidi=NULL -M0. Rory Walsh used
>> this in something he was doing last month, perhaps he
>> can tell us more.
>>
>> By the way, can we move these discussions to the
>> Csound-devel list? I am a little bit conscious of
>> users being turned off this list with all this
>> code-talk.
>>
>> Victor
>>
>>>
>>>
>>> I'm interested in passing MIDI events via the API
>>>
>>> I assume I use the following callbacks to do this.
>>>
>>>      csoundSetExternalMidiInOpenCallback(instance->csound,
>>> midiInOpen);
>>>      csoundSetExternalMidiReadCallback(instance->csound,
>>> midiInRead);
>>>      csoundSetExternalMidiInCloseCallback(instance->csound
>>> ,   midiInClose);
>>>
>>>
>>> int midiInOpen(CSOUND *csound, void **userData, const char
>>> *devName) {
>>>      printf("midiInOpen\n");
>>>
>>>      return 0;
>>> }
>>>
>>> int midiInRead(CSOUND *csound, void *userData,
>>>                        unsigned char *buf, int nBytes) {
>>>      printf("midiInRead\n");
>>>
>>>      return 0;
>>> }
>>>
>>> int midiInClose(CSOUND *csound, void *userData) {
>>>      printf("midiInClose\n");
>>>
>>>      return 0;
>>> }
>>>
>>>
>>> I've snooped around and found the pmidi.c file which
>>> provides a   reasonable example of how to use them.
>>>
>>> What I'm wondering is how do I get the API to use my
>>> callback   functions.  So far I can't get any of those
>>> functions to be called by   Csound.
>>>
>>> I thought it was controlled by the command line ... but
>>> I'm not sure   exactly how it should be done:
>>> -+rtmidi=null -M0
>>> ??
>>>
>>>
>>> Any guidance here would be appreciated.
>>>
>>> thanks
>>> greg
>>>
>> --Send bugs reports to this list.
>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>
> 
> --Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2007-08-02 13:51
FromGreg Thompson
SubjectRe: [Cs-dev] API MIDI functions
Yes.  It is working quite well so far.  Very easy to use.  As I've  
said before, the API overall is quite well thought out and easy  
enough to use.  It might, however, benefit from further documentation  
to handle the special cases like this one where the API alone is not  
enough to get the answer.

My problem was with the command line arguments.  Perhaps there should  
be API calls to set every command line argument.  This way, one would  
not need to use the command line arguments at all if they're not  
running from the command line.  Just a thought.

greg

On Aug 2, 2007, at 6:53 AM, Rory Walsh wrote:

> Hi Greg. So you did get it working in the end? I was trying to do this
> some weeks ago as Victor mentioned and I found the best source  
> files to
> look through were Steven fltk keyboard sources and Mike CsoundVST
> sources. They both provide good examples of how to pass MIDI from a  
> host
> to an instance of Csound. Good luck.
>
> Rory.
>
>
> Greg Thompson wrote:
>> Ya - it does seem to work (so far).  The way I was passing arguments
>> through the API was the problem.  Each argument must be a separate  
>> index
>> in the argv array .. should have known I couldn't combine them ..  
>> anyway
>> - sure, sorry about posting this in the main list .. I'll post the  
>> API
>> questions on the dev list.
>>
>> thanks
>> greg
>>
>> On Aug 1, 2007, at 3:10 PM, Victor Lazzarini wrote:
>>
>>> yes, I think -+rtmidi=NULL -M0. Rory Walsh used
>>> this in something he was doing last month, perhaps he
>>> can tell us more.
>>>
>>> By the way, can we move these discussions to the
>>> Csound-devel list? I am a little bit conscious of
>>> users being turned off this list with all this
>>> code-talk.
>>>
>>> Victor
>>>
>>>>
>>>>
>>>> I'm interested in passing MIDI events via the API
>>>>
>>>> I assume I use the following callbacks to do this.
>>>>
>>>>      csoundSetExternalMidiInOpenCallback(instance->csound,
>>>> midiInOpen);
>>>>      csoundSetExternalMidiReadCallback(instance->csound,
>>>> midiInRead);
>>>>      csoundSetExternalMidiInCloseCallback(instance->csound
>>>> ,   midiInClose);
>>>>
>>>>
>>>> int midiInOpen(CSOUND *csound, void **userData, const char
>>>> *devName) {
>>>>      printf("midiInOpen\n");
>>>>
>>>>      return 0;
>>>> }
>>>>
>>>> int midiInRead(CSOUND *csound, void *userData,
>>>>                        unsigned char *buf, int nBytes) {
>>>>      printf("midiInRead\n");
>>>>
>>>>      return 0;
>>>> }
>>>>
>>>> int midiInClose(CSOUND *csound, void *userData) {
>>>>      printf("midiInClose\n");
>>>>
>>>>      return 0;
>>>> }
>>>>
>>>>
>>>> I've snooped around and found the pmidi.c file which
>>>> provides a   reasonable example of how to use them.
>>>>
>>>> What I'm wondering is how do I get the API to use my
>>>> callback   functions.  So far I can't get any of those
>>>> functions to be called by   Csound.
>>>>
>>>> I thought it was controlled by the command line ... but
>>>> I'm not sure   exactly how it should be done:
>>>> -+rtmidi=null -M0
>>>> ??
>>>>
>>>>
>>>> Any guidance here would be appreciated.
>>>>
>>>> thanks
>>>> greg
>>>>
>>> --Send bugs reports to this list.
>>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>>
>>
>> --Send bugs reports to this list.
>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>
>
> ---------------------------------------------------------------------- 
> ---
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a  
> browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2007-08-03 14:04
FromGreg Thompson
Subject[Cs-dev] MIDI file - done performance
Is there a way to be notified in the API when a MIDI file has finished performing?  I'm using csoundPerformBuffer to perform and it usually returns non-zero if it's finished, but I don't think it does with a MIDI file performance.

I see that it prints "end of midi track" 

thanks
greg