Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

inputBlock is not working.... #50

Closed
poppyrr opened this Issue Jul 1, 2013 · 5 comments

Comments

Projects
None yet
3 participants

poppyrr commented Jul 1, 2013

Hi alex

When I try the demo project on iOS/Simulator, all the cases which include the "inputBlock" were broken (Basic playthru example, MEASURE SOME DECIBELS!, etc).

for example, the log below is not showing...

// Basic playthru example
[self.audioManager setInputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels) {

    NSLog(@"inputBlock!");

    float volume = 0.5;
    vDSP_vsmul(data, 1, &volume, data, 1, numFrames*numChannels);
    wself.ringBuffer->AddNewInterleavedFloatData(data, numFrames, numChannels);
}];


[self.audioManager setOutputBlock:^(float *outData, UInt32 numFrames, UInt32 numChannels) {
    wself.ringBuffer->FetchInterleavedData(outData, numFrames, numChannels);
}];

I traced to inputCallback in Novocaine.m, and the callback is not hit ("input callback" is not showing...), too.

// code here
#pragma mark - Render Methods
OSStatus inputCallback   (void                      *inRefCon,
                      AudioUnitRenderActionFlags    * ioActionFlags,
                      const AudioTimeStamp      * inTimeStamp,
                      UInt32                        inOutputBusNumber,
                      UInt32                        inNumberFrames,
                      AudioBufferList           * ioData)
{
@autoreleasepool {

    NSLog(@"input callback!!!");


    Novocaine *sm = (__bridge Novocaine *)inRefCon;

    if (!sm.playing)
        return noErr;
    if (sm.inputBlock == nil)
        return noErr;    

I test the code on Xcode 4.6.2/ 5-preview and IOS6.1/IOS7 beta2/Simulator.... and got the same result.I'm so confused about that... Does anybody have the same problem? :-(

Collaborator

ndonald2 commented Jul 1, 2013

Hi @poppyrr, with the blessing of @alexbw I recently updated novocaine to be ARC-compatible and did some interface refactoring. I thought I had tested input but I must have accidentally screwed something up. I will have a fix for you shortly, sorry for the inconvenience.

Collaborator

ndonald2 commented Jul 1, 2013

Should be all set now. Let me know if you still have issues.

Also you may have already noticed but you now have to explicitly call "play" to start the audio units.

Thanks!

nklugman commented Jul 1, 2013

I was having the same issue, this fixed it for me. Nice response time!

Collaborator

ndonald2 commented Jul 1, 2013

Great! I'm gonna go ahead and close the issue then.

@ndonald2 ndonald2 closed this Jul 1, 2013

poppyrr commented Jul 2, 2013

It works, so manny thx!

p.s. u fix it really fast 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment