• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Get events from MyReadProc: results
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get events from MyReadProc: results


  • Subject: Re: Get events from MyReadProc: results
  • From: Pascal Goguey <email@hidden>
  • Date: Sat, 17 May 2003 08:36:15 +0900

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.

  • Follow-Ups:
    • Re: Get events from MyReadProc: results
      • From: Bill Stewart <email@hidden>
  • Prev by Date: Re: AU HostCallback - musical location
  • Next by Date: Re: Get events from MyReadProc: results
  • Previous by thread: Re: AU HostCallback - musical location
  • Next by thread: Re: Get events from MyReadProc: results
  • Index(es):
    • Date
    • Thread