diff --git a/src/add-ons/media/media-add-ons/mixer/MixerInput.h b/src/add-ons/media/media-add-ons/mixer/MixerInput.h index 6503d2e28d..dc221f0f40 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerInput.h +++ b/src/add-ons/media/media-add-ons/mixer/MixerInput.h @@ -120,32 +120,44 @@ MixerInput::GetMixerChannelCount() inline bool -MixerInput::GetMixerChannelInfo(int mixer_channel, int64 framepos, - bigtime_t time, const float **buffer, uint32 *sample_offset, int *type, - float *gain) +MixerInput::GetMixerChannelInfo(int mixerChannel, int64 framepos, + bigtime_t time, const float** buffer, uint32* sampleOffset, int* type, + float* gain) { // this function should not be called if we don't have a mix buffer! - ASSERT(fMixBuffer); - ASSERT(mixer_channel >= 0 && mixer_channel < fMixerChannelCount); + ASSERT(fMixBuffer != NULL); + ASSERT(mixerChannel >= 0 && mixerChannel < fMixerChannelCount); if (!fEnabled) return false; #if 1 - if (time < (fLastDataAvailableTime - duration_for_frames(fMixBufferFrameRate, fMixBufferFrameCount)) - || (time + duration_for_frames(fMixBufferFrameRate, fDebugMixBufferFrames)) >= fLastDataAvailableTime) - ERROR("MixerInput::GetMixerChannelInfo: reading wrong data, have %Ld to %Ld, reading from %Ld to %Ld\n", - fLastDataAvailableTime - duration_for_frames(fMixBufferFrameRate, fMixBufferFrameCount), fLastDataAvailableTime, time, time + duration_for_frames(fMixBufferFrameRate, fDebugMixBufferFrames)); + if (time < (fLastDataAvailableTime - duration_for_frames( + fMixBufferFrameRate, fMixBufferFrameCount)) + || (time + duration_for_frames(fMixBufferFrameRate, + fDebugMixBufferFrames)) >= fLastDataAvailableTime) { + ERROR("MixerInput::GetMixerChannelInfo: reading wrong data, have %Ld " + "to %Ld, reading from %Ld to %Ld\n", + fLastDataAvailableTime - duration_for_frames(fMixBufferFrameRate, + fMixBufferFrameCount), fLastDataAvailableTime, time, + time + duration_for_frames(fMixBufferFrameRate, + fDebugMixBufferFrames)); + } #endif if (time > fLastDataAvailableTime) return false; int32 offset = framepos % fMixBufferFrameCount; - if (mixer_channel == 0) PRINT(3, "GetMixerChannelInfo: frames %ld to %ld\n", offset, offset + fDebugMixBufferFrames - 1); - *buffer = reinterpret_cast(reinterpret_cast(fMixerChannelInfo[mixer_channel].buffer_base) + (offset * sizeof(float) * fInputChannelCount)); - *sample_offset = sizeof(float) * fInputChannelCount; - *type = fMixerChannelInfo[mixer_channel].destination_type; - *gain = fMixerChannelInfo[mixer_channel].destination_gain; + if (mixerChannel == 0) { + PRINT(3, "GetMixerChannelInfo: frames %ld to %ld\n", offset, + offset + fDebugMixBufferFrames - 1); + } + *buffer = reinterpret_cast(reinterpret_cast( + fMixerChannelInfo[mixerChannel].buffer_base) + + (offset * sizeof(float) * fInputChannelCount)); + *sampleOffset = sizeof(float) * fInputChannelCount; + *type = fMixerChannelInfo[mixerChannel].destination_type; + *gain = fMixerChannelInfo[mixerChannel].destination_gain; return true; }