Re: CoreMIDI bug reporting available ports?
Re: CoreMIDI bug reporting available ports?
- Subject: Re: CoreMIDI bug reporting available ports?
- From: "support (One Red Dog Media)" <email@hidden>
- Date: Mon, 27 Aug 2012 01:20:54 +0000
- Thread-topic: CoreMIDI bug reporting available ports?
Hi
You have to register a NotifyProc then listen for the message kMIDIMsgSetupChanged. So you'd called
MIDIClientCreate(CFSTR("some name"), notifyProc, this, &client);
Then
void notifyProc(const MIDINotification* message, void* refCon)
{
switch (message->messageID)
{
case kMIDIMsgSetupChanged:
{
// here we can see ports that have been changed
}
break;
case kMIDIMsgObjectAdded:
// etc etc
}
}
regards
Peter
One Red Dog Media
On 27/08/2012, at 11:12 AM, Gary Scavone <email@hidden>
wrote:
> Perhaps I am misunderstanding something but it appears that CoreMIDI does not correctly report new or closed ports once an application is running. Below is a simple C++ program to return the number of available MIDI sources and destinations. It blocks at the cin.get() function so that you can open or close programs that create ports (or plug or unplug physical devices). I've tried it in 10.7 and 10.8 and the number of sources and destinations is never correctly updated when I make changes to my available MIDI ports after the program is running.
>
> Regards,
>
> --gary
>
> ====================================
> #include <CoreMIDI/CoreMIDI.h>
> #include <iostream>
> #include <cstdlib>
>
> int main()
> {
> int counter = 0;
>
> do {
>
> uint32_t nPorts = MIDIGetNumberOfSources();
> std::cout << "# of sources = " << nPorts << std::endl;
> nPorts = MIDIGetNumberOfDestinations();
> std::cout << "# of destinations = " << nPorts << std::endl;
> nPorts = MIDIGetNumberOfDevices();
> std::cout << "# of devices = " << nPorts << std::endl;
>
> char input;
> std::cout << "hit <return>" << std::endl;
> std::cin.get(input);
> counter++;
> } while ( counter < 5 );
>
> return 0;
> }
> ====================================
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden