static OSStatus audioDeviceIOProc(

    AudioDeviceID inDevice,

    const AudioTimeStamp* inNow,

    const AudioBufferList* inInputData,

    const AudioTimeStamp* inInputTime,

    AudioBufferList* outOutputData,

    const AudioTimeStamp* inOutputTime,

    void* hwptr)

{

    UInt32 frame, frameCount;

    float *out = outOutputData->mBuffers[0].mData;

    HWVoiceOut *hw = hwptr;

    coreaudioVoiceOut *core = (coreaudioVoiceOut *) hwptr;

    int rpos, live;

    st_sample_t *src;

#ifndef FLOAT_MIXENG

#ifdef RECIPROCAL

    const float scale = 1.f / UINT_MAX;

#else

    const float scale = UINT_MAX;

#endif

#endif



    if (coreaudio_lock (core, "audioDeviceIOProc")) {

        inInputTime = 0;

        return 0;

    }



    frameCount = core->audioDevicePropertyBufferFrameSize;

    live = core->live;



    /* if there are not enough samples, set signal and return */

    if (live < frameCount) {

        inInputTime = 0;

        coreaudio_unlock (core, "audioDeviceIOProc(empty)");

        return 0;

    }



    rpos = core->rpos;

    src = hw->mix_buf + rpos;



    /* fill buffer */

    for (frame = 0; frame < frameCount; frame++) {

#ifdef FLOAT_MIXENG

        *out++ = src[frame].l; /* left channel */

        *out++ = src[frame].r; /* right channel */

#else

#ifdef RECIPROCAL

        *out++ = src[frame].l * scale; /* left channel */

        *out++ = src[frame].r * scale; /* right channel */

#else

        *out++ = src[frame].l / scale; /* left channel */

        *out++ = src[frame].r / scale; /* right channel */

#endif

#endif

    }



    rpos = (rpos + frameCount) % hw->samples;

    core->decr += frameCount;

    core->rpos = rpos;



    coreaudio_unlock (core, "audioDeviceIOProc");

    return 0;

}

static OSStatus audioDeviceIOProc(

    AudioDeviceID inDevice,

    const AudioTimeStamp* inNow,

    const AudioBufferList* inInputData,

    const AudioTimeStamp* inInputTime,

    AudioBufferList* outOutputData,

    const AudioTimeStamp* inOutputTime,

    void* hwptr)

{

    UInt32 frame, frameCount;

    float *out = outOutputData->mBuffers[0].mData;

    HWVoiceOut *hw = hwptr;

    coreaudioVoiceOut *core = (coreaudioVoiceOut *) hwptr;

    int rpos, live;

    st_sample_t *src;

#ifndef FLOAT_MIXENG

#ifdef RECIPROCAL

    const float scale = 1.f / UINT_MAX;

#else

    const float scale = UINT_MAX;

#endif

#endif



    if (coreaudio_lock (core, "audioDeviceIOProc")) {

        inInputTime = 0;

        return 0;

    }



    frameCount = core->audioDevicePropertyBufferFrameSize;

    live = core->live;



    

    if (live < frameCount) {

        inInputTime = 0;

        coreaudio_unlock (core, "audioDeviceIOProc(empty)");

        return 0;

    }



    rpos = core->rpos;

    src = hw->mix_buf + rpos;



    

    for (frame = 0; frame < frameCount; frame++) {

#ifdef FLOAT_MIXENG

        *out++ = src[frame].l; 

        *out++ = src[frame].r; 

#else

#ifdef RECIPROCAL

        *out++ = src[frame].l * scale; 

        *out++ = src[frame].r * scale; 

#else

        *out++ = src[frame].l / scale; 

        *out++ = src[frame].r / scale; 

#endif

#endif

    }



    rpos = (rpos + frameCount) % hw->samples;

    core->decr += frameCount;

    core->rpos = rpos;



    coreaudio_unlock (core, "audioDeviceIOProc");

    return 0;

}

