a minor performance improvement
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3759 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -212,6 +212,7 @@ MixerCore::ApplyOutputFormat()
|
|||||||
fMixBufferFrameCount *= 2;
|
fMixBufferFrameCount *= 2;
|
||||||
}
|
}
|
||||||
fMixBufferChannelCount = format.channel_count;
|
fMixBufferChannelCount = format.channel_count;
|
||||||
|
ASSERT(fMixBufferChannelCount == fOutput->GetOutputChannelCount());
|
||||||
fMixBufferChannelTypes = new int32 [format.channel_count];
|
fMixBufferChannelTypes = new int32 [format.channel_count];
|
||||||
|
|
||||||
for (int i = 0; i < fMixBufferChannelCount; i++)
|
for (int i = 0; i < fMixBufferChannelCount; i++)
|
||||||
@@ -453,17 +454,16 @@ MixerCore::MixThread()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = fOutput->GetOutputChannelCount();
|
for (int chan = 0; chan < fMixBufferChannelCount; chan++) {
|
||||||
for (int chan = 0; chan < count; chan++) {
|
int sourcecount = fOutput->GetOutputChannelSourceCount(chan);
|
||||||
int count2 = fOutput->GetOutputChannelSourceCount(chan);
|
for (int i = 0; i < sourcecount; i++) {
|
||||||
for (int i = 0; i < count2; i++) {
|
|
||||||
int type;
|
int type;
|
||||||
float gain;
|
float gain;
|
||||||
fOutput->GetMixerChannelInfo(chan, i, &type, &gain);
|
fOutput->GetMixerChannelInfo(chan, i, &type, &gain);
|
||||||
if (type < 0 || type >= MAX_TYPES)
|
if (type < 0 || type >= MAX_TYPES)
|
||||||
continue;
|
continue;
|
||||||
int count3 = InputChanInfos[type].CountItems();
|
int count = InputChanInfos[type].CountItems();
|
||||||
for (int j = 0; j < count3; j++) {
|
for (int j = 0; j < count; j++) {
|
||||||
chan_info *info = InputChanInfos[type].ItemAt(j);
|
chan_info *info = InputChanInfos[type].ItemAt(j);
|
||||||
chan_info *newinfo = MixChanInfos[chan].Create();
|
chan_info *newinfo = MixChanInfos[chan].Create();
|
||||||
newinfo->base = info->base;
|
newinfo->base = info->base;
|
||||||
@@ -475,12 +475,11 @@ MixerCore::MixThread()
|
|||||||
|
|
||||||
uint32 dst_sample_offset = fMixBufferChannelCount * sizeof(float);
|
uint32 dst_sample_offset = fMixBufferChannelCount * sizeof(float);
|
||||||
|
|
||||||
count = fOutput->GetOutputChannelCount();
|
memset(fMixBuffer, 0, fMixBufferChannelCount * fMixBufferFrameCount * sizeof(float));
|
||||||
for (int chan = 0; chan < count; chan++) {
|
for (int chan = 0; chan < fMixBufferChannelCount; chan++) {
|
||||||
PRINT(5, "MixThread: chan %d has %d sources\n", chan, MixChanInfos[chan].CountItems());
|
PRINT(5, "MixThread: chan %d has %d sources\n", chan, MixChanInfos[chan].CountItems());
|
||||||
ZeroFill(&fMixBuffer[chan], dst_sample_offset, fMixBufferFrameCount);
|
int count = MixChanInfos[chan].CountItems();
|
||||||
int count2 = MixChanInfos[chan].CountItems();
|
for (int i = 0; i < count; i++) {
|
||||||
for (int i = 0; i < count2; i++) {
|
|
||||||
chan_info *info = MixChanInfos[chan].ItemAt(i);
|
chan_info *info = MixChanInfos[chan].ItemAt(i);
|
||||||
char *dst = (char *)&fMixBuffer[chan];
|
char *dst = (char *)&fMixBuffer[chan];
|
||||||
PRINT(5, "MixThread: base %p, sample-offset %2d, gain %.3f\n", info->base, info->sample_offset, info->gain);
|
PRINT(5, "MixThread: base %p, sample-offset %2d, gain %.3f\n", info->base, info->sample_offset, info->gain);
|
||||||
@@ -507,7 +506,7 @@ MixerCore::MixThread()
|
|||||||
frames_per_buffer(fOutput->MediaOutput().format.u.raw_audio),
|
frames_per_buffer(fOutput->MediaOutput().format.u.raw_audio),
|
||||||
1.0);
|
1.0);
|
||||||
}
|
}
|
||||||
PRINT(4, "send buffer, inframes %ld, outframes %ld\n",fMixBufferFrameCount, frames_per_buffer(fOutput->MediaOutput().format.u.raw_audio));
|
PRINT(4, "send buffer, inframes %ld, outframes %ld\n", fMixBufferFrameCount, frames_per_buffer(fOutput->MediaOutput().format.u.raw_audio));
|
||||||
|
|
||||||
// swap byte order if necessary
|
// swap byte order if necessary
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user