added a dedicated mono channel type, allows nicer mapping of 1 channel input
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3821 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
69517c1537
commit
ab276ac888
@ -9,8 +9,11 @@ class MixerOutput;
|
||||
class Resampler;
|
||||
|
||||
// The number of "enum media_multi_channels" types from MediaDefs.h
|
||||
// XXX should be 18, currently limited to 9
|
||||
#define MAX_CHANNEL_TYPES 9
|
||||
// XXX should be 18, but limited to 12 here
|
||||
#define MAX_CHANNEL_TYPES 12
|
||||
// XXX using a dedicated mono channel, this should be channel type 31
|
||||
// but for now we redefine type 12
|
||||
#define B_CHANNEL_MONO B_CHANNEL_TOP_CENTER
|
||||
|
||||
class MixerCore
|
||||
{
|
||||
|
@ -311,13 +311,13 @@ MixerInput::UpdateInputChannelDestinationMask()
|
||||
|
||||
case 2:
|
||||
if (fInputChannelCount == 1 && (GetChannelMask(0, fInputChannelMask) & (B_CHANNEL_LEFT | B_CHANNEL_RIGHT))) {
|
||||
fInputChannelInfo[0].destination_mask = B_CHANNEL_LEFT | B_CHANNEL_RIGHT;
|
||||
fInputChannelInfo[0].destination_mask = B_CHANNEL_MONO;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (fInputChannelCount == 1 && (GetChannelMask(0, fInputChannelMask) & (B_CHANNEL_LEFT | B_CHANNEL_RIGHT))) {
|
||||
fInputChannelInfo[0].destination_mask = B_CHANNEL_LEFT | B_CHANNEL_RIGHT | B_CHANNEL_REARLEFT | B_CHANNEL_REARRIGHT;
|
||||
fInputChannelInfo[0].destination_mask = B_CHANNEL_MONO;
|
||||
}
|
||||
if (fInputChannelCount == 2 && (GetChannelMask(0, fInputChannelMask) & B_CHANNEL_LEFT)) {
|
||||
fInputChannelInfo[0].destination_mask = B_CHANNEL_LEFT | B_CHANNEL_REARLEFT;
|
||||
|
@ -120,7 +120,7 @@ MixerOutput::AssignDefaultSources()
|
||||
// we have only one phycial output channel, and use it as a mix of
|
||||
// left, right, rear-left, rear-right, center and sub
|
||||
TRACE("AssignDefaultSources: 1 channel setup\n");
|
||||
fOutputChannelInfo[0].source_count = 6;
|
||||
fOutputChannelInfo[0].source_count = 1;
|
||||
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[0].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_LEFT);
|
||||
fOutputChannelInfo[0].source_gain[1] = 1.0;
|
||||
@ -133,11 +133,13 @@ MixerOutput::AssignDefaultSources()
|
||||
fOutputChannelInfo[0].source_type[4] = ChannelMaskToChannelType(B_CHANNEL_CENTER);
|
||||
fOutputChannelInfo[0].source_gain[5] = 0.6;
|
||||
fOutputChannelInfo[0].source_type[5] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[0].source_gain[6] = 1.0;
|
||||
fOutputChannelInfo[0].source_type[6] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
} else if (count == 2 && mask == (B_CHANNEL_LEFT | B_CHANNEL_RIGHT)) {
|
||||
// we have have two phycial output channels
|
||||
TRACE("AssignDefaultSources: 2 channel setup\n");
|
||||
// left channel:
|
||||
fOutputChannelInfo[0].source_count = 4;
|
||||
fOutputChannelInfo[0].source_count = 5;
|
||||
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[0].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_LEFT);
|
||||
fOutputChannelInfo[0].source_gain[1] = 0.8;
|
||||
@ -146,8 +148,10 @@ MixerOutput::AssignDefaultSources()
|
||||
fOutputChannelInfo[0].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_CENTER);
|
||||
fOutputChannelInfo[0].source_gain[3] = 0.6;
|
||||
fOutputChannelInfo[0].source_type[3] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[0].source_gain[4] = 1.0;
|
||||
fOutputChannelInfo[0].source_type[4] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
// right channel:
|
||||
fOutputChannelInfo[1].source_count = 4;
|
||||
fOutputChannelInfo[1].source_count = 5;
|
||||
fOutputChannelInfo[1].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[1].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_RIGHT);
|
||||
fOutputChannelInfo[1].source_gain[1] = 0.8;
|
||||
@ -156,70 +160,102 @@ MixerOutput::AssignDefaultSources()
|
||||
fOutputChannelInfo[1].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_CENTER);
|
||||
fOutputChannelInfo[1].source_gain[3] = 0.6;
|
||||
fOutputChannelInfo[1].source_type[3] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[1].source_gain[4] = 1.0;
|
||||
fOutputChannelInfo[1].source_type[4] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
} else if (count == 4 && mask == (B_CHANNEL_LEFT | B_CHANNEL_RIGHT | B_CHANNEL_REARLEFT | B_CHANNEL_REARRIGHT)) {
|
||||
TRACE("AssignDefaultSources: 4 channel setup\n");
|
||||
// left channel:
|
||||
fOutputChannelInfo[0].source_count = 3;
|
||||
fOutputChannelInfo[0].source_count = 4;
|
||||
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[0].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_LEFT);
|
||||
fOutputChannelInfo[0].source_gain[1] = 0.7;
|
||||
fOutputChannelInfo[0].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_CENTER);
|
||||
fOutputChannelInfo[0].source_gain[2] = 0.6;
|
||||
fOutputChannelInfo[0].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[0].source_gain[3] = 1.0;
|
||||
fOutputChannelInfo[0].source_type[3] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
// right channel:
|
||||
fOutputChannelInfo[1].source_count = 3;
|
||||
fOutputChannelInfo[1].source_count = 4;
|
||||
fOutputChannelInfo[1].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[1].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_RIGHT);
|
||||
fOutputChannelInfo[1].source_gain[1] = 0.7;
|
||||
fOutputChannelInfo[1].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_CENTER);
|
||||
fOutputChannelInfo[1].source_gain[2] = 0.6;
|
||||
fOutputChannelInfo[1].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[1].source_gain[3] = 1.0;
|
||||
fOutputChannelInfo[1].source_type[3] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
// rear-left channel:
|
||||
fOutputChannelInfo[2].source_count = 2;
|
||||
fOutputChannelInfo[2].source_count = 3;
|
||||
fOutputChannelInfo[2].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[2].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_REARLEFT);
|
||||
fOutputChannelInfo[2].source_gain[1] = 0.6;
|
||||
fOutputChannelInfo[2].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[2].source_gain[2] = 0.9;
|
||||
fOutputChannelInfo[2].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
// rear-right channel:
|
||||
fOutputChannelInfo[3].source_count = 2;
|
||||
fOutputChannelInfo[3].source_count = 3;
|
||||
fOutputChannelInfo[3].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[3].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_REARRIGHT);
|
||||
fOutputChannelInfo[3].source_gain[1] = 0.6;
|
||||
fOutputChannelInfo[3].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[3].source_gain[2] = 0.9;
|
||||
fOutputChannelInfo[3].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
} else if (count == 5 && mask == (B_CHANNEL_LEFT | B_CHANNEL_RIGHT | B_CHANNEL_REARLEFT | B_CHANNEL_REARRIGHT | B_CHANNEL_CENTER)) {
|
||||
TRACE("AssignDefaultSources: 5 channel setup\n");
|
||||
// left channel:
|
||||
fOutputChannelInfo[0].source_count = 2;
|
||||
fOutputChannelInfo[0].source_count = 3;
|
||||
fOutputChannelInfo[0].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[0].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_LEFT);
|
||||
fOutputChannelInfo[0].source_gain[1] = 0.6;
|
||||
fOutputChannelInfo[0].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[0].source_gain[2] = 1.0;
|
||||
fOutputChannelInfo[0].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
// right channel:
|
||||
fOutputChannelInfo[1].source_count = 2;
|
||||
fOutputChannelInfo[1].source_count = 3;
|
||||
fOutputChannelInfo[1].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[1].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_RIGHT);
|
||||
fOutputChannelInfo[1].source_gain[1] = 0.6;
|
||||
fOutputChannelInfo[1].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[1].source_gain[2] = 1.0;
|
||||
fOutputChannelInfo[1].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
// rear-left channel:
|
||||
fOutputChannelInfo[2].source_count = 2;
|
||||
fOutputChannelInfo[2].source_count = 3;
|
||||
fOutputChannelInfo[2].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[2].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_REARLEFT);
|
||||
fOutputChannelInfo[2].source_gain[1] = 0.6;
|
||||
fOutputChannelInfo[2].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[2].source_gain[2] = 0.9;
|
||||
fOutputChannelInfo[2].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
// rear-right channel:
|
||||
fOutputChannelInfo[3].source_count = 2;
|
||||
fOutputChannelInfo[3].source_count = 3;
|
||||
fOutputChannelInfo[3].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[3].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_REARRIGHT);
|
||||
fOutputChannelInfo[3].source_gain[1] = 0.6;
|
||||
fOutputChannelInfo[3].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[3].source_gain[2] = 0.9;
|
||||
fOutputChannelInfo[3].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
// center channel:
|
||||
fOutputChannelInfo[4].source_count = 2;
|
||||
fOutputChannelInfo[4].source_count = 3;
|
||||
fOutputChannelInfo[4].source_gain[0] = 1.0;
|
||||
fOutputChannelInfo[4].source_type[0] = ChannelMaskToChannelType(B_CHANNEL_CENTER);
|
||||
fOutputChannelInfo[4].source_gain[1] = 0.5;
|
||||
fOutputChannelInfo[4].source_type[1] = ChannelMaskToChannelType(B_CHANNEL_SUB);
|
||||
fOutputChannelInfo[4].source_gain[2] = 0.8;
|
||||
fOutputChannelInfo[4].source_type[2] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
} else {
|
||||
TRACE("AssignDefaultSources: no default setup\n");
|
||||
TRACE("AssignDefaultSources: no default setup, adding mono channel to first two channels\n");
|
||||
if (count >= 1) {
|
||||
// this is not a left channel, but we add the mono channel anyway
|
||||
fOutputChannelInfo[0].source_gain[fOutputChannelInfo[0].source_count] = 1.0;
|
||||
fOutputChannelInfo[0].source_type[fOutputChannelInfo[0].source_count] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
fOutputChannelInfo[0].source_count++;
|
||||
}
|
||||
if (count >= 2) {
|
||||
// this is not a right channel, but we add the mono channel anyway
|
||||
fOutputChannelInfo[1].source_gain[fOutputChannelInfo[1].source_count] = 1.0;
|
||||
fOutputChannelInfo[1].source_type[fOutputChannelInfo[1].source_count] = ChannelMaskToChannelType(B_CHANNEL_MONO);
|
||||
fOutputChannelInfo[1].source_count++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < fOutputChannelCount; i++) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "MixerUtils.h"
|
||||
#include "MixerInput.h"
|
||||
#include "MixerOutput.h"
|
||||
#include "MixerCore.h"
|
||||
#include "debug.h"
|
||||
|
||||
const char *StringForFormat(char *str, const media_format & format);
|
||||
@ -31,13 +32,15 @@ StringForChannelMask(char *str, uint32 mask)
|
||||
DECODE(B_CHANNEL_BACK_CENTER, "Back-Center");
|
||||
DECODE(B_CHANNEL_SIDE_LEFT, "Side-Left");
|
||||
DECODE(B_CHANNEL_SIDE_RIGHT, "Side-Right");
|
||||
DECODE(B_CHANNEL_TOP_CENTER, "Top-Center");
|
||||
// XXX disabled for mono workaround
|
||||
// DECODE(B_CHANNEL_TOP_CENTER, "Top-Center");
|
||||
DECODE(B_CHANNEL_TOP_FRONT_LEFT, "Top-Front-Left");
|
||||
DECODE(B_CHANNEL_TOP_FRONT_CENTER, "Top-Front-Center");
|
||||
DECODE(B_CHANNEL_TOP_FRONT_RIGHT, "Top-Front-Right");
|
||||
DECODE(B_CHANNEL_TOP_BACK_LEFT, "Top-Back-Left");
|
||||
DECODE(B_CHANNEL_TOP_BACK_CENTER, "Top-Back-Center");
|
||||
DECODE(B_CHANNEL_TOP_BACK_RIGHT, "Top-Back-Right");
|
||||
DECODE(B_CHANNEL_MONO, "Mono");
|
||||
#undef DECODE
|
||||
if (mask)
|
||||
sprintf(str + strlen(str), "0x%08X", mask);
|
||||
|
Loading…
Reference in New Issue
Block a user