static OSStatus FUNC_0(

    AudioDeviceID inDevice,

    const AudioTimeStamp* inNow,

    const AudioBufferList* inInputData,

    const AudioTimeStamp* inInputTime,

    AudioBufferList* outOutputData,

    const AudioTimeStamp* inOutputTime,

    void* hwptr)

{

    UInt32 frame, frameCount;

    float *VAR_0 = outOutputData->mBuffers[0].mData;

    HWVoiceOut *hw = hwptr;

    coreaudioVoiceOut *core = (coreaudioVoiceOut *) hwptr;

    int VAR_1, VAR_2;

    st_sample_t *src;

#ifndef FLOAT_MIXENG

#ifdef RECIPROCAL

    const float VAR_3 = 1.f / UINT_MAX;

#else

    const float VAR_3 = UINT_MAX;

#endif

#endif



    if (coreaudio_lock (core, "FUNC_0")) {

        inInputTime = 0;

        return 0;

    }



    frameCount = core->audioDevicePropertyBufferFrameSize;

    VAR_2 = core->VAR_2;



    

    if (VAR_2 < frameCount) {

        inInputTime = 0;

        coreaudio_unlock (core, "FUNC_0(empty)");

        return 0;

    }



    VAR_1 = core->VAR_1;

    src = hw->mix_buf + VAR_1;



    

    for (frame = 0; frame < frameCount; frame++) {

#ifdef FLOAT_MIXENG

        *VAR_0++ = src[frame].l; 

        *VAR_0++ = src[frame].r; 

#else

#ifdef RECIPROCAL

        *VAR_0++ = src[frame].l * VAR_3; 

        *VAR_0++ = src[frame].r * VAR_3; 

#else

        *VAR_0++ = src[frame].l / VAR_3; 

        *VAR_0++ = src[frame].r / VAR_3; 

#endif

#endif

    }



    VAR_1 = (VAR_1 + frameCount) % hw->samples;

    core->decr += frameCount;

    core->VAR_1 = VAR_1;



    coreaudio_unlock (core, "FUNC_0");

    return 0;

}

static OSStatus FUNC_0(
AudioDeviceID inDevice,
const AudioTimeStamp* inNow,
const AudioBufferList* inInputData,
const AudioTimeStamp* inInputTime,
AudioBufferList* outOutputData,
const AudioTimeStamp* inOutputTime,
void* hwptr)
{ UInt32 frame, frameCount; float *VAR_0 = outOutputData->mBuffers[0].mData; HWVoiceOut *hw = hwptr; coreaudioVoiceOut *core = (coreaudioVoiceOut *) hwptr; int VAR_1, VAR_2; st_sample_t *src; #ifndef FLOAT_MIXENG
#ifdef RECIPROCAL
const float VAR_3 = 1.f / UINT_MAX; #else
const float VAR_3 = UINT_MAX; #endif
#endif
if (coreaudio_lock (core, "FUNC_0")) { inInputTime = 0; return 0; } frameCount = core->audioDevicePropertyBufferFrameSize; VAR_2 = core->VAR_2; if (VAR_2 < frameCount) { inInputTime = 0; coreaudio_unlock (core, "FUNC_0(empty)"); return 0; } VAR_1 = core->VAR_1; src = hw->mix_buf + VAR_1; for (frame = 0; frame < frameCount; frame++) { #ifdef FLOAT_MIXENG
*VAR_0++ = src[frame].l; *VAR_0++ = src[frame].r; #else
#ifdef RECIPROCAL
*VAR_0++ = src[frame].l * VAR_3; *VAR_0++ = src[frame].r * VAR_3; #else
*VAR_0++ = src[frame].l / VAR_3; *VAR_0++ = src[frame].r / VAR_3; #endif
#endif
} VAR_1 = (VAR_1 + frameCount) % hw->samples; core->decr += frameCount; core->VAR_1 = VAR_1; coreaudio_unlock (core, "FUNC_0"); return 0; }