Csound Csound-dev Csound-tekno Search About

[Cs-dev] question about MIDI and the Csound API...

Date2010-03-29 14:50
FromRory Walsh
Subject[Cs-dev] question about MIDI and the Csound API...
I have a host that routes midi to Csound using
Csound::SetExternalMidiInOpenCallback() and
Csound::SetExternalMidiReadCallback(). Everything works fine and using
the following CsOptions command I can use my keyboard to play Csound
instruments:

-+rtmidi=null -M0 --midi-key-cps=4 --midi-velocity-amp=5

Controllers on the other hand are proving more difficult. For some
reason they just don't seem to get picked up. I'm wondering if it has
something to do with the -+rtmidi being set to null? Here's an excerpt
from my midiread callback function:

	   if(message.isNoteOn()){
		*mbuf++ = (unsigned char)0x90 + message.getChannel();
	   *mbuf++ = (unsigned char)message.getNoteNumber();
	   *mbuf++ = (unsigned char)message.getVelocity();
	    cnt += 3;
	   }
	   else if(message.isNoteOff()){
		*mbuf++ = (unsigned char)0x80 + message.getChannel();
	   *mbuf++ = (unsigned char)message.getNoteNumber();
	   *mbuf++ = (unsigned char)message.getVelocity();
	    cnt += 3;
	   }
	   else if(message.isController()){
		*mbuf++ = (unsigned char)0xB0 + message.getChannel();
		*mbuf++ = (unsigned char)message.getControllerNumber();
		*mbuf++ = (unsigned char)message.getControllerValue();
		cnt += 3;
	   }
	   else if(message.isAllNotesOff()){
		*mbuf++ = (unsigned char)0x7B + message.getChannel();
	   *mbuf++ = (unsigned char)message.getNoteNumber();
	   *mbuf++ = (unsigned char)message.getVelocity();
	    cnt += 3;
	   }

The third if statement is filling the midi buffer with controller
data. I know the data is valid as I've printed to the stdout and it is
just as expected. So too are the channel and controller numbers. Can
anyone give me any ideas as to why Csound doesn't read these values?
With rtmidi set to NULL does Csound ignore controller messages? I've
tried looking through the Csound code and will continue to do so but
it's a minefield..

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-03-29 15:03
FromVictor Lazzarini
SubjectRe: [Cs-dev] question about MIDI and the Csound API...
The -+rtmidi=null is designed to stop csound loading a midi module (ie  
pmidi). What opcodes are you using to try and
pick up midi? You should use ctrl7 etc instead of midictrl7 etc.

Victor

On 29 Mar 2010, at 14:50, Rory Walsh wrote:

> I have a host that routes midi to Csound using
> Csound::SetExternalMidiInOpenCallback() and
> Csound::SetExternalMidiReadCallback(). Everything works fine and using
> the following CsOptions command I can use my keyboard to play Csound
> instruments:
>
> -+rtmidi=null -M0 --midi-key-cps=4 --midi-velocity-amp=5
>
> Controllers on the other hand are proving more difficult. For some
> reason they just don't seem to get picked up. I'm wondering if it has
> something to do with the -+rtmidi being set to null? Here's an excerpt
> from my midiread callback function:
>
> 	   if(message.isNoteOn()){
> 		*mbuf++ = (unsigned char)0x90 + message.getChannel();
> 	   *mbuf++ = (unsigned char)message.getNoteNumber();
> 	   *mbuf++ = (unsigned char)message.getVelocity();
> 	    cnt += 3;
> 	   }
> 	   else if(message.isNoteOff()){
> 		*mbuf++ = (unsigned char)0x80 + message.getChannel();
> 	   *mbuf++ = (unsigned char)message.getNoteNumber();
> 	   *mbuf++ = (unsigned char)message.getVelocity();
> 	    cnt += 3;
> 	   }
> 	   else if(message.isController()){
> 		*mbuf++ = (unsigned char)0xB0 + message.getChannel();
> 		*mbuf++ = (unsigned char)message.getControllerNumber();
> 		*mbuf++ = (unsigned char)message.getControllerValue();
> 		cnt += 3;
> 	   }
> 	   else if(message.isAllNotesOff()){
> 		*mbuf++ = (unsigned char)0x7B + message.getChannel();
> 	   *mbuf++ = (unsigned char)message.getNoteNumber();
> 	   *mbuf++ = (unsigned char)message.getVelocity();
> 	    cnt += 3;
> 	   }
>
> The third if statement is filling the midi buffer with controller
> data. I know the data is valid as I've printed to the stdout and it is
> just as expected. So too are the channel and controller numbers. Can
> anyone give me any ideas as to why Csound doesn't read these values?
> With rtmidi set to NULL does Csound ignore controller messages? I've
> tried looking through the Csound code and will continue to do so but
> it's a minefield..
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-03-29 15:26
FromRory Walsh
SubjectRe: [Cs-dev] question about MIDI and the Csound API...
I was trying ctrl7 and I don't want Csound to open any midi module as
my host is doing that already. My instrument is pasted below. It seems
that even though I am not using the interop flags and I don't have any
instrument statements each midi keyboard press is still triggering
instrument 2 for some reason, but not instrument one or two. If I use
an i1 0 30 statement the value of k1 doesn't changed even though I'm
moving my keyboard slider. I've check with various other software and
the keyboard slider is definitely controller number seven on channel
1. Any further thoughts?



