Last active
February 14, 2017 18:53
-
-
Save jaygarcia/f3080b3ad700dc62b2c10cd72222629d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderer.block = ^(const AERenderContext * _Nonnull context) { | |
AEBufferStack *bufferStack = context->stack; | |
const AudioBufferList * bufferList = AEBufferStackPushWithChannels(bufferStack, 1, 2); | |
if ( !bufferList ) { | |
return; | |
} | |
float *leftBuffer = (float*)bufferList->mBuffers[0].mData, | |
*rightBuffer = (float*)bufferList->mBuffers[1].mData; | |
UInt32 byteSize = bufferList->mBuffers[0].mDataByteSize; | |
if (isLoading || isPaused) { | |
memset(leftBuffer, 0, byteSize); | |
memset(rightBuffer, 0, byteSize); | |
} | |
else { | |
// This part fills the left and right channel buffers to be sent to TAAE2 | |
int32_t *currentStep = [self.modPlayer fillLeftBuffer:leftBuffer | |
withRightBuffer:rightBuffer | |
withNumFrames:context->frames]; | |
int currentPattern = currentStep[1], | |
currentRow = currentStep[2]; | |
if (lastPattern != currentPattern || lastRow != currentRow) { | |
__weak typeof (self) weakSelf = self; | |
int32_t playerState[4]; | |
[weakSelf notifyInterface:playerState]; | |
} | |
} | |
// apply the EQ to left | |
for (int i = 0; i < 10; i++) { | |
AEModuleProcess(PEQ[i], context); | |
} | |
AERenderContextOutput(context, 1); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment