• 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: Creating a MIDI Clock via Core Audio - SOLVED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a MIDI Clock via Core Audio - SOLVED


  • Subject: Re: Creating a MIDI Clock via Core Audio - SOLVED
  • From: Tamas Nagy <email@hidden>
  • Date: Tue, 03 Sep 2013 16:45:29 +0200

I solved the problem, it was because of how I built the array of MIDIEndpointRefs in a wrong way, the correct part is: 

ItemCount items = MIDIGetNumberOfDestinations();
    MIDIEndpointRef sources[items];

    

    for (int i=0;i<items;i++) {
        sources[i]=MIDIGetDestination(i);
    }

    

    err = CAClockSetProperty(theClock,kCAClockProperty_MIDIClockDestinations,sizeof((sizeof(MIDIEndpointRef)*items)), &sources);
    

On Aug 29, 2013, at 3:10 PM, Tamas Nagy <email@hidden> wrote:

Any idea on this guys? Seems nobody using a CAClock as a MIDI Clock?

Thanks,

Tamas

On Aug 27, 2013, at 7:08 PM, Tamas Nagy <email@hidden> wrote:

Hi list,

I'm trying to create an internal MIDI clock in my app, but wanted to the clock could be seen in other apps by sending the clock messages to midi out nodes.

I achieved the internal clock working, but using kCAClockProperty_MIDIClockDestinations to output the clock message is not working. Probably I missed something, but the "documentation" of Core Audio does not provide me any useful information.

Here is the code I'm using:

CAClockNew(0, &theClock);

syncMode = kCAClockSyncMode_Internal;
timeBase = kCAClockTimebase_HostTime;

tempoMap.beats = 4;
tempoMap.tempoBPM = 120.0f;

CAClockSetProperty(theClock,kCAClockProperty_SyncMode,sizeof(syncMode), &syncMode);
CAClockSetProperty(theClock,kCAClockProperty_InternalTimebase,sizeof(timeBase), &timeBase);
CAClockSetProperty(theClock,kCAClockProperty_TempoMap,sizeof(tempoMap), &tempoMap);

    MIDIEndpointRef *sources;
    int i, j;
    
    ItemCount num_sources = MIDIGetNumberOfSources();
    sources = (MIDIEndpointRef *)malloc(sizeof(MIDIEndpointRef) * num_sources);
    j = 0;
    for (i = 0; i < num_sources; i++) {
        MIDIEndpointRef source;
        source = MIDIGetSource(i);
        sources[j++] = source;
    }
    
    CFArrayRef sourcesArray = CFArrayCreate(NULL, (void *)sources, j, NULL);
    
CAClockSetProperty(theClock,kCAClockProperty_MIDIClockDestinations,sizeof(sourcesArray), &sourcesArray);
    
    
CAClockStart(theClock);


thanks for any advice. 

Tamas


 _______________________________________________
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

  • Prev by Date: Debugging microphone problems
  • Next by Date: Injecting audio from user space into a kernel driver
  • Previous by thread: Debugging microphone problems
  • Next by thread: Injecting audio from user space into a kernel driver
  • Index(es):
    • Date
    • Thread