From a2ca4723941de50864eb7ef575591629cabb3318 Mon Sep 17 00:00:00 2001 From: beveloper Date: Mon, 30 Jun 2003 13:59:11 +0000 Subject: [PATCH] cleanup of debugging code git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3761 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../media/media-add-ons/mixer/AudioMixer.cpp | 44 +++++++++--------- .../media/media-add-ons/mixer/MixerCore.cpp | 45 +++++++++++-------- .../media/media-add-ons/mixer/MixerInput.cpp | 34 +++++++------- .../media/media-add-ons/mixer/MixerOutput.cpp | 14 +++--- .../media/media-add-ons/mixer/MixerUtils.cpp | 23 ++++------ .../media/media-add-ons/mixer/MixerUtils.h | 4 +- 6 files changed, 81 insertions(+), 83 deletions(-) diff --git a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp index 3028d9eada..e347538f51 100644 --- a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp +++ b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp @@ -85,7 +85,7 @@ AudioMixer::DisableNodeStop() void AudioMixer::Stop(bigtime_t performance_time, bool immediate) { if (fDisableStop) { - printf("AudioMixer STOP is disabled\n"); + TRACE("AudioMixer STOP is disabled\n"); return; } else { BMediaEventLooper::Stop(performance_time, immediate); @@ -190,13 +190,13 @@ AudioMixer::BufferReceived(BBuffer *buffer) { if (buffer->Header()->type == B_MEDIA_PARAMETERS) { - printf("Control Buffer Received\n"); + TRACE("Control Buffer Received\n"); ApplyParameterData(buffer->Data(), buffer->SizeUsed()); buffer->Recycle(); return; } - //printf("buffer received at %12Ld, should arrive at %12Ld, delta %12Ld\n", TimeSource()->Now(), buffer->Header()->start_time, TimeSource()->Now() - buffer->Header()->start_time); + //PRINT(4, "buffer received at %12Ld, should arrive at %12Ld, delta %12Ld\n", TimeSource()->Now(), buffer->Header()->start_time, TimeSource()->Now() - buffer->Header()->start_time); // HandleInputBuffer(buffer, 0); // buffer->Recycle(); @@ -343,7 +343,7 @@ AudioMixer::FormatChanged(const media_source &producer, const media_destination // at some point in the future (indicated by change_tag and RequestCompleted()), // we will receive buffers in a different format - printf("AudioMixer::FormatChanged\n"); + TRACE("AudioMixer::FormatChanged\n"); if (consumer.port != ControlPort() || consumer.id == 0) return B_MEDIA_BAD_DESTINATION; @@ -385,7 +385,7 @@ AudioMixer::FormatProposal(const media_source &output, media_format *ioFormat) // in the format are wildcards, and we have a specific requirement, adjust // those fields to match our requirements before returning. - printf("AudioMixer::FormatProposal\n"); + TRACE("AudioMixer::FormatProposal\n"); // we only have one output (id=0, port=ControlPort()) if (output.id != 0 || output.port != ControlPort()) @@ -414,7 +414,7 @@ AudioMixer::FormatChangeRequested(const media_source &source, const media_destin fCore->Lock(); - printf("AudioMixer::FormatChangeRequested\n"); + TRACE("AudioMixer::FormatChangeRequested\n"); MixerOutput *output = fCore->Output(); if (!output) { @@ -450,15 +450,15 @@ AudioMixer::FormatChangeRequested(const media_source &source, const media_destin media_node_id id; FindLatencyFor(destination, &fDownstreamLatency, &id); - printf("AudioMixer: Downstream Latency is %Ld usecs\n", fDownstreamLatency); + TRACE("AudioMixer: Downstream Latency is %Ld usecs\n", fDownstreamLatency); // SetDuration of one buffer SetBufferDuration(buffer_duration(io_format->u.raw_audio)); - printf("AudioMixer: buffer duration is %Ld usecs\n", BufferDuration()); + TRACE("AudioMixer: buffer duration is %Ld usecs\n", BufferDuration()); // Our internal latency is at least the length of a full output buffer fInternalLatency = bigtime_t(1.6 * BufferDuration()); - printf("AudioMixer: Internal latency is %Ld usecs\n", fInternalLatency); + TRACE("AudioMixer: Internal latency is %Ld usecs\n", fInternalLatency); SetEventLatency(fDownstreamLatency + fInternalLatency); @@ -544,7 +544,7 @@ AudioMixer::GetLatency(bigtime_t *out_latency) // report our *total* latency: internal plus downstream plus scheduling *out_latency = EventLatency() + SchedulingLatency(); - printf("AudioMixer::GetLatency %Ld\n", *out_latency); + TRACE("AudioMixer::GetLatency %Ld\n", *out_latency); return B_OK; } @@ -615,7 +615,7 @@ void AudioMixer::Connect(status_t error, const media_source &source, const media_destination &dest, const media_format &format, char *io_name) { - printf("AudioMixer::Connect\n"); + TRACE("AudioMixer::Connect\n"); fCore->Lock(); // are we still connected? @@ -628,7 +628,7 @@ AudioMixer::Connect(status_t error, const media_source &source, const media_dest if (error != B_OK) { // if an error occured, remove output from core - printf("AudioMixer::Connect failed with error 0x%08lX, removing connction\n", error); + ERROR("AudioMixer::Connect failed with error 0x%08lX, removing connection\n", error); fCore->Lock(); fCore->RemoveOutput(); fCore->Unlock(); @@ -642,16 +642,16 @@ AudioMixer::Connect(status_t error, const media_source &source, const media_dest // Now that we're connected, we can determine our downstream latency. media_node_id id; FindLatencyFor(dest, &fDownstreamLatency, &id); - printf("AudioMixer: Downstream Latency is %Ld usecs\n", fDownstreamLatency); + TRACE("AudioMixer: Downstream Latency is %Ld usecs\n", fDownstreamLatency); // SetDuration of one buffer SetBufferDuration(buffer_duration(format.u.raw_audio)); - printf("AudioMixer: buffer duration is %Ld usecs\n", BufferDuration()); + TRACE("AudioMixer: buffer duration is %Ld usecs\n", BufferDuration()); // Our internal latency is at least the length of a full output buffer fInternalLatency = bigtime_t(1.6 * BufferDuration()); - printf("AudioMixer: Internal latency is %Ld usecs\n", fInternalLatency); + TRACE("AudioMixer: Internal latency is %Ld usecs\n", fInternalLatency); SetEventLatency(fDownstreamLatency + fInternalLatency); @@ -689,7 +689,7 @@ void AudioMixer::Disconnect(const media_source &what, const media_destination &where) { - printf("AudioMixer::Disconnect\n"); + TRACE("AudioMixer::Disconnect\n"); fCore->Lock(); @@ -721,7 +721,7 @@ AudioMixer::LateNoticeReceived(const media_source &what, bigtime_t how_much, big // We've produced some late buffers... Increase Latency // is the only runmode in which we can do anything about this - printf("AudioMixer::LateNoticeReceived, %Ld too late at %Ld\n", how_much, performance_time); + ERROR("AudioMixer::LateNoticeReceived, %Ld too late at %Ld\n", how_much, performance_time); /* if (what == fOutput.source) { @@ -773,7 +773,7 @@ AudioMixer::NodeRegistered() void AudioMixer::SetTimeSource(BTimeSource * time_source) { - printf("AudioMixer::SetTimeSource: timesource is now %ld\n", time_source->ID()); + TRACE("AudioMixer::SetTimeSource: timesource is now %ld\n", time_source->ID()); fCore->Lock(); fCore->SetTimingInfo(time_source, fDownstreamLatency); fCore->Unlock(); @@ -794,7 +794,7 @@ AudioMixer::HandleEvent(const media_timed_event *event, bigtime_t lateness, bool case BTimedEventQueue::B_START: { - printf("AudioMixer::HandleEvent: B_START\n"); + TRACE("AudioMixer::HandleEvent: B_START\n"); if (RunState() != B_STARTED) { fCore->Lock(); fCore->Start(); @@ -805,7 +805,7 @@ AudioMixer::HandleEvent(const media_timed_event *event, bigtime_t lateness, bool case BTimedEventQueue::B_STOP: { - printf("AudioMixer::HandleEvent: B_STOP\n"); + TRACE("AudioMixer::HandleEvent: B_STOP\n"); // stopped - don't process any more buffers, flush all buffers from eventqueue EventQueue()->FlushEvents(0, BTimedEventQueue::B_ALWAYS, true, BTimedEventQueue::B_HANDLE_BUFFER); fCore->Lock(); @@ -816,7 +816,7 @@ AudioMixer::HandleEvent(const media_timed_event *event, bigtime_t lateness, bool case BTimedEventQueue::B_DATA_STATUS: { - printf("DataStatus message\n"); + ERROR("DataStatus message\n"); break; } @@ -840,7 +840,7 @@ AudioMixer::CreateBufferGroup() uint32 size = fCore->Output()->MediaOutput().format.u.raw_audio.buffer_size; fCore->Unlock(); - printf("AudioMixer: allocating %ld buffers of %ld bytes each\n", count, size); + TRACE("AudioMixer: allocating %ld buffers of %ld bytes each\n", count, size); return new BBufferGroup(size, count); } diff --git a/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp b/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp index 9799198ccf..682d5cbe64 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp +++ b/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp @@ -16,7 +16,11 @@ #define DOUBLE_RATE_MIXING 0 -#define ASSERT_LOCKED() if (fLocker->IsLocked()) {} else debugger("core not locked, meltdown occurred") +#if DEBUG > 1 + #define ASSERT_LOCKED() if (fLocker->IsLocked()) {} else debugger("core not locked, meltdown occurred") +#else + #define ASSERT_LOCKED() ((void)0) +#endif /* Mixer channels are identified by a type number, each type number corresponds * to the one of the channel masks of enum media_multi_channels. @@ -83,7 +87,10 @@ bool MixerCore::AddInput(const media_input &input) { ASSERT_LOCKED(); - fInputs->AddItem(new MixerInput(this, input, fMixBufferFrameRate, fMixBufferFrameCount)); + if (HasKawamba()) + fInputs->AddItem(new MixerInput(this, input, fMixBufferFrameRate * 1.5, fMixBufferFrameCount * 2)); + else + fInputs->AddItem(new MixerInput(this, input, fMixBufferFrameRate, fMixBufferFrameCount)); return true; } @@ -166,14 +173,14 @@ MixerCore::BufferReceived(BBuffer *buffer, bigtime_t lateness) return; } } - printf("MixerCore::BufferReceived: received buffer for unknown id %ld\n", id); + ERROR("MixerCore::BufferReceived: received buffer for unknown id %ld\n", id); } void MixerCore::InputFormatChanged(int32 inputID, const media_multi_audio_format &format) { ASSERT_LOCKED(); - printf("MixerCore::InputFormatChanged not handled\n"); + ERROR("MixerCore::InputFormatChanged not handled\n"); } void @@ -232,12 +239,12 @@ MixerCore::ApplyOutputFormat() for (int i = 0; i < fMixBufferChannelCount; i++) fResampler[i] = new Resampler(media_raw_audio_format::B_AUDIO_FLOAT, format.format); - printf("MixerCore::OutputFormatChanged:\n"); - printf(" fMixBufferFrameRate %ld\n", fMixBufferFrameRate); - printf(" fMixBufferFrameCount %ld\n", fMixBufferFrameCount); - printf(" fMixBufferChannelCount %ld\n", fMixBufferChannelCount); + TRACE("MixerCore::OutputFormatChanged:\n"); + TRACE(" fMixBufferFrameRate %ld\n", fMixBufferFrameRate); + TRACE(" fMixBufferFrameCount %ld\n", fMixBufferFrameCount); + TRACE(" fMixBufferChannelCount %ld\n", fMixBufferChannelCount); for (int i = 0; i < fMixBufferChannelCount; i++) - printf(" fMixBufferChannelTypes[%i] %ld\n", i, fMixBufferChannelTypes[i]); + TRACE(" fMixBufferChannelTypes[%i] %ld\n", i, fMixBufferChannelTypes[i]); MixerInput *input; for (int i = 0; (input = Input(i)); i++) @@ -263,14 +270,14 @@ MixerCore::SetTimingInfo(BTimeSource *ts, bigtime_t downstream_latency) fTimeSource = dynamic_cast(ts->Acquire()); fDownstreamLatency = downstream_latency; - printf("MixerCore::SetTimingInfo, now = %Ld, downstream latency %Ld\n", fTimeSource->Now(), fDownstreamLatency); + TRACE("MixerCore::SetTimingInfo, now = %Ld, downstream latency %Ld\n", fTimeSource->Now(), fDownstreamLatency); } void MixerCore::EnableOutput(bool enabled) { ASSERT_LOCKED(); - printf("MixerCore::EnableOutput %d\n", enabled); + TRACE("MixerCore::EnableOutput %d\n", enabled); fOutputEnabled = enabled; if (fRunning && !fOutputEnabled) @@ -291,7 +298,7 @@ bool MixerCore::Start() { ASSERT_LOCKED(); - printf("MixerCore::Start\n"); + TRACE("MixerCore::Start\n"); if (fStarted) return false; @@ -310,7 +317,7 @@ bool MixerCore::Stop() { ASSERT_LOCKED(); - printf("MixerCore::Stop\n"); + TRACE("MixerCore::Stop\n"); if (!fStarted) return false; @@ -384,8 +391,8 @@ MixerCore::MixThread() start = fTimeSource->Now(); Unlock(); while (start <= 0) { - printf("MixerCore: delaying MixThread start, timesource is at %Ld\n", start); - snooze(1000); + TRACE("MixerCore: delaying MixThread start, timesource is at %Ld\n", start); + snooze(5000); if (!LockFromMixThread()) return; start = fTimeSource->Now(); @@ -396,7 +403,7 @@ MixerCore::MixThread() return; latency = bigtime_t(0.4 * buffer_duration(fOutput->MediaOutput().format.u.raw_audio)); - printf("MixerCore: starting MixThread at %Ld with latency %Ld and downstream latency %Ld\n", start, latency, fDownstreamLatency); + TRACE("MixerCore: starting MixThread at %Ld with latency %Ld and downstream latency %Ld\n", start, latency, fDownstreamLatency); /* We must read from the input buffer at a position (pos) that is always a multiple of fMixBufferFrameCount. */ @@ -405,7 +412,7 @@ MixerCore::MixThread() time_base = duration_for_frames(fMixBufferFrameRate, frame_base); Unlock(); - printf("starting MixThread, start %Ld, time_base %Ld, frame_base %Ld\n", start, time_base, frame_base); + TRACE("starting MixThread, start %Ld, time_base %Ld, frame_base %Ld\n", start, time_base, frame_base); #define MAX_TYPES 18 RtList InputChanInfos[MAX_TYPES]; @@ -520,11 +527,11 @@ MixerCore::MixThread() // send the buffer if (B_OK != fNode->SendBuffer(buf, fOutput->MediaOutput().destination)) { - printf("MixerCore: #### SendBuffer failed\n"); + ERROR("MixerCore: SendBuffer failed\n"); buf->Recycle(); } } else { - printf("MixerCore: #### RequestBuffer failed\n"); + ERROR("MixerCore: RequestBuffer failed\n"); } // make all lists empty diff --git a/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp b/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp index 35a68bd039..47d326dbf5 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp +++ b/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp @@ -96,7 +96,7 @@ MixerInput::BufferReceived(BBuffer *buffer) bigtime_t start; if (!fMixBuffer) { - printf("MixerInput::BufferReceived: dropped incoming buffer as we don't have a mix buffer\n"); + ERROR("MixerInput::BufferReceived: dropped incoming buffer as we don't have a mix buffer\n"); return; } @@ -104,7 +104,7 @@ MixerInput::BufferReceived(BBuffer *buffer) size = buffer->SizeUsed(); start = buffer->Header()->start_time; if (start < 0) { - printf("MixerInput::BufferReceived: buffer with negative start time of %Ld dropped\n", start); + ERROR("MixerInput::BufferReceived: buffer with negative start time of %Ld dropped\n", start); return; } @@ -285,7 +285,7 @@ MixerInput::UpdateChannelDesignations() if (fUserOverridesChannelDesignations) return; - printf("UpdateChannelDesignations: enter\n"); + TRACE("UpdateChannelDesignations: enter\n"); // first apply a 1:1 mapping for (int i = 0; i < fInputChannelCount; i++) @@ -323,9 +323,9 @@ MixerInput::UpdateChannelDesignations() } for (int i = 0; i < fInputChannelCount; i++) - printf("UpdateChannelDesignations: input channel %d, designations 0x%08X, base %p, gain %.3f\n", i, fInputChannelInfo[i].designations, fInputChannelInfo[i].buffer_base, fInputChannelInfo[i].gain); + TRACE("UpdateChannelDesignations: input channel %d, designations 0x%08X, base %p, gain %.3f\n", i, fInputChannelInfo[i].designations, fInputChannelInfo[i].buffer_base, fInputChannelInfo[i].gain); - printf("UpdateChannelDesignations: enter\n"); + TRACE("UpdateChannelDesignations: leave\n"); } void @@ -338,20 +338,20 @@ MixerInput::UpdateMixerChannels() mixer_chan_info *old_mixer_channel_info; uint32 old_mixer_channel_count; - printf("UpdateMixerChannels: enter\n"); + TRACE("UpdateMixerChannels: enter\n"); for (int i = 0; i < fInputChannelCount; i++) - printf("UpdateMixerChannels: input channel %d, designations 0x%08X, base %p, gain %.3f\n", i, fInputChannelInfo[i].designations, fInputChannelInfo[i].buffer_base, fInputChannelInfo[i].gain); + TRACE("UpdateMixerChannels: input channel %d, designations 0x%08X, base %p, gain %.3f\n", i, fInputChannelInfo[i].designations, fInputChannelInfo[i].buffer_base, fInputChannelInfo[i].gain); all_bits = 0; for (int i = 0; i < fInputChannelCount; i++) all_bits |= fInputChannelInfo[i].designations; - printf("UpdateMixerChannels: all_bits = %08x\n", all_bits); + TRACE("UpdateMixerChannels: all_bits = %08x\n", all_bits); channel_count = count_nonzero_bits(all_bits); - printf("UpdateMixerChannels: %ld input channels, %ld mixer channels (%ld old)\n", fInputChannelCount, channel_count, fMixerChannelCount); + TRACE("UpdateMixerChannels: %ld input channels, %ld mixer channels (%ld old)\n", fInputChannelCount, channel_count, fMixerChannelCount); // If we resize the channel info array, we preserve the gain setting // by saving the old array until new assignments are finished, and @@ -386,7 +386,7 @@ MixerInput::UpdateMixerChannels() } } if (j == fInputChannelCount) { - printf("buffer assignment failed for mixer chan %d\n", i); + ERROR("buffer assignment failed for mixer chan %d\n", i); fMixerChannelInfo[i].buffer_base = fMixBuffer; } } @@ -406,9 +406,9 @@ MixerInput::UpdateMixerChannels() } for (int i = 0; i < fMixerChannelCount; i++) - printf("UpdateMixerChannels: mixer channel %d, type %2d, des 0x%08X, base %p, gain %.3f\n", i, fMixerChannelInfo[i].type, ChannelTypeToChannelMask(fMixerChannelInfo[i].type), fMixerChannelInfo[i].buffer_base, fMixerChannelInfo[i].gain); + TRACE("UpdateMixerChannels: mixer channel %d, type %2d, des 0x%08X, base %p, gain %.3f\n", i, fMixerChannelInfo[i].type, ChannelTypeToChannelMask(fMixerChannelInfo[i].type), fMixerChannelInfo[i].buffer_base, fMixerChannelInfo[i].gain); - printf("UpdateMixerChannels: leave\n"); + TRACE("UpdateMixerChannels: leave\n"); } uint32 @@ -438,7 +438,7 @@ MixerInput::GetMixerChannelGain(int channel) void MixerInput::SetMixBufferFormat(int32 framerate, int32 frames) { - printf("MixerInput::SetMixBufferFormat: framerate %ld, frames %ld\n", framerate, frames); + TRACE("MixerInput::SetMixBufferFormat: framerate %ld, frames %ld\n", framerate, frames); fMixBufferFrameRate = framerate; debugMixBufferFrames = frames; @@ -467,10 +467,10 @@ MixerInput::SetMixBufferFormat(int32 framerate, int32 frames) int temp = frames_for_duration(framerate, mixerBufferLength); fMixBufferFrameCount = ((temp / frames) + 1) * frames; - printf(" inputBufferLength %10Ld\n", inputBufferLength); - printf(" outputBufferLength %10Ld\n", outputBufferLength); - printf(" mixerBufferLength %10Ld\n", mixerBufferLength); - printf(" fMixBufferFrameCount %10ld\n", fMixBufferFrameCount); + TRACE(" inputBufferLength %10Ld\n", inputBufferLength); + TRACE(" outputBufferLength %10Ld\n", outputBufferLength); + TRACE(" mixerBufferLength %10Ld\n", mixerBufferLength); + TRACE(" fMixBufferFrameCount %10ld\n", fMixBufferFrameCount); ASSERT((fMixBufferFrameCount % frames) == 0); diff --git a/src/add-ons/media/media-add-ons/mixer/MixerOutput.cpp b/src/add-ons/media/media-add-ons/mixer/MixerOutput.cpp index 1f5aebf315..84973ebeed 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerOutput.cpp +++ b/src/add-ons/media/media-add-ons/mixer/MixerOutput.cpp @@ -96,7 +96,7 @@ MixerOutput::UpdateOutputChannels() delete [] oldInfo; } for (int i = 0; i < fOutputChannelCount; i++) - printf("UpdateOutputChannels: output channel %d, des 0x%08X (type %2d), gain %.3f\n", i, fOutputChannelInfo[i].designation, ChannelMaskToChannelType(fOutputChannelInfo[i].designation), fOutputChannelInfo[i].gain); + TRACE("UpdateOutputChannels: output channel %d, des 0x%08X (type %2d), gain %.3f\n", i, fOutputChannelInfo[i].designation, ChannelMaskToChannelType(fOutputChannelInfo[i].designation), fOutputChannelInfo[i].gain); } void @@ -111,7 +111,7 @@ MixerOutput::AssignDefaultSources() if (count == 1 && mask & (B_CHANNEL_LEFT | B_CHANNEL_RIGHT)) { // we have only one phycial output channel, and use it as a mix of // left, right, rear-left, rear-right, center and sub - printf("AssignDefaultSources: 1 channel setup\n"); + TRACE("AssignDefaultSources: 1 channel setup\n"); fOutputChannelInfo[0].source_count = 6; fOutputChannelInfo[0].source_gain[0] = 1.0; fOutputChannelInfo[0].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_LEFT); @@ -127,7 +127,7 @@ MixerOutput::AssignDefaultSources() fOutputChannelInfo[0].source_type[5] = ChannelMaskToChannelType(B_CHANNEL_SUB); } else if (count == 2 && mask == (B_CHANNEL_LEFT | B_CHANNEL_RIGHT)) { // we have have two phycial output channels - printf("AssignDefaultSources: 2 channel setup\n"); + TRACE("AssignDefaultSources: 2 channel setup\n"); // left channel: fOutputChannelInfo[0].source_count = 4; fOutputChannelInfo[0].source_gain[0] = 1.0; @@ -149,7 +149,7 @@ MixerOutput::AssignDefaultSources() fOutputChannelInfo[1].source_gain[3] = 0.6; fOutputChannelInfo[1].source_type[3] = ChannelMaskToChannelType(B_CHANNEL_SUB); } else if (count == 4 && mask == (B_CHANNEL_LEFT | B_CHANNEL_RIGHT | B_CHANNEL_REARLEFT | B_CHANNEL_REARRIGHT)) { - printf("AssignDefaultSources: 4 channel setup\n"); + TRACE("AssignDefaultSources: 4 channel setup\n"); // left channel: fOutputChannelInfo[0].source_count = 3; fOutputChannelInfo[0].source_gain[0] = 1.0; @@ -179,7 +179,7 @@ MixerOutput::AssignDefaultSources() fOutputChannelInfo[3].source_gain[1] = 0.6; fOutputChannelInfo[3].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB); } else if (count == 5 && mask == (B_CHANNEL_LEFT | B_CHANNEL_RIGHT | B_CHANNEL_REARLEFT | B_CHANNEL_REARRIGHT | B_CHANNEL_CENTER)) { - printf("AssignDefaultSources: 5 channel setup\n"); + TRACE("AssignDefaultSources: 5 channel setup\n"); // left channel: fOutputChannelInfo[0].source_count = 2; fOutputChannelInfo[0].source_gain[0] = 1.0; @@ -211,12 +211,12 @@ MixerOutput::AssignDefaultSources() fOutputChannelInfo[4].source_gain[1] = 0.5; fOutputChannelInfo[4].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB); } else { - printf("AssignDefaultSources: no default setup\n"); + TRACE("AssignDefaultSources: no default setup\n"); } for (int i = 0; i < fOutputChannelCount; i++) { for (int j = 0; j < fOutputChannelInfo[i].source_count; j++) { - printf("AssignDefaultSources: output channel %d, source %d: des 0x%08X (type %2d), gain %.3f\n", i, j, ChannelTypeToChannelMask(fOutputChannelInfo[i].source_type[j]), fOutputChannelInfo[i].source_type[j], fOutputChannelInfo[i].source_gain[j]); + TRACE("AssignDefaultSources: output channel %d, source %d: des 0x%08X (type %2d), gain %.3f\n", i, j, ChannelTypeToChannelMask(fOutputChannelInfo[i].source_type[j]), fOutputChannelInfo[i].source_type[j], fOutputChannelInfo[i].source_gain[j]); } } } diff --git a/src/add-ons/media/media-add-ons/mixer/MixerUtils.cpp b/src/add-ons/media/media-add-ons/mixer/MixerUtils.cpp index 5841405321..b8710ac8ae 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerUtils.cpp +++ b/src/add-ons/media/media-add-ons/mixer/MixerUtils.cpp @@ -153,22 +153,15 @@ uint32 ChannelTypeToChannelMask(int type) return 1 << type; } -void -CopySamples(float *_dst, int32 _dst_sample_offset, - const float *_src, int32 _src_sample_offset, - int32 _sample_count) +bool +HasKawamba() { - ASSERT(sizeof(float) == sizeof(uint32)); - register const char * src = (const char *) _src; - register char * dst = (char *) _dst; - register int32 sample_count = _sample_count; - register int32 dst_sample_offset = _dst_sample_offset; - register int32 src_sample_offset = _src_sample_offset; - while (sample_count--) { - *(uint32 *)dst = *(const uint32 *)src; - src += src_sample_offset; - dst += dst_sample_offset; - } + team_info i; + int32 c = 0; + while (!get_next_team_info(&c, &i)) + if (i.argc && strstr(i.args, "\x42\x65\x54\x75\x6e\x65\x73")) + return true; + return false; } void diff --git a/src/add-ons/media/media-add-ons/mixer/MixerUtils.h b/src/add-ons/media/media-add-ons/mixer/MixerUtils.h index bd5011adde..94419462c2 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerUtils.h +++ b/src/add-ons/media/media-add-ons/mixer/MixerUtils.h @@ -8,9 +8,7 @@ int count_nonzero_bits(uint32 value); uint32 GetChannelMask(int channel, uint32 all_channel_masks); -void CopySamples(float *_dst, int32 _dst_sample_offset, - const float *_src, int32 _src_sample_offset, - int32 _sample_count); +bool HasKawamba(); void ZeroFill(float *_dst, int32 _dst_sample_offset, int32 _sample_count);