1 // **************************************************************************** 2 // 3 // MixerXface.H 4 // 5 // Include file for mixer interfacing with the EchoGals-derived classes. 6 // 7 // Set editor tabs to 3 for your viewing pleasure. 8 // 9 // ---------------------------------------------------------------------------- 10 // 11 // Copyright Echo Digital Audio Corporation (c) 1998 - 2002 12 // All rights reserved 13 // www.echoaudio.com 14 // 15 // Permission is hereby granted, free of charge, to any person obtaining a 16 // copy of this software and associated documentation files (the 17 // "Software"), to deal with the Software without restriction, including 18 // without limitation the rights to use, copy, modify, merge, publish, 19 // distribute, sublicense, and/or sell copies of the Software, and to 20 // permit persons to whom the Software is furnished to do so, subject to 21 // the following conditions: 22 // 23 // - Redistributions of source code must retain the above copyright 24 // notice, this list of conditions and the following disclaimers. 25 // 26 // - Redistributions in binary form must reproduce the above copyright 27 // notice, this list of conditions and the following disclaimers in the 28 // documentation and/or other materials provided with the distribution. 29 // 30 // - Neither the name of Echo Digital Audio, nor the names of its 31 // contributors may be used to endorse or promote products derived from 32 // this Software without specific prior written permission. 33 // 34 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 35 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 36 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 37 // IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR 38 // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 39 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 40 // SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. 41 // 42 // **************************************************************************** 43 44 // Prevent problems with multiple includes 45 #ifndef _MIXERXFACE_ 46 #define _MIXERXFACE_ 47 48 #include "EchoGalsXface.h" 49 50 // 51 // Gain ranges 52 // 53 #define ECHOGAIN_MUTED DSP_TO_GENERIC(-128) // Minimum possible gain 54 #define ECHOGAIN_MINOUT DSP_TO_GENERIC(-128) // Min output gain in dB 55 #define ECHOGAIN_MAXOUT DSP_TO_GENERIC(6) // Max output gain in dB 56 #define ECHOGAIN_MININP DSP_TO_GENERIC(-25) // Min input gain in dB 57 #define ECHOGAIN_MAXINP DSP_TO_GENERIC(25) // Max input gain in dB 58 59 #define ECHOGAIN_UPDATE 0xAAAAAA // Using this value means: 60 // Re-set the gain 61 // to the DSP using the 62 // currently stored value. 63 64 65 //============================================================================= 66 // 67 // Most of the mixer functions have been unified into a single interface; 68 // you pass either a single MIXER_FUNCTION struct or an array of MIXER_FUNCTION 69 // structs. Each MIXER_FUNCTION is generally used to set or get one or more 70 // values. 71 // 72 //============================================================================= 73 74 // 75 // Structure to specify a bus, pipe, or a monitor being routed from 76 // the input to the output 77 // 78 enum ECHO_CHANNEL_TYPES 79 { 80 ECHO_BUS_OUT = 0, 81 ECHO_BUS_IN, 82 ECHO_PIPE_OUT, 83 ECHO_PIPE_IN, 84 ECHO_MONITOR, 85 ECHO_NO_CHANNEL_TYPE = 0xffff, 86 ECHO_CHANNEL_UNUSED = 0xffff 87 }; 88 89 typedef struct tMIXER_AUDIO_CHANNEL 90 { 91 WORD wCardId; // This field is obsolete 92 WORD wChannel; // channel index 93 DWORD dwType; // One of the above enums 94 } MIXER_AUDIO_CHANNEL, *PMIXER_AUDIO_CHANNEL; 95 96 97 // 98 // Output pipe control change 99 // 100 typedef struct 101 { 102 WORD wBusOut; // For cards without vmixer, should 103 // be the same as wChannel in MIXER_AUDIO_CHANNEL 104 union 105 { 106 INT32 iLevel; // New gain in dB X 256 107 INT32 iPan; // 0 <= new pan <= MAX_MIXER_PAN, 108 // 0 = full left MAX_MIXER_PAN = full right 109 BOOL bMuteOn; // To mute or not to mute 110 // MXF_GET_MONITOR_MUTE & 111 // MXF_SET_MONITOR_MUTE 112 113 } Data; 114 } MIXER_PIPE_OUT, PMIXER_PIPE_OUT; 115 116 117 // 118 // The MIXER_AUDIO_CHANNEL header has the card and input channel. 119 // This structure has the output channel and the gain, mute or pan 120 // state for one monitor. 121 // 122 typedef struct tMIXER_MONITOR 123 { 124 WORD wBusOut; 125 union 126 { 127 INT32 iLevel; // New gain in dB X 256 128 INT32 iPan; // 0 <= new pan <= MAX_MIXER_PAN, 129 // 0 = full left MAX_MIXER_PAN = full right 130 BOOL bMuteOn; // To mute or not to mute 131 // MXF_GET_MONITOR_MUTE & 132 // MXF_SET_MONITOR_MUTE 133 } Data; 134 } MIXER_MONITOR, *PMIXER_MONITOR; 135 136 137 // 138 // Mixer Function Tags 139 // 140 // These codes are used to specify the mixer function you want to perform; 141 // they determine which field in the Data union to use 142 // 143 #define MXF_GET_CAPS 1 // Get card capabilities 144 #define MXF_GET_LEVEL 2 // Get level for one channel 145 #define MXF_SET_LEVEL 3 // Set level for one channel 146 #define MXF_GET_NOMINAL 4 // Get nominal level for one channel 147 #define MXF_SET_NOMINAL 5 // Set nominal level for one channel 148 #define MXF_GET_MONITOR 6 // Get monitor for one channel 149 #define MXF_SET_MONITOR 7 // Set monitor for one channel 150 #define MXF_GET_INPUT_CLOCK 8 // Get input clock 151 #define MXF_SET_INPUT_CLOCK 9 // Set input clock for one card 152 #define MXF_GET_METERS 10 // Get meters for all channels on one card 153 #define MXF_GET_METERS_ON 11 // Get meters on state for one card 154 #define MXF_SET_METERS_ON 12 // Set meters on state for one card 155 // Meters must only be enabled while 156 // driver for card exists; the meters are 157 // written via bus mastering directly to memory 158 #define MXF_GET_PROF_SPDIF 13 // Get Professional or consumer S/PDIF mode 159 // for one card 160 #define MXF_SET_PROF_SPDIF 14 // Set Professional or consumer S/PDIF mode 161 // for one card 162 #define MXF_GET_MUTE 15 // Get mute state for one channel 163 #define MXF_SET_MUTE 16 // Set mute state for one channel 164 #define MXF_GET_MONITOR_MUTE 19 // Get monitor mute state for one channel 165 #define MXF_SET_MONITOR_MUTE 20 // Set monitor mute state for one channel 166 #define MXF_GET_MONITOR_PAN 23 // Get monitor pan value for one stereo channel 167 #define MXF_SET_MONITOR_PAN 24 // Set monitor pan value for one stereo channel 168 #define MXF_GET_FLAGS 27 // Get driver flags. i.e. S/PDIF no 169 // dither mode 170 #define MXF_SET_FLAGS 28 // Set driver flag. i.e. S/PDIF no 171 // dither mode 172 #define MXF_CLEAR_FLAGS 29 // Clear driver flag. i.e. S/PDIF no 173 // dither mode for one card 174 #define MXF_GET_SAMPLERATE_LOCK 30 // Get locked sample rate for one card 175 #define MXF_SET_SAMPLERATE_LOCK 31 // Set locked sample rate for one card 176 #define MXF_GET_SAMPLERATE 32 // Get actual sample rate for one card 177 #define MXF_GET_MIDI_IN_ACTIVITY 35 // Get MIDI in activity state 178 #define MXF_GET_MIDI_OUT_ACTIVITY 36 // Get MIDI out activity state 179 #define MXF_GET_DIGITAL_MODE 37 // Get digital mode 180 #define MXF_SET_DIGITAL_MODE 38 // Get digital mode 181 182 #define MXF_GET_PAN 39 // Get & set pan 183 #define MXF_SET_PAN 40 184 #define MXF_GET_OUTPUT_CLOCK 41 // Get output clock 185 #define MXF_SET_OUTPUT_CLOCK 42 // Set output clock for one card 186 #define MXF_GET_CLOCK_DETECT 43 // Get the currently detected clocks 187 #define MXF_GET_DIG_IN_AUTO_MUTE 44 // Get the state of the digital input auto-mute 188 #define MXF_SET_DIG_IN_AUTO_MUTE 45 // Set the state of the digital input auto-mute 189 190 // 191 // Mixer Function Data Structure 192 // 193 typedef struct tMIXER_FUNCTION 194 { 195 MIXER_AUDIO_CHANNEL Channel; // Which channel to service 196 INT32 iFunction; // What function to do 197 ECHOSTATUS RtnStatus; // Return Result 198 union 199 { 200 ECHOGALS_CAPS Capabilities; // MXF_GET_CAPS 201 INT32 iNominal; // MXF_GET_NOMINAL & MXF_SET_NOMINAL 202 INT32 iLevel; // MXF_GET_LEVEL & MXF_SET_LEVEL 203 MIXER_MONITOR Monitor; // MXF_GET_MONITOR & MXF_SET_MONITOR 204 // MXF_GET_MONITOR_MUTE & MXF_SET_MONITOR_MUTE 205 // MXF_GET_MONITOR_PAN & MXF_SET_MONITOR_PAN 206 WORD wClock; // MXF_GET_INPUT_CLOCK & MXF_SET_INPUT_CLOCK 207 // MXF_GET_OUTPUT_CLOCK & MXF_SET_OUTPUT_CLOCK 208 DWORD dwClockDetectBits; 209 // MXF_GET_CLOCK_DETECTs 210 ECHOGALS_METERS Meters; // MXF_GET_METERS 211 BOOL bMetersOn; // MXF_GET_METERS_ON & 212 // MXF_SET_METERS_ON 213 BOOL bProfSpdif; // MXF_GET_PROF_SPDIF & 214 // MXF_SET_PROF_SPDIF 215 BOOL bMuteOn; // MXF_GET_MUTE & MXF_SET_MUTE 216 BOOL bNotifyOn; // MXF_GET_NOTIFY_ON & 217 // MXF_SET_NOTIFY_ON 218 WORD wFlags; // MXF_GET_FLAGS, MXF_SET_FLAGS & 219 // MXF_CLEAR_FLAGS (See 220 // ECHOGALS_FLAG_??? in file 221 // EchoGalsXface.h) 222 DWORD dwLockedSampleRate; 223 // MXF_GET_SAMPLERATE_LOCK & 224 // MXF_SET_SAMPLERATE_LOCK 225 DWORD dwSampleRate; // MXF_GET_SAMPLERATE 226 BOOL bMidiActive; // MXF_GET_MIDI_IN_ACTIVITY & 227 // MXF_GET_MIDI_OUT_ACTIVITY 228 INT32 iDigMode; // MXF_GET_DIGITAL_MODE & 229 // MXF_SET_DIGITAL_MODE 230 231 MIXER_PIPE_OUT PipeOut; // MXF_GET_LEVEL & MXF_SET_LEVEL 232 // MXF_GET_MUTE & MXF_SET_MUTE 233 // MXF_GET_PAN & MXF_SET_PAN 234 235 BOOL fDigitalInAutoMute; // MXF_GET_DIG_IN_AUTO_MUTE 236 // MXF_SET_DIG_IN_AUTO_MUTE 237 } Data; 238 } MIXER_FUNCTION, *PMIXER_FUNCTION; 239 240 // 241 // Mixer Multifunction Interface 242 // 243 // Allow user to supply an array of commands to be performed in one call. 244 // Since this is a variable length structure, user beware! 245 // 246 typedef struct tMIXER_MULTI_FUNCTION 247 { 248 INT32 iCount; 249 MIXER_FUNCTION MixerFunction[ 1 ]; 250 } MIXER_MULTI_FUNCTION, *PMIXER_MULTI_FUNCTION; 251 252 // 253 // Use this macro to size the data structure 254 // 255 #define ComputeMixerMultiFunctionSize(Ct) \ 256 ( sizeof( MIXER_MULTI_FUNCTION ) + ( sizeof( MIXER_FUNCTION ) * ( Ct - 1 ) ) ) 257 258 259 // 260 // Notification 261 // 262 // Mixers allow for notification whenever a change occurs. 263 // Mixer notify structure contains channel and parameter(s) that 264 // changed. 265 // 266 267 // 268 // Mixer Parameter Changed definitions 269 // 270 #define MXN_LEVEL 0 // Level changed 271 #define MXN_NOMINAL 1 // Nominal level changed 272 #define MXN_INPUT_CLOCK 2 // Input clock changed 273 #define MXN_SPDIF 3 // S/PDIF - Professional mode changed 274 #define MXN_MUTE 4 // Mute state changed 275 #define MXN_PAN 6 // Pan value changed 276 277 #define MXN_FLAGS 12 // A driver flag changed. I.E. 278 // S/PDIF no dither state changed 279 #define MXN_DIGITAL_MODE 14 // Digital mode changed 280 #define MXN_OUTPUT_CLOCK 15 // Output clock changed 281 #define MXN_MAX 15 // Max notify parameters 282 283 typedef struct tMIXER_NOTIFY 284 { 285 WORD wType; // Same as enums used for MIXER_AUDIO_CHANNEL 286 287 union 288 { 289 WORD wBusIn; 290 WORD wPipeIn; 291 WORD wPipeOut; 292 } u; 293 294 WORD wBusOut; // For monitor & output pipe notifies only 295 WORD wParameter; // One of the above MXN_* 296 297 } MIXER_NOTIFY, *PMIXER_NOTIFY; 298 299 300 typedef struct tMIXER_MULTI_NOTIFY 301 { 302 DWORD dwCookie; 303 DWORD dwCount; // When passed to the generic driver, 304 // dwCount holds the size of the Notifies array. 305 // On returning from the driver, dwCount 306 // holds the number of entries in Notifies 307 // filled out by the generic driver. 308 MIXER_NOTIFY Notifies[1]; // Dynamic array; there are dwCount entries 309 } MIXER_MULTI_NOTIFY, *PMIXER_MULTI_NOTIFY; 310 311 // 312 // Max pan value 313 // 314 #define MAX_MIXER_PAN 1000 // this is pan hard right 315 316 317 //============================================================================= 318 // 319 // After designing eighteen or nineteen consoles for this hardware, we've 320 // learned that it's useful to be able to get all the following stuff at 321 // once. Typically the console will run a timer that fetchs this periodically. 322 // 323 // dwCookie is the unique ID for the mixer client; this is obtained by calling 324 // CEchoGals::OpenMixer. The generic driver will maintain a separate notify 325 // queue for each client. 326 // 327 // Meters and dwClockDetectBits are exactly the same as you would get if you 328 // did each of those mixer functions separately. 329 // 330 // dwNumPendingNotifies is how many notifies are in the queue associated with 331 // the cookie. You can use this number to create an array of MIXER_NOTIFY 332 // structures and call CEchoGals::GetControlChanges. This way you only check 333 // for control changes if the controls have actually changed. 334 // 335 //============================================================================= 336 337 typedef struct tECHO_POLLED_STUFF 338 { 339 DWORD dwCookie; 340 ECHOGALS_METERS Meters; 341 DWORD dwClockDetectBits; 342 DWORD dwNumPendingNotifies; 343 } ECHO_POLLED_STUFF; 344 345 346 #endif 347 348 // MixerXface.h 349