Re: Get events from MyReadProc: results
Re: Get events from MyReadProc: results
- Subject: Re: Get events from MyReadProc: results
- From: Bill Stewart <email@hidden>
- Date: Fri, 16 May 2003 18:19:13 -0700
Pascal
When you make the call from to your MC object does it do the drawing
directly, or just note that it got MIDI messages and send a
notification to draw to the view?
Bill
On Friday, May 16, 2003, at 04:36 PM, Pascal Goguey wrote:
Hello!
Thanks for your reply. At last I got some time to try it and it works!
In case it can be useful to somebody else, here is what I did:
I have a controller object and I wanted midi messages coming
from a digital piano to be received by ths controller. From there,
I wanted to draw the notes at the screen.
In MidiController.m:
static void MidiReadProc(const MIDIPacketList * PL, void * refCon,
void connRefCon) {
MidiController * MC = (MidiController *)refCon;
[MC notesReceived(PL)];
}
Then my midi controller calls an NSView that does all the drawing
stuff.
That's it! I am not sure it is the most elegant way to do it since
Obj-C is rather new for me, but it works.
Thanks again.
Pascal
On Tuesday, May 13, 2003, at 10:56 Asia/Tokyo, john wrote:
Hi Pascal,
It's ok to use a static function in your ObjC file for the read proc
like the echo.cpp file. Just declare it outside of the ObjC object
interface(.h) or implementation(.m). You might be able to use one of
the parameters of the read proc to pass a reference to your ObjC
object so the function can access your object. I'm sure someone else
can comment more helpfully on that.
Now I don't know anything about MIDI packets, but I presume you can
determine what note it represents in some way, then you can use this
information to make your graphic object display the appropriate note.
Maybe the link Pete Gontier gave you might help in determining what
note is being pressed.
Hope this helps!
-- John
Hello!
I would like to build a cocoa application that gets events
from a digital instruments (piano).
How can I link my, say, ControllerObject with the midi instrument
read procedure?
There is a sample code (echo.cpp) that explains how to tell
the system to call MyReadProc function everytime a piano
key is pressed, but what should I do if I want to display this
note graphically? I can do the graphics, but the missing piece
is how to get the MyReadProc to send the proper data to my
graphic object?
Ideally, I would like a function like [MyObj NoteReceived] to
be called with the notes passed as parameters...
Thanks,
Pascal
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.