[Audio Output / Debugging] Fix sample logging

Fix the sample logging function that is optionally compiled into debug
versions.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
xcode15
Christopher Snowhill 2022-07-14 02:39:25 -07:00
parent 4044646280
commit 08e76bc9f3
1 changed files with 6 additions and 1 deletions

View File

@ -254,7 +254,8 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
currentPtsLock = [[NSLock alloc] init];
#ifdef OUTPUT_LOG
_logFile = fopen("/tmp/CogAudioLog.raw", "wb");
NSString *logName = [NSTemporaryDirectory() stringByAppendingPathComponent:@"CogAudioLog.raw"];
_logFile = fopen([logName UTF8String], "wb");
#endif
}
@ -837,6 +838,10 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
CMBlockBufferRef blockBuffer = nil;
size_t dataByteSize = samplesRendered * sizeof(float) * streamFormat.mChannelsPerFrame;
#ifdef OUTPUT_LOG
fwrite(samplePtr, 1, dataByteSize, _logFile);
#endif
status = CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault, nil, dataByteSize, kCFAllocatorDefault, nil, 0, dataByteSize, kCMBlockBufferAssureMemoryNowFlag, &blockBuffer);
if(status != noErr || !blockBuffer) {