4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #define MAXCHANNELS 32
24 #define MAX_CHANNELS 32
26 static inline int default_audio_channel_position(int channel, int total_channels)
28 int default_position = 0;
29 switch( total_channels ) {
31 case 1: switch( channel ) {
32 case 0: default_position = 90; break;
35 case 2: switch( channel ) {
36 case 0: default_position = 180; break;
37 case 1: default_position = 0; break;
40 case 6: switch( channel ) {
41 case 0: default_position = 150; break;
42 case 1: default_position = 30; break;
43 case 2: default_position = 90; break;
44 case 3: default_position = 270; break;
45 case 4: default_position = 210; break;
46 case 5: default_position = 330; break;
50 default_position = 180 - (360 * channel / total_channels);
51 while( default_position < 0 ) default_position += 360;
54 return default_position;