-d -n -+rtmidi=null -M0 -m0d


; Initialize the global variables.
sr = 44100
ksmps = 32
nchnls = 2


instr 1
k1 ctrl7 1, 7, 0, 100
printk2 k1
endin

instr 2
k1 ctrl7 1, 7, 0, 100
printk2 k1
a1 oscil 10000, 440, 1
outs a1*0, a1
endin

instr 3
a1 oscil 10000, 441, 1
outs a1, a1
endin



f1 0 4096 10 1
e 30






On 29 March 2010 15:03, Victor Lazzarini  wrote:
> The -+rtmidi=null is designed to stop csound loading a midi module (ie
> pmidi). What opcodes are you using to try and
> pick up midi? You should use ctrl7 etc instead of midictrl7 etc.
>
> Victor
>
> On 29 Mar 2010, at 14:50, Rory Walsh wrote:
>
>> I have a host that routes midi to Csound using
>> Csound::SetExternalMidiInOpenCallback() and
>> Csound::SetExternalMidiReadCallback(). Everything works fine and using
>> the following CsOptions command I can use my keyboard to play Csound
>> instruments:
>>
>> -+rtmidi=null -M0 --midi-key-cps=4 --midi-velocity-amp=5
>>
>> Controllers on the other hand are proving more difficult. For some
>> reason they just don't seem to get picked up. I'm wondering if it has
>> something to do with the -+rtmidi being set to null? Here's an excerpt
>> from my midiread callback function:
>>
>>          if(message.isNoteOn()){
>>               *mbuf++ = (unsigned char)0x90 + message.getChannel();
>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>          *mbuf++ = (unsigned char)message.getVelocity();
>>           cnt += 3;
>>          }
>>          else if(message.isNoteOff()){
>>               *mbuf++ = (unsigned char)0x80 + message.getChannel();
>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>          *mbuf++ = (unsigned char)message.getVelocity();
>>           cnt += 3;
>>          }
>>          else if(message.isController()){
>>               *mbuf++ = (unsigned char)0xB0 + message.getChannel();
>>               *mbuf++ = (unsigned char)message.getControllerNumber();
>>               *mbuf++ = (unsigned char)message.getControllerValue();
>>               cnt += 3;
>>          }
>>          else if(message.isAllNotesOff()){
>>               *mbuf++ = (unsigned char)0x7B + message.getChannel();
>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>          *mbuf++ = (unsigned char)message.getVelocity();
>>           cnt += 3;
>>          }
>>
>> The third if statement is filling the midi buffer with controller
>> data. I know the data is valid as I've printed to the stdout and it is
>> just as expected. So too are the channel and controller numbers. Can
>> anyone give me any ideas as to why Csound doesn't read these values?
>> With rtmidi set to NULL does Csound ignore controller messages? I've
>> tried looking through the Csound code and will continue to do so but
>> it's a minefield..
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-03-29 15:29
FromMichael Gogins
SubjectRe: [Cs-dev] question about MIDI and the Csound API...
Well, with the MIDI interop and a null driver you probably need f 0
360 or something.

Hope this helps,
Mike

