Skip to content

这段代码用swift怎么写 #3

@MasterMusketeer

Description

@MasterMusketeer

static OSStatus PlayCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData) {

LYPlayer *player = (__bridge LYPlayer *)inRefCon;

ioData->mBuffers[0].mDataByteSize = (UInt32)[player->inputSteam read:ioData->mBuffers[0].mData maxLength:(NSInteger)ioData->mBuffers[0].mDataByteSize];;
NSLog(@"out size: %d", ioData->mBuffers[0].mDataByteSize);

if (ioData->mBuffers[0].mDataByteSize <= 0) {
    dispatch_async(dispatch_get_main_queue(), ^{
        [player stop];
    });
}
return noErr;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions