Example #1
0
FskErr FskAudioDecompressFrames(FskAudioDecompress deco, const void *data, UInt32 dataSize, UInt32 frameCount, UInt32 *frameSizes, void **samples, UInt32 *audioFormat, UInt32 *sampleCount, UInt32 *channelCount)
{
    FskErr err;
    UInt32 samplesSize = 0;

#if SUPPORT_INSTRUMENTATION
    FskTimeRecord start, now;

    if (FskInstrumentedItemHasListenersForLevel(deco, kFskInstrumentationLevelDebug))
        FskTimeGetNow(&start);
    else
        start.seconds = start.useconds = 0;
#endif

    *samples = 0;
    *sampleCount = 0;

    err = (deco->decoder->doDecompressFrames)(deco->state, deco, data, dataSize, frameCount, frameSizes, samples, &samplesSize);
    if (err) {
        FskInstrumentedItemSendMessageMinimal(deco, kFskAudioDecompressInstrDecompressFailed, (void *)err);
        goto bail;
    }

    deco->frameNumber += frameCount;

    *sampleCount = samplesSize / (2 * deco->outputChannelCount);
    if (audioFormat) *audioFormat = deco->outputFormat;
    if (channelCount) *channelCount = deco->outputChannelCount;

#if SUPPORT_INSTRUMENTATION
    if (FskInstrumentedItemHasListenersForLevel(deco, kFskInstrumentationLevelMinimal)) {
        void *msgData[5];
        msgData[0] = (void *)data;
        msgData[1] = (void *)dataSize;
        msgData[2] = (void *)frameCount;
        msgData[3] = (void *)*sampleCount;
        if (!start.seconds)
            msgData[4] = (void *)0;
        else {
            FskTimeGetNow(&now);
            FskTimeSub(&start, &now);
            msgData[4] = (void *)FskTimeInMS(&now);
        }
        FskInstrumentedItemSendMessageForLevel(deco, kFskAudioDecompressInstrDecompress, msgData, kFskInstrumentationLevelMinimal);
    }
#endif

bail:
    return err;
}
Example #2
0
FskErr FskAudioFilterProcessSamples(FskAudioFilter filter, void *input, UInt32 inputSampleCount,
											void *output, UInt32 *outputSampleCount, UInt32 *outputSize)
{
	FskErr err;

	err = (filter->dispatch->doProcessSamples)(filter, filter->state, input, inputSampleCount, output, outputSampleCount, outputSize);

#if SUPPORT_INSTRUMENTATION
	if (FskInstrumentedItemHasListenersForLevel(filter, kFskInstrumentationLevelNormal)) {
		void *msgData[3];
		msgData[0] = (void *)inputSampleCount;
		msgData[1] = (void *)*outputSampleCount;
		msgData[2] = (void *)err;
		FskInstrumentedItemSendMessageForLevel(filter, kFskAudioFilterInstrProcess, msgData, kFskInstrumentationLevelNormal);
	}
#endif

	return err;
}