On Mon, Mar 29, 2010 at 10:26 AM, Rory Walsh  wrote:
> I was trying ctrl7 and I don't want Csound to open any midi module as
> my host is doing that already. My instrument is pasted below. It seems
> that even though I am not using the interop flags and I don't have any
> instrument statements each midi keyboard press is still triggering
> instrument 2 for some reason, but not instrument one or two. If I use
> an i1 0 30 statement the value of k1 doesn't changed even though I'm
> moving my keyboard slider. I've check with various other software and
> the keyboard slider is definitely controller number seven on channel
> 1. Any further thoughts?
>
> 
> 
> -d -n -+rtmidi=null -M0 -m0d
> 
> 
> ; Initialize the global variables.
> sr = 44100
> ksmps = 32
> nchnls = 2
>
>
> instr 1
> k1 ctrl7 1, 7, 0, 100
> printk2 k1
> endin
>
> instr 2
> k1 ctrl7 1, 7, 0, 100
> printk2 k1
> a1 oscil 10000, 440, 1
> outs a1*0, a1
> endin
>
> instr 3
> a1 oscil 10000, 441, 1
> outs a1, a1
> endin
>
> 
> 
> f1 0 4096 10 1
> e 30
> 
> 
>
>
>
>
> On 29 March 2010 15:03, Victor Lazzarini  wrote:
>> The -+rtmidi=null is designed to stop csound loading a midi module (ie
>> pmidi). What opcodes are you using to try and
>> pick up midi? You should use ctrl7 etc instead of midictrl7 etc.
>>
>> Victor
>>
>> On 29 Mar 2010, at 14:50, Rory Walsh wrote:
>>
>>> I have a host that routes midi to Csound using
>>> Csound::SetExternalMidiInOpenCallback() and
>>> Csound::SetExternalMidiReadCallback(). Everything works fine and using
>>> the following CsOptions command I can use my keyboard to play Csound
>>> instruments:
>>>
>>> -+rtmidi=null -M0 --midi-key-cps=4 --midi-velocity-amp=5
>>>
>>> Controllers on the other hand are proving more difficult. For some
>>> reason they just don't seem to get picked up. I'm wondering if it has
>>> something to do with the -+rtmidi being set to null? Here's an excerpt
>>> from my midiread callback function:
>>>
>>>          if(message.isNoteOn()){
>>>               *mbuf++ = (unsigned char)0x90 + message.getChannel();
>>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>>          *mbuf++ = (unsigned char)message.getVelocity();
>>>           cnt += 3;
>>>          }
>>>          else if(message.isNoteOff()){
>>>               *mbuf++ = (unsigned char)0x80 + message.getChannel();
>>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>>          *mbuf++ = (unsigned char)message.getVelocity();
>>>           cnt += 3;
>>>          }
>>>          else if(message.isController()){
>>>               *mbuf++ = (unsigned char)0xB0 + message.getChannel();
>>>               *mbuf++ = (unsigned char)message.getControllerNumber();
>>>               *mbuf++ = (unsigned char)message.getControllerValue();
>>>               cnt += 3;
>>>          }
>>>          else if(message.isAllNotesOff()){
>>>               *mbuf++ = (unsigned char)0x7B + message.getChannel();
>>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>>          *mbuf++ = (unsigned char)message.getVelocity();
>>>           cnt += 3;
>>>          }
>>>
>>> The third if statement is filling the midi buffer with controller
>>> data. I know the data is valid as I've printed to the stdout and it is
>>> just as expected. So too are the channel and controller numbers. Can
>>> anyone give me any ideas as to why Csound doesn't read these values?
>>> With rtmidi set to NULL does Csound ignore controller messages? I've
>>> tried looking through the Csound code and will continue to do so but
>>> it's a minefield..
>>>
>>> ------------------------------------------------------------------------------
>>> Download Intel® Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-03-29 15:37
FromRory Walsh
SubjectRe: [Cs-dev] question about MIDI and the Csound API...
The only other system I have come across that uses an external MIDI
device is Michael Goggin's csoundVST. I see that in his midiRead
callback he doesn't pass on control changes. I wonder is this by
design or due to some kind of limitation?

On 29 March 2010 15:26, Rory Walsh  wrote:
> I was trying ctrl7 and I don't want Csound to open any midi module as
> my host is doing that already. My instrument is pasted below. It seems
> that even though I am not using the interop flags and I don't have any
> instrument statements each midi keyboard press is still triggering
> instrument 2 for some reason, but not instrument one or two. If I use
> an i1 0 30 statement the value of k1 doesn't changed even though I'm
> moving my keyboard slider. I've check with various other software and
> the keyboard slider is definitely controller number seven on channel
> 1. Any further thoughts?
>
> 
> 
> -d -n -+rtmidi=null -M0 -m0d
> 
> 
> ; Initialize the global variables.
> sr = 44100
> ksmps = 32
> nchnls = 2
>
>
> instr 1
> k1 ctrl7 1, 7, 0, 100
> printk2 k1
> endin
>
> instr 2
> k1 ctrl7 1, 7, 0, 100
> printk2 k1
> a1 oscil 10000, 440, 1
> outs a1*0, a1
> endin
>
> instr 3
> a1 oscil 10000, 441, 1
> outs a1, a1
> endin
>
> 
> 
> f1 0 4096 10 1
> e 30
> 
> 
>
>
>
>
> On 29 March 2010 15:03, Victor Lazzarini  wrote:
>> The -+rtmidi=null is designed to stop csound loading a midi module (ie
>> pmidi). What opcodes are you using to try and
>> pick up midi? You should use ctrl7 etc instead of midictrl7 etc.
>>
>> Victor
>>
>> On 29 Mar 2010, at 14:50, Rory Walsh wrote:
>>
>>> I have a host that routes midi to Csound using
>>> Csound::SetExternalMidiInOpenCallback() and
>>> Csound::SetExternalMidiReadCallback(). Everything works fine and using
>>> the following CsOptions command I can use my keyboard to play Csound
>>> instruments:
>>>
>>> -+rtmidi=null -M0 --midi-key-cps=4 --midi-velocity-amp=5
>>>
>>> Controllers on the other hand are proving more difficult. For some
>>> reason they just don't seem to get picked up. I'm wondering if it has
>>> something to do with the -+rtmidi being set to null? Here's an excerpt
>>> from my midiread callback function:
>>>
>>>          if(message.isNoteOn()){
>>>               *mbuf++ = (unsigned char)0x90 + message.getChannel();
>>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>>          *mbuf++ = (unsigned char)message.getVelocity();
>>>           cnt += 3;
>>>          }
>>>          else if(message.isNoteOff()){
>>>               *mbuf++ = (unsigned char)0x80 + message.getChannel();
>>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>>          *mbuf++ = (unsigned char)message.getVelocity();
>>>           cnt += 3;
>>>          }
>>>          else if(message.isController()){
>>>               *mbuf++ = (unsigned char)0xB0 + message.getChannel();
>>>               *mbuf++ = (unsigned char)message.getControllerNumber();
>>>               *mbuf++ = (unsigned char)message.getControllerValue();
>>>               cnt += 3;
>>>          }
>>>          else if(message.isAllNotesOff()){
>>>               *mbuf++ = (unsigned char)0x7B + message.getChannel();
>>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>>          *mbuf++ = (unsigned char)message.getVelocity();
>>>           cnt += 3;
>>>          }
>>>
>>> The third if statement is filling the midi buffer with controller
>>> data. I know the data is valid as I've printed to the stdout and it is
>>> just as expected. So too are the channel and controller numbers. Can
>>> anyone give me any ideas as to why Csound doesn't read these values?
>>> With rtmidi set to NULL does Csound ignore controller messages? I've
>>> tried looking through the Csound code and will continue to do so but
>>> it's a minefield..
>>>
>>> ------------------------------------------------------------------------------
>>> Download Intel® Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-03-29 15:42
FromMichael Gogins
SubjectRe: [Cs-dev] question about MIDI and the Csound API...
I simply didn't take the time to test it because I do not use MIDI
controllers much. I seem to recall, vaguely, that driving MIDI interop
with a MIDI file does send controllers through to instruments that get
pfields 1 through 5 from the MIDI interop opcodes. That was years ago.
Of course that is not the same as using a custom driver.

But I don't see why it wouldn't work. At the level of the MIDI read
callback all MIDI data is the same.

Hope this helps,
Mike

