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