1 | //channels.h: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010 |
---|
5 | * |
---|
6 | * This file is part of libroar a part of RoarAudio, |
---|
7 | * a cross-platform sound system for both, home and professional use. |
---|
8 | * See README for details. |
---|
9 | * |
---|
10 | * This file is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU General Public License version 3 |
---|
12 | * as published by the Free Software Foundation. |
---|
13 | * |
---|
14 | * libroar is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this software; see the file COPYING. If not, write to |
---|
21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
22 | * Boston, MA 02110-1301, USA. |
---|
23 | * |
---|
24 | * NOTE for everyone want's to change something and send patches: |
---|
25 | * read README and HACKING! There a addition information on |
---|
26 | * the license of this document you need to read before you send |
---|
27 | * any patches. |
---|
28 | * |
---|
29 | * NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc |
---|
30 | * or libpulse*: |
---|
31 | * The libs libroaresd, libroararts and libroarpulse link this lib |
---|
32 | * and are therefore GPL. Because of this it may be illigal to use |
---|
33 | * them with any software that uses libesd, libartsc or libpulse*. |
---|
34 | */ |
---|
35 | |
---|
36 | #ifndef _LIBROARDSP_CHANNELS_H_ |
---|
37 | #define _LIBROARDSP_CHANNELS_H_ |
---|
38 | |
---|
39 | #include "libroardsp.h" |
---|
40 | |
---|
41 | /* Channel map: |
---|
42 | * Standard marix: |
---|
43 | * |
---|
44 | * # Left | Center | Right # |
---|
45 | * ======#============#==============#=============# |
---|
46 | * Front # FRONT_LEFT | FRONT_CENTER | FRONT_RIGHT # |
---|
47 | * # LEFT | CENTER/MONO | RIGHT # |
---|
48 | * ------#------------+--------------+-------------# |
---|
49 | * Side # SIDE_LEFT | SIDE_CENTER$ | SIDE_RIGH # |
---|
50 | * ------#------------+--------------+-------------# |
---|
51 | * Back # BACK_LEFT | BACK_CENTER | BACK_RIGHT # |
---|
52 | * ======#============#==============#=============# |
---|
53 | * $ = Side Center has null-vector possion and because of this |
---|
54 | * arg(Pos) is undefined. This means that the channel does |
---|
55 | * not have a defined phase and therefor does can not exist. |
---|
56 | * we include it just to have the matrix complet. |
---|
57 | * |
---|
58 | * |
---|
59 | * Low Frequency Effects: |
---|
60 | * |
---|
61 | * LFE is location independ. |
---|
62 | * |
---|
63 | * |
---|
64 | * Mid-Side (MS): |
---|
65 | * |
---|
66 | * Mid = Left + Right |
---|
67 | * Side = Left - Right |
---|
68 | * Left = (Mid + Side) / 2 |
---|
69 | * Right = (Mid - Side) / 2 |
---|
70 | * |
---|
71 | */ |
---|
72 | |
---|
73 | #define ROARDSP_CHAN_EOL -1 |
---|
74 | #define ROARDSP_CHAN_NONE 0 |
---|
75 | #define ROARDSP_CHAN_FRONT_LEFT 1 |
---|
76 | #define ROARDSP_CHAN_FRONT_RIGHT 2 |
---|
77 | #define ROARDSP_CHAN_SIDE_LEFT 3 |
---|
78 | #define ROARDSP_CHAN_SIDE_RIGHT 4 |
---|
79 | #define ROARDSP_CHAN_BACK_LEFT 5 |
---|
80 | #define ROARDSP_CHAN_BACK_RIGHT 6 |
---|
81 | #define ROARDSP_CHAN_FRONT_CENTER 7 |
---|
82 | #define ROARDSP_CHAN_SIDE_CENTER 8 |
---|
83 | #define ROARDSP_CHAN_BACK_CENTER 9 |
---|
84 | |
---|
85 | #define ROARDSP_CHAN_LEFT ROARDSP_CHAN_FRONT_LEFT |
---|
86 | #define ROARDSP_CHAN_RIGHT ROARDSP_CHAN_FRONT_RIGHT |
---|
87 | #define ROARDSP_CHAN_CENTER ROARDSP_CHAN_FRONT_CENTER |
---|
88 | #define ROARDSP_CHAN_MONO ROARDSP_CHAN_CENTER |
---|
89 | |
---|
90 | #define ROARDSP_CHAN_MS_MID 10 |
---|
91 | #define ROARDSP_CHAN_MS_SIDE 11 |
---|
92 | |
---|
93 | #define ROARDSP_CHAN_LFE 12 |
---|
94 | |
---|
95 | // MIDI Channels: |
---|
96 | #define ROARDSP_CHAN_MIDI0 64 |
---|
97 | #define ROARDSP_CHAN_MIDI1 65 |
---|
98 | #define ROARDSP_CHAN_MIDI2 66 |
---|
99 | #define ROARDSP_CHAN_MIDI3 67 |
---|
100 | #define ROARDSP_CHAN_MIDI4 68 |
---|
101 | #define ROARDSP_CHAN_MIDI5 69 |
---|
102 | #define ROARDSP_CHAN_MIDI6 70 |
---|
103 | #define ROARDSP_CHAN_MIDI7 71 |
---|
104 | #define ROARDSP_CHAN_MIDI8 72 |
---|
105 | #define ROARDSP_CHAN_MIDI9 73 |
---|
106 | #define ROARDSP_CHAN_MIDI10 74 |
---|
107 | #define ROARDSP_CHAN_MIDI11 75 |
---|
108 | #define ROARDSP_CHAN_MIDI12 76 |
---|
109 | #define ROARDSP_CHAN_MIDI13 77 |
---|
110 | #define ROARDSP_CHAN_MIDI14 78 |
---|
111 | #define ROARDSP_CHAN_MIDI15 79 |
---|
112 | |
---|
113 | #define ROARDSP_CHANLIST_MAP_ROARAUDIO 0 |
---|
114 | #define ROARDSP_CHANLIST_MAP_VORBIS 1 |
---|
115 | #define ROARDSP_CHANLIST_MAP_FLAC 2 |
---|
116 | #define ROARDSP_CHANLIST_MAP_RIFF_WAVE 3 |
---|
117 | #define ROARDSP_CHANLIST_MAP_OSS 4 |
---|
118 | #define ROARDSP_CHANLIST_MAP_ALSA 5 |
---|
119 | #define ROARDSP_CHANLIST_MAP_ESD 6 |
---|
120 | #define ROARDSP_CHANLIST_MAP_MIDI 7 |
---|
121 | |
---|
122 | #define ROARDSP_CHANMAP_IN 0 |
---|
123 | #define ROARDSP_CHANMAP_OUT 1 |
---|
124 | #define ROARDSP_CHANMAP_MAP 2 |
---|
125 | #define ROARDSP_CHANMAP_INVMAP 3 |
---|
126 | |
---|
127 | struct roardsp_chanmap { |
---|
128 | char in [ROAR_MAX_CHANNELS]; |
---|
129 | char out[ROAR_MAX_CHANNELS]; |
---|
130 | char map[ROAR_MAX_CHANNELS]; |
---|
131 | }; |
---|
132 | |
---|
133 | char * roardsp_chan2str (int chan); |
---|
134 | int roardsp_str2chan(char * str); |
---|
135 | |
---|
136 | int roardsp_chanlist2str(char * list, size_t len, char * str, size_t strlen); |
---|
137 | |
---|
138 | int roardsp_chanlist_init(char * list, int channels, int map); |
---|
139 | |
---|
140 | int roardsp_chanmap_calc(struct roardsp_chanmap * map, int what, int err_on_none); |
---|
141 | |
---|
142 | int roardsp_chanmap_mappcm8 (char * out, char * in, size_t len, size_t chans, struct roardsp_chanmap * map); |
---|
143 | int roardsp_chanmap_mappcm16(int16_t * out, int16_t * in, size_t len, size_t chans, struct roardsp_chanmap * map); |
---|
144 | int roardsp_chanmap_mappcm24(void * out, void * in, size_t len, size_t chans, struct roardsp_chanmap * map); |
---|
145 | int roardsp_chanmap_mappcm32(int32_t * out, int32_t * in, size_t len, size_t chans, struct roardsp_chanmap * map); |
---|
146 | int roardsp_chanmap_mappcm (void * out, void * in, size_t len, size_t chans, struct roardsp_chanmap * map, int bits); |
---|
147 | |
---|
148 | #endif |
---|
149 | |
---|
150 | //ll |
---|