On Mon, Mar 29, 2010 at 10:37 AM, Rory Walsh  wrote:
> The only other system I have come across that uses an external MIDI
> device is Michael Goggin's csoundVST. I see that in his midiRead
> callback he doesn't pass on control changes. I wonder is this by
> design or due to some kind of limitation?
>
> On 29 March 2010 15:26, Rory Walsh  wrote:
>> I was trying ctrl7 and I don't want Csound to open any midi module as
>> my host is doing that already. My instrument is pasted below. It seems
>> that even though I am not using the interop flags and I don't have any
>> instrument statements each midi keyboard press is still triggering
>> instrument 2 for some reason, but not instrument one or two. If I use
>> an i1 0 30 statement the value of k1 doesn't changed even though I'm
>> moving my keyboard slider. I've check with various other software and
>> the keyboard slider is definitely controller number seven on channel
>> 1. Any further thoughts?
>>
>> 
>> 
>> -d -n -+rtmidi=null -M0 -m0d
>> 
>> 
>> ; Initialize the global variables.
>> sr = 44100
>> ksmps = 32
>> nchnls = 2
>>
>>
>> instr 1
>> k1 ctrl7 1, 7, 0, 100
>> printk2 k1
>> endin
>>
>> instr 2
>> k1 ctrl7 1, 7, 0, 100
>> printk2 k1
>> a1 oscil 10000, 440, 1
>> outs a1*0, a1
>> endin
>>
>> instr 3
>> a1 oscil 10000, 441, 1
>> outs a1, a1
>> endin
>>
>> 
>> 
>> f1 0 4096 10 1
>> e 30
>> 
>> 
>>
>>
>>
>>
>> On 29 March 2010 15:03, Victor Lazzarini  wrote:
>>> The -+rtmidi=null is designed to stop csound loading a midi module (ie
>>> pmidi). What opcodes are you using to try and
>>> pick up midi? You should use ctrl7 etc instead of midictrl7 etc.
>>>
>>> Victor
>>>
>>> On 29 Mar 2010, at 14:50, Rory Walsh wrote:
>>>
>>>> I have a host that routes midi to Csound using
>>>> Csound::SetExternalMidiInOpenCallback() and
>>>> Csound::SetExternalMidiReadCallback(). Everything works fine and using
>>>> the following CsOptions command I can use my keyboard to play Csound
>>>> instruments:
>>>>
>>>> -+rtmidi=null -M0 --midi-key-cps=4 --midi-velocity-amp=5
>>>>
>>>> Controllers on the other hand are proving more difficult. For some
>>>> reason they just don't seem to get picked up. I'm wondering if it has
>>>> something to do with the -+rtmidi being set to null? Here's an excerpt
>>>> from my midiread callback function:
>>>>
>>>>          if(message.isNoteOn()){
>>>>               *mbuf++ = (unsigned char)0x90 + message.getChannel();
>>>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>>>          *mbuf++ = (unsigned char)message.getVelocity();
>>>>           cnt += 3;
>>>>          }
>>>>          else if(message.isNoteOff()){
>>>>               *mbuf++ = (unsigned char)0x80 + message.getChannel();
>>>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>>>          *mbuf++ = (unsigned char)message.getVelocity();
>>>>           cnt += 3;
>>>>          }
>>>>          else if(message.isController()){
>>>>               *mbuf++ = (unsigned char)0xB0 + message.getChannel();
>>>>               *mbuf++ = (unsigned char)message.getControllerNumber();
>>>>               *mbuf++ = (unsigned char)message.getControllerValue();
>>>>               cnt += 3;
>>>>          }
>>>>          else if(message.isAllNotesOff()){
>>>>               *mbuf++ = (unsigned char)0x7B + message.getChannel();
>>>>          *mbuf++ = (unsigned char)message.getNoteNumber();
>>>>          *mbuf++ = (unsigned char)message.getVelocity();
>>>>           cnt += 3;
>>>>          }
>>>>
>>>> The third if statement is filling the midi buffer with controller
>>>> data. I know the data is valid as I've printed to the stdout and it is
>>>> just as expected. So too are the channel and controller numbers. Can
>>>> anyone give me any ideas as to why Csound doesn't read these values?
>>>> With rtmidi set to NULL does Csound ignore controller messages? I've
>>>> tried looking through the Csound code and will continue to do so but
>>>> it's a minefield..
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Download Intel® Parallel Studio Eval
>>>> Try the new software tools for yourself. Speed compiling, find bugs
>>>> proactively, and fine-tune applications for parallel performance.
>>>> See why Intel Parallel Studio got high marks during beta.
>>>> http://p.sf.net/sfu/intel-sw-dev
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Download Intel® Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net