Cubasis Freeze Option

19 views
Skip to first unread message

Nguyen Minh Tien

unread,
Apr 15, 2014, 6:25:50 AM4/15/14
to open-music-app...@googlegroups.com
Hi all !
I'm a developer of BlueMangoo Software. We face a problem : When cubasis connects to ifretless app & use freeze option, the sound becomes glitches. We have a secondary thread to read data from disk & feed the audio thread. I think the problem probably is the secondary thread can not catch up in offline rendering mode. Is there any way to make the audio thread wait until my secondary thread finish reading data ? Any help would be much appreciated.

David Blake

unread,
Apr 15, 2014, 6:36:25 AM4/15/14
to open-music-app...@googlegroups.com
Hi Nguyen,

Assuming I understand your situation - I do something like this, not the most elegant solution but it works. Basically operationQueue is your secondary thread feeding the data. When its not working (ie operation count == 0) it allows you to call AudioUnitRender, otherwise it just keeps checking until it does == 0.

    do {

        if ([self.operationQueue operationCount] == 0) {

                    OSStatus error = noErr;

            if ((error = AudioUnitRender(outputUnit, &ioActionFlags, &inTimeStamp, 0, inNumberFrames, bufferList)) != noErr)

             {

                printf("Cannot AudioUnitRender: %d  ... aborting\n", error)

            }

            inTimeStamp.mSampleTime += inNumberFrames;

        }

        else {

            printf("waiting for operations to finish....\n");

        }

    } while (self.exportingEnabled);

Nguyen Minh Tien

unread,
Apr 18, 2014, 6:09:54 AM4/18/14
to open-music-app...@googlegroups.com
Thank David !
DO you know any way to detect the offline rendering mode ?

David Blake

unread,
Apr 18, 2014, 6:11:25 AM4/18/14
to open-music-app...@googlegroups.com
Well for me I just set a flag when I recreate my graph to have a generic output audiounit instead of the remoteIO unit. 


--
You received this message because you are subscribed to the Google Groups "Open Music App Collaboration" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-music-app-colla...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Chappell

unread,
Apr 18, 2014, 8:30:24 AM4/18/14
to open-music-app...@googlegroups.com
No, what Nguyen is talking about is the situation where you are running as an active IAA client of a host. One of the undocumented features is that the host can put its connected client units in offline render mode, which means as an IAA client app you could suddenly not be running in the usual realtime thread context at the usual realtime rates.  Predictably, it isn't clear from Apple's API whether you can as a client determine with a property or parameter whether your own RemoteIO (IAA connected) is actually being run in this mode. This is a pretty big oversight on Apple's part if you can't, so I'm hoping someone has discovered the "official" reliable way to do it without relying on timing the interval between callbacks. 

I don't have the answer!

jlc

David Blake

unread,
Apr 18, 2014, 8:43:54 AM4/18/14
to open-music-app-collaboration
Ahhhh I seeee. Well as far as I am aware, IAA node apps are always in 'offline mode' in the sense they can have their information pulled through at any rate determined by the host app. So if you put the AudioUnitRender() function in your render call back it will pull the frames through at the same speed as the render callback. If you host then goes into offline rendering mode, it will pull the frames through at the speed of the offline render. 

As for determining what to do if a host app suddenly starts pulling at offline rendering speed, yes I can see how this would be a problem and is something I hadn't even considered! I haven't even tested this in my own app but I suspect it will be at the mercy of all the same problems Nguyen is having. Like you say, timing between callbacks is the only thing I can think of... but I guess it would have to be using the delta time measured in the node app, dont think there is anything in the inTimeStamp that you could measure?

Nguyen Minh Tien

unread,
Apr 18, 2014, 1:34:49 PM4/18/14
to open-music-app...@googlegroups.com
Thank Jesse & David !
So i assume the only way to do it now is checking the time interval between callbacks. If you guys know the different way in the future, please let me know. Thank you !
Reply all
Reply to author
Forward
0 new messages