cleanup of debugging code
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3761 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -85,7 +85,7 @@ AudioMixer::DisableNodeStop()
|
|||||||
void AudioMixer::Stop(bigtime_t performance_time, bool immediate)
|
void AudioMixer::Stop(bigtime_t performance_time, bool immediate)
|
||||||
{
|
{
|
||||||
if (fDisableStop) {
|
if (fDisableStop) {
|
||||||
printf("AudioMixer STOP is disabled\n");
|
TRACE("AudioMixer STOP is disabled\n");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
BMediaEventLooper::Stop(performance_time, immediate);
|
BMediaEventLooper::Stop(performance_time, immediate);
|
||||||
@@ -190,13 +190,13 @@ AudioMixer::BufferReceived(BBuffer *buffer)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (buffer->Header()->type == B_MEDIA_PARAMETERS) {
|
if (buffer->Header()->type == B_MEDIA_PARAMETERS) {
|
||||||
printf("Control Buffer Received\n");
|
TRACE("Control Buffer Received\n");
|
||||||
ApplyParameterData(buffer->Data(), buffer->SizeUsed());
|
ApplyParameterData(buffer->Data(), buffer->SizeUsed());
|
||||||
buffer->Recycle();
|
buffer->Recycle();
|
||||||
return;
|
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);
|
// HandleInputBuffer(buffer, 0);
|
||||||
// buffer->Recycle();
|
// 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()),
|
// at some point in the future (indicated by change_tag and RequestCompleted()),
|
||||||
// we will receive buffers in a different format
|
// we will receive buffers in a different format
|
||||||
|
|
||||||
printf("AudioMixer::FormatChanged\n");
|
TRACE("AudioMixer::FormatChanged\n");
|
||||||
|
|
||||||
if (consumer.port != ControlPort() || consumer.id == 0)
|
if (consumer.port != ControlPort() || consumer.id == 0)
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
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
|
// in the format are wildcards, and we have a specific requirement, adjust
|
||||||
// those fields to match our requirements before returning.
|
// 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())
|
// we only have one output (id=0, port=ControlPort())
|
||||||
if (output.id != 0 || output.port != ControlPort())
|
if (output.id != 0 || output.port != ControlPort())
|
||||||
@@ -414,7 +414,7 @@ AudioMixer::FormatChangeRequested(const media_source &source, const media_destin
|
|||||||
|
|
||||||
fCore->Lock();
|
fCore->Lock();
|
||||||
|
|
||||||
printf("AudioMixer::FormatChangeRequested\n");
|
TRACE("AudioMixer::FormatChangeRequested\n");
|
||||||
|
|
||||||
MixerOutput *output = fCore->Output();
|
MixerOutput *output = fCore->Output();
|
||||||
if (!output) {
|
if (!output) {
|
||||||
@@ -450,15 +450,15 @@ AudioMixer::FormatChangeRequested(const media_source &source, const media_destin
|
|||||||
|
|
||||||
media_node_id id;
|
media_node_id id;
|
||||||
FindLatencyFor(destination, &fDownstreamLatency, &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
|
// SetDuration of one buffer
|
||||||
SetBufferDuration(buffer_duration(io_format->u.raw_audio));
|
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
|
// Our internal latency is at least the length of a full output buffer
|
||||||
fInternalLatency = bigtime_t(1.6 * BufferDuration());
|
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);
|
SetEventLatency(fDownstreamLatency + fInternalLatency);
|
||||||
|
|
||||||
@@ -544,7 +544,7 @@ AudioMixer::GetLatency(bigtime_t *out_latency)
|
|||||||
// report our *total* latency: internal plus downstream plus scheduling
|
// report our *total* latency: internal plus downstream plus scheduling
|
||||||
*out_latency = EventLatency() + SchedulingLatency();
|
*out_latency = EventLatency() + SchedulingLatency();
|
||||||
|
|
||||||
printf("AudioMixer::GetLatency %Ld\n", *out_latency);
|
TRACE("AudioMixer::GetLatency %Ld\n", *out_latency);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -615,7 +615,7 @@ void
|
|||||||
AudioMixer::Connect(status_t error, const media_source &source, const media_destination &dest,
|
AudioMixer::Connect(status_t error, const media_source &source, const media_destination &dest,
|
||||||
const media_format &format, char *io_name)
|
const media_format &format, char *io_name)
|
||||||
{
|
{
|
||||||
printf("AudioMixer::Connect\n");
|
TRACE("AudioMixer::Connect\n");
|
||||||
|
|
||||||
fCore->Lock();
|
fCore->Lock();
|
||||||
// are we still connected?
|
// 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 (error != B_OK) {
|
||||||
// if an error occured, remove output from core
|
// 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->Lock();
|
||||||
fCore->RemoveOutput();
|
fCore->RemoveOutput();
|
||||||
fCore->Unlock();
|
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.
|
// Now that we're connected, we can determine our downstream latency.
|
||||||
media_node_id id;
|
media_node_id id;
|
||||||
FindLatencyFor(dest, &fDownstreamLatency, &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
|
// SetDuration of one buffer
|
||||||
SetBufferDuration(buffer_duration(format.u.raw_audio));
|
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
|
// Our internal latency is at least the length of a full output buffer
|
||||||
fInternalLatency = bigtime_t(1.6 * BufferDuration());
|
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);
|
SetEventLatency(fDownstreamLatency + fInternalLatency);
|
||||||
|
|
||||||
@@ -689,7 +689,7 @@ void
|
|||||||
AudioMixer::Disconnect(const media_source &what, const media_destination &where)
|
AudioMixer::Disconnect(const media_source &what, const media_destination &where)
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("AudioMixer::Disconnect\n");
|
TRACE("AudioMixer::Disconnect\n");
|
||||||
|
|
||||||
fCore->Lock();
|
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
|
// We've produced some late buffers... Increase Latency
|
||||||
// is the only runmode in which we can do anything about this
|
// 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) {
|
if (what == fOutput.source) {
|
||||||
@@ -773,7 +773,7 @@ AudioMixer::NodeRegistered()
|
|||||||
void
|
void
|
||||||
AudioMixer::SetTimeSource(BTimeSource * time_source)
|
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->Lock();
|
||||||
fCore->SetTimingInfo(time_source, fDownstreamLatency);
|
fCore->SetTimingInfo(time_source, fDownstreamLatency);
|
||||||
fCore->Unlock();
|
fCore->Unlock();
|
||||||
@@ -794,7 +794,7 @@ AudioMixer::HandleEvent(const media_timed_event *event, bigtime_t lateness, bool
|
|||||||
|
|
||||||
case BTimedEventQueue::B_START:
|
case BTimedEventQueue::B_START:
|
||||||
{
|
{
|
||||||
printf("AudioMixer::HandleEvent: B_START\n");
|
TRACE("AudioMixer::HandleEvent: B_START\n");
|
||||||
if (RunState() != B_STARTED) {
|
if (RunState() != B_STARTED) {
|
||||||
fCore->Lock();
|
fCore->Lock();
|
||||||
fCore->Start();
|
fCore->Start();
|
||||||
@@ -805,7 +805,7 @@ AudioMixer::HandleEvent(const media_timed_event *event, bigtime_t lateness, bool
|
|||||||
|
|
||||||
case BTimedEventQueue::B_STOP:
|
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
|
// stopped - don't process any more buffers, flush all buffers from eventqueue
|
||||||
EventQueue()->FlushEvents(0, BTimedEventQueue::B_ALWAYS, true, BTimedEventQueue::B_HANDLE_BUFFER);
|
EventQueue()->FlushEvents(0, BTimedEventQueue::B_ALWAYS, true, BTimedEventQueue::B_HANDLE_BUFFER);
|
||||||
fCore->Lock();
|
fCore->Lock();
|
||||||
@@ -816,7 +816,7 @@ AudioMixer::HandleEvent(const media_timed_event *event, bigtime_t lateness, bool
|
|||||||
|
|
||||||
case BTimedEventQueue::B_DATA_STATUS:
|
case BTimedEventQueue::B_DATA_STATUS:
|
||||||
{
|
{
|
||||||
printf("DataStatus message\n");
|
ERROR("DataStatus message\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -840,7 +840,7 @@ AudioMixer::CreateBufferGroup()
|
|||||||
uint32 size = fCore->Output()->MediaOutput().format.u.raw_audio.buffer_size;
|
uint32 size = fCore->Output()->MediaOutput().format.u.raw_audio.buffer_size;
|
||||||
fCore->Unlock();
|
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);
|
return new BBufferGroup(size, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
|
|
||||||
#define DOUBLE_RATE_MIXING 0
|
#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
|
/* Mixer channels are identified by a type number, each type number corresponds
|
||||||
* to the one of the channel masks of enum media_multi_channels.
|
* to the one of the channel masks of enum media_multi_channels.
|
||||||
@@ -83,7 +87,10 @@ bool
|
|||||||
MixerCore::AddInput(const media_input &input)
|
MixerCore::AddInput(const media_input &input)
|
||||||
{
|
{
|
||||||
ASSERT_LOCKED();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,14 +173,14 @@ MixerCore::BufferReceived(BBuffer *buffer, bigtime_t lateness)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("MixerCore::BufferReceived: received buffer for unknown id %ld\n", id);
|
ERROR("MixerCore::BufferReceived: received buffer for unknown id %ld\n", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MixerCore::InputFormatChanged(int32 inputID, const media_multi_audio_format &format)
|
MixerCore::InputFormatChanged(int32 inputID, const media_multi_audio_format &format)
|
||||||
{
|
{
|
||||||
ASSERT_LOCKED();
|
ASSERT_LOCKED();
|
||||||
printf("MixerCore::InputFormatChanged not handled\n");
|
ERROR("MixerCore::InputFormatChanged not handled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -232,12 +239,12 @@ MixerCore::ApplyOutputFormat()
|
|||||||
for (int i = 0; i < fMixBufferChannelCount; i++)
|
for (int i = 0; i < fMixBufferChannelCount; i++)
|
||||||
fResampler[i] = new Resampler(media_raw_audio_format::B_AUDIO_FLOAT, format.format);
|
fResampler[i] = new Resampler(media_raw_audio_format::B_AUDIO_FLOAT, format.format);
|
||||||
|
|
||||||
printf("MixerCore::OutputFormatChanged:\n");
|
TRACE("MixerCore::OutputFormatChanged:\n");
|
||||||
printf(" fMixBufferFrameRate %ld\n", fMixBufferFrameRate);
|
TRACE(" fMixBufferFrameRate %ld\n", fMixBufferFrameRate);
|
||||||
printf(" fMixBufferFrameCount %ld\n", fMixBufferFrameCount);
|
TRACE(" fMixBufferFrameCount %ld\n", fMixBufferFrameCount);
|
||||||
printf(" fMixBufferChannelCount %ld\n", fMixBufferChannelCount);
|
TRACE(" fMixBufferChannelCount %ld\n", fMixBufferChannelCount);
|
||||||
for (int i = 0; i < fMixBufferChannelCount; i++)
|
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;
|
MixerInput *input;
|
||||||
for (int i = 0; (input = Input(i)); i++)
|
for (int i = 0; (input = Input(i)); i++)
|
||||||
@@ -263,14 +270,14 @@ MixerCore::SetTimingInfo(BTimeSource *ts, bigtime_t downstream_latency)
|
|||||||
fTimeSource = dynamic_cast<BTimeSource *>(ts->Acquire());
|
fTimeSource = dynamic_cast<BTimeSource *>(ts->Acquire());
|
||||||
fDownstreamLatency = downstream_latency;
|
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
|
void
|
||||||
MixerCore::EnableOutput(bool enabled)
|
MixerCore::EnableOutput(bool enabled)
|
||||||
{
|
{
|
||||||
ASSERT_LOCKED();
|
ASSERT_LOCKED();
|
||||||
printf("MixerCore::EnableOutput %d\n", enabled);
|
TRACE("MixerCore::EnableOutput %d\n", enabled);
|
||||||
fOutputEnabled = enabled;
|
fOutputEnabled = enabled;
|
||||||
|
|
||||||
if (fRunning && !fOutputEnabled)
|
if (fRunning && !fOutputEnabled)
|
||||||
@@ -291,7 +298,7 @@ bool
|
|||||||
MixerCore::Start()
|
MixerCore::Start()
|
||||||
{
|
{
|
||||||
ASSERT_LOCKED();
|
ASSERT_LOCKED();
|
||||||
printf("MixerCore::Start\n");
|
TRACE("MixerCore::Start\n");
|
||||||
if (fStarted)
|
if (fStarted)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -310,7 +317,7 @@ bool
|
|||||||
MixerCore::Stop()
|
MixerCore::Stop()
|
||||||
{
|
{
|
||||||
ASSERT_LOCKED();
|
ASSERT_LOCKED();
|
||||||
printf("MixerCore::Stop\n");
|
TRACE("MixerCore::Stop\n");
|
||||||
if (!fStarted)
|
if (!fStarted)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -384,8 +391,8 @@ MixerCore::MixThread()
|
|||||||
start = fTimeSource->Now();
|
start = fTimeSource->Now();
|
||||||
Unlock();
|
Unlock();
|
||||||
while (start <= 0) {
|
while (start <= 0) {
|
||||||
printf("MixerCore: delaying MixThread start, timesource is at %Ld\n", start);
|
TRACE("MixerCore: delaying MixThread start, timesource is at %Ld\n", start);
|
||||||
snooze(1000);
|
snooze(5000);
|
||||||
if (!LockFromMixThread())
|
if (!LockFromMixThread())
|
||||||
return;
|
return;
|
||||||
start = fTimeSource->Now();
|
start = fTimeSource->Now();
|
||||||
@@ -396,7 +403,7 @@ MixerCore::MixThread()
|
|||||||
return;
|
return;
|
||||||
latency = bigtime_t(0.4 * buffer_duration(fOutput->MediaOutput().format.u.raw_audio));
|
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.
|
/* 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);
|
time_base = duration_for_frames(fMixBufferFrameRate, frame_base);
|
||||||
Unlock();
|
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
|
#define MAX_TYPES 18
|
||||||
RtList<chan_info> InputChanInfos[MAX_TYPES];
|
RtList<chan_info> InputChanInfos[MAX_TYPES];
|
||||||
@@ -520,11 +527,11 @@ MixerCore::MixThread()
|
|||||||
|
|
||||||
// send the buffer
|
// send the buffer
|
||||||
if (B_OK != fNode->SendBuffer(buf, fOutput->MediaOutput().destination)) {
|
if (B_OK != fNode->SendBuffer(buf, fOutput->MediaOutput().destination)) {
|
||||||
printf("MixerCore: #### SendBuffer failed\n");
|
ERROR("MixerCore: SendBuffer failed\n");
|
||||||
buf->Recycle();
|
buf->Recycle();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("MixerCore: #### RequestBuffer failed\n");
|
ERROR("MixerCore: RequestBuffer failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// make all lists empty
|
// make all lists empty
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ MixerInput::BufferReceived(BBuffer *buffer)
|
|||||||
bigtime_t start;
|
bigtime_t start;
|
||||||
|
|
||||||
if (!fMixBuffer) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ MixerInput::BufferReceived(BBuffer *buffer)
|
|||||||
size = buffer->SizeUsed();
|
size = buffer->SizeUsed();
|
||||||
start = buffer->Header()->start_time;
|
start = buffer->Header()->start_time;
|
||||||
if (start < 0) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ MixerInput::UpdateChannelDesignations()
|
|||||||
if (fUserOverridesChannelDesignations)
|
if (fUserOverridesChannelDesignations)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("UpdateChannelDesignations: enter\n");
|
TRACE("UpdateChannelDesignations: enter\n");
|
||||||
|
|
||||||
// first apply a 1:1 mapping
|
// first apply a 1:1 mapping
|
||||||
for (int i = 0; i < fInputChannelCount; i++)
|
for (int i = 0; i < fInputChannelCount; i++)
|
||||||
@@ -323,9 +323,9 @@ MixerInput::UpdateChannelDesignations()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < fInputChannelCount; i++)
|
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
|
void
|
||||||
@@ -338,20 +338,20 @@ MixerInput::UpdateMixerChannels()
|
|||||||
mixer_chan_info *old_mixer_channel_info;
|
mixer_chan_info *old_mixer_channel_info;
|
||||||
uint32 old_mixer_channel_count;
|
uint32 old_mixer_channel_count;
|
||||||
|
|
||||||
printf("UpdateMixerChannels: enter\n");
|
TRACE("UpdateMixerChannels: enter\n");
|
||||||
|
|
||||||
for (int i = 0; i < fInputChannelCount; i++)
|
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;
|
all_bits = 0;
|
||||||
for (int i = 0; i < fInputChannelCount; i++)
|
for (int i = 0; i < fInputChannelCount; i++)
|
||||||
all_bits |= fInputChannelInfo[i].designations;
|
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);
|
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
|
// If we resize the channel info array, we preserve the gain setting
|
||||||
// by saving the old array until new assignments are finished, and
|
// by saving the old array until new assignments are finished, and
|
||||||
@@ -386,7 +386,7 @@ MixerInput::UpdateMixerChannels()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (j == fInputChannelCount) {
|
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;
|
fMixerChannelInfo[i].buffer_base = fMixBuffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -406,9 +406,9 @@ MixerInput::UpdateMixerChannels()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < fMixerChannelCount; i++)
|
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
|
uint32
|
||||||
@@ -438,7 +438,7 @@ MixerInput::GetMixerChannelGain(int channel)
|
|||||||
void
|
void
|
||||||
MixerInput::SetMixBufferFormat(int32 framerate, int32 frames)
|
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;
|
fMixBufferFrameRate = framerate;
|
||||||
debugMixBufferFrames = frames;
|
debugMixBufferFrames = frames;
|
||||||
@@ -467,10 +467,10 @@ MixerInput::SetMixBufferFormat(int32 framerate, int32 frames)
|
|||||||
int temp = frames_for_duration(framerate, mixerBufferLength);
|
int temp = frames_for_duration(framerate, mixerBufferLength);
|
||||||
fMixBufferFrameCount = ((temp / frames) + 1) * frames;
|
fMixBufferFrameCount = ((temp / frames) + 1) * frames;
|
||||||
|
|
||||||
printf(" inputBufferLength %10Ld\n", inputBufferLength);
|
TRACE(" inputBufferLength %10Ld\n", inputBufferLength);
|
||||||
printf(" outputBufferLength %10Ld\n", outputBufferLength);
|
TRACE(" outputBufferLength %10Ld\n", outputBufferLength);
|
||||||
printf(" mixerBufferLength %10Ld\n", mixerBufferLength);
|
TRACE(" mixerBufferLength %10Ld\n", mixerBufferLength);
|
||||||
printf(" fMixBufferFrameCount %10ld\n", fMixBufferFrameCount);
|
TRACE(" fMixBufferFrameCount %10ld\n", fMixBufferFrameCount);
|
||||||
|
|
||||||
ASSERT((fMixBufferFrameCount % frames) == 0);
|
ASSERT((fMixBufferFrameCount % frames) == 0);
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ MixerOutput::UpdateOutputChannels()
|
|||||||
delete [] oldInfo;
|
delete [] oldInfo;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < fOutputChannelCount; i++)
|
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
|
void
|
||||||
@@ -111,7 +111,7 @@ MixerOutput::AssignDefaultSources()
|
|||||||
if (count == 1 && mask & (B_CHANNEL_LEFT | B_CHANNEL_RIGHT)) {
|
if (count == 1 && mask & (B_CHANNEL_LEFT | B_CHANNEL_RIGHT)) {
|
||||||
// we have only one phycial output channel, and use it as a mix of
|
// we have only one phycial output channel, and use it as a mix of
|
||||||
// left, right, rear-left, rear-right, center and sub
|
// 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_count = 6;
|
||||||
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
||||||
fOutputChannelInfo[0].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_LEFT);
|
fOutputChannelInfo[0].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_LEFT);
|
||||||
@@ -127,7 +127,7 @@ MixerOutput::AssignDefaultSources()
|
|||||||
fOutputChannelInfo[0].source_type[5] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
fOutputChannelInfo[0].source_type[5] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||||
} else if (count == 2 && mask == (B_CHANNEL_LEFT | B_CHANNEL_RIGHT)) {
|
} else if (count == 2 && mask == (B_CHANNEL_LEFT | B_CHANNEL_RIGHT)) {
|
||||||
// we have have two phycial output channels
|
// we have have two phycial output channels
|
||||||
printf("AssignDefaultSources: 2 channel setup\n");
|
TRACE("AssignDefaultSources: 2 channel setup\n");
|
||||||
// left channel:
|
// left channel:
|
||||||
fOutputChannelInfo[0].source_count = 4;
|
fOutputChannelInfo[0].source_count = 4;
|
||||||
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
||||||
@@ -149,7 +149,7 @@ MixerOutput::AssignDefaultSources()
|
|||||||
fOutputChannelInfo[1].source_gain[3] = 0.6;
|
fOutputChannelInfo[1].source_gain[3] = 0.6;
|
||||||
fOutputChannelInfo[1].source_type[3] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
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)) {
|
} 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:
|
// left channel:
|
||||||
fOutputChannelInfo[0].source_count = 3;
|
fOutputChannelInfo[0].source_count = 3;
|
||||||
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
||||||
@@ -179,7 +179,7 @@ MixerOutput::AssignDefaultSources()
|
|||||||
fOutputChannelInfo[3].source_gain[1] = 0.6;
|
fOutputChannelInfo[3].source_gain[1] = 0.6;
|
||||||
fOutputChannelInfo[3].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
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)) {
|
} 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:
|
// left channel:
|
||||||
fOutputChannelInfo[0].source_count = 2;
|
fOutputChannelInfo[0].source_count = 2;
|
||||||
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
||||||
@@ -211,12 +211,12 @@ MixerOutput::AssignDefaultSources()
|
|||||||
fOutputChannelInfo[4].source_gain[1] = 0.5;
|
fOutputChannelInfo[4].source_gain[1] = 0.5;
|
||||||
fOutputChannelInfo[4].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
fOutputChannelInfo[4].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||||
} else {
|
} else {
|
||||||
printf("AssignDefaultSources: no default setup\n");
|
TRACE("AssignDefaultSources: no default setup\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < fOutputChannelCount; i++) {
|
for (int i = 0; i < fOutputChannelCount; i++) {
|
||||||
for (int j = 0; j < fOutputChannelInfo[i].source_count; j++) {
|
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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,22 +153,15 @@ uint32 ChannelTypeToChannelMask(int type)
|
|||||||
return 1 << type;
|
return 1 << type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
CopySamples(float *_dst, int32 _dst_sample_offset,
|
HasKawamba()
|
||||||
const float *_src, int32 _src_sample_offset,
|
|
||||||
int32 _sample_count)
|
|
||||||
{
|
{
|
||||||
ASSERT(sizeof(float) == sizeof(uint32));
|
team_info i;
|
||||||
register const char * src = (const char *) _src;
|
int32 c = 0;
|
||||||
register char * dst = (char *) _dst;
|
while (!get_next_team_info(&c, &i))
|
||||||
register int32 sample_count = _sample_count;
|
if (i.argc && strstr(i.args, "\x42\x65\x54\x75\x6e\x65\x73"))
|
||||||
register int32 dst_sample_offset = _dst_sample_offset;
|
return true;
|
||||||
register int32 src_sample_offset = _src_sample_offset;
|
return false;
|
||||||
while (sample_count--) {
|
|
||||||
*(uint32 *)dst = *(const uint32 *)src;
|
|
||||||
src += src_sample_offset;
|
|
||||||
dst += dst_sample_offset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ int count_nonzero_bits(uint32 value);
|
|||||||
|
|
||||||
uint32 GetChannelMask(int channel, uint32 all_channel_masks);
|
uint32 GetChannelMask(int channel, uint32 all_channel_masks);
|
||||||
|
|
||||||
void CopySamples(float *_dst, int32 _dst_sample_offset,
|
bool HasKawamba();
|
||||||
const float *_src, int32 _src_sample_offset,
|
|
||||||
int32 _sample_count);
|
|
||||||
|
|
||||||
void ZeroFill(float *_dst, int32 _dst_sample_offset, int32 _sample_count);
|
void ZeroFill(float *_dst, int32 _dst_sample_offset, int32 _sample_count);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user