1*3895766dSshatty // **************************************************************************** 2*3895766dSshatty // 3*3895766dSshatty // CDspCommObject.H 4*3895766dSshatty // 5*3895766dSshatty // Include file for EchoGals generic driver DSP interface base class. 6*3895766dSshatty // 7*3895766dSshatty // ---------------------------------------------------------------------------- 8*3895766dSshatty // 9*3895766dSshatty // Copyright Echo Digital Audio Corporation (c) 1998 - 2002 10*3895766dSshatty // All rights reserved 11*3895766dSshatty // www.echoaudio.com 12*3895766dSshatty // 13*3895766dSshatty // Permission is hereby granted, free of charge, to any person obtaining a 14*3895766dSshatty // copy of this software and associated documentation files (the 15*3895766dSshatty // "Software"), to deal with the Software without restriction, including 16*3895766dSshatty // without limitation the rights to use, copy, modify, merge, publish, 17*3895766dSshatty // distribute, sublicense, and/or sell copies of the Software, and to 18*3895766dSshatty // permit persons to whom the Software is furnished to do so, subject to 19*3895766dSshatty // the following conditions: 20*3895766dSshatty // 21*3895766dSshatty // - Redistributions of source code must retain the above copyright 22*3895766dSshatty // notice, this list of conditions and the following disclaimers. 23*3895766dSshatty // 24*3895766dSshatty // - Redistributions in binary form must reproduce the above copyright 25*3895766dSshatty // notice, this list of conditions and the following disclaimers in the 26*3895766dSshatty // documentation and/or other materials provided with the distribution. 27*3895766dSshatty // 28*3895766dSshatty // - Neither the name of Echo Digital Audio, nor the names of its 29*3895766dSshatty // contributors may be used to endorse or promote products derived from 30*3895766dSshatty // this Software without specific prior written permission. 31*3895766dSshatty // 32*3895766dSshatty // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 33*3895766dSshatty // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 34*3895766dSshatty // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 35*3895766dSshatty // IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR 36*3895766dSshatty // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 37*3895766dSshatty // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 38*3895766dSshatty // SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. 39*3895766dSshatty // 40*3895766dSshatty // **************************************************************************** 41*3895766dSshatty 42*3895766dSshatty #ifndef _DSPCOMMOBJECT_ 43*3895766dSshatty #define _DSPCOMMOBJECT_ 44*3895766dSshatty 45*3895766dSshatty #ifdef _DEBUG 46*3895766dSshatty #ifdef ECHO_WDM 47*3895766dSshatty #pragma optimize("",off) 48*3895766dSshatty #endif 49*3895766dSshatty #endif 50*3895766dSshatty 51*3895766dSshatty #ifdef _WIN32 52*3895766dSshatty 53*3895766dSshatty // Must match structure alignment w/DSP 54*3895766dSshatty #pragma pack( push, 2 ) 55*3895766dSshatty 56*3895766dSshatty #endif 57*3895766dSshatty 58*3895766dSshatty #include "OsSupport.h" 59*3895766dSshatty #include "CDaffyDuck.h" 60*3895766dSshatty 61*3895766dSshatty /**************************************************************************** 62*3895766dSshatty 63*3895766dSshatty Lots of different defines for the different cards 64*3895766dSshatty 65*3895766dSshatty ****************************************************************************/ 66*3895766dSshatty 67*3895766dSshatty 68*3895766dSshatty //================================================================================== 69*3895766dSshatty // 70*3895766dSshatty // Macros to convert to and from generic driver mixer values. Since it can be tough 71*3895766dSshatty // to do floating point math in a driver, the generic driver uses fixed-point values. 72*3895766dSshatty // The numbers are in a 24.8 format; that is, the upper 24 bits are the integer part 73*3895766dSshatty // of the number and the lower 8 bits represent the fractional part. In this scheme, 74*3895766dSshatty // a value of 0x180 would be equal to 1.5. 75*3895766dSshatty // 76*3895766dSshatty // Since the DSP usually wants 8 bit integer gains, the following macros are useful. 77*3895766dSshatty // 78*3895766dSshatty //================================================================================== 79*3895766dSshatty 80*3895766dSshatty #define GENERIC_TO_DSP(iValue) ((iValue + 0x80) >> 8) 81*3895766dSshatty #define DSP_TO_GENERIC(iValue) (iValue << 8) 82*3895766dSshatty 83*3895766dSshatty 84*3895766dSshatty //================================================================================== 85*3895766dSshatty // 86*3895766dSshatty // Max inputs and outputs 87*3895766dSshatty // 88*3895766dSshatty //================================================================================== 89*3895766dSshatty 90*3895766dSshatty #define DSP_MAXAUDIOINPUTS 16 // Max audio input channels 91*3895766dSshatty #define DSP_MAXAUDIOOUTPUTS 16 // Max audio output channels 92*3895766dSshatty #define DSP_MAXPIPES 32 // Max total pipes (input + output) 93*3895766dSshatty 94*3895766dSshatty 95*3895766dSshatty //================================================================================== 96*3895766dSshatty // 97*3895766dSshatty // These are the offsets for the memory-mapped DSP registers; the DSP base 98*3895766dSshatty // address is treated as the start of a DWORD array. 99*3895766dSshatty // 100*3895766dSshatty //================================================================================== 101*3895766dSshatty 102*3895766dSshatty #define CHI32_CONTROL_REG 4 103*3895766dSshatty #define CHI32_STATUS_REG 5 104*3895766dSshatty #define CHI32_VECTOR_REG 6 105*3895766dSshatty #define CHI32_DATA_REG 7 106*3895766dSshatty 107*3895766dSshatty 108*3895766dSshatty //================================================================================== 109*3895766dSshatty // 110*3895766dSshatty // Interesting bits within the DSP registers 111*3895766dSshatty // 112*3895766dSshatty //================================================================================== 113*3895766dSshatty 114*3895766dSshatty #define CHI32_VECTOR_BUSY 0x00000001 115*3895766dSshatty #define CHI32_STATUS_REG_HF3 0x00000008 116*3895766dSshatty #define CHI32_STATUS_REG_HF4 0x00000010 117*3895766dSshatty #define CHI32_STATUS_REG_HF5 0x00000020 118*3895766dSshatty #define CHI32_STATUS_HOST_READ_FULL 0x00000004 119*3895766dSshatty #define CHI32_STATUS_HOST_WRITE_EMPTY 0x00000002 120*3895766dSshatty #define CHI32_STATUS_IRQ 0x00000040 121*3895766dSshatty 122*3895766dSshatty 123*3895766dSshatty //================================================================================== 124*3895766dSshatty // 125*3895766dSshatty // DSP commands sent via slave mode; these are sent to the DSP by 126*3895766dSshatty // CDspCommObject::Write_DSP 127*3895766dSshatty // 128*3895766dSshatty //================================================================================== 129*3895766dSshatty 130*3895766dSshatty #define DSP_FNC_SET_COMMPAGE_ADDR 0x02 131*3895766dSshatty #define DSP_FNC_SET_CACHELINE_SIZE 0x03 132*3895766dSshatty #define DSP_FNC_LOAD_LAYLA_ASIC 0xd8 133*3895766dSshatty #define DSP_FNC_LOAD_GINA24_ASIC 0xd8 134*3895766dSshatty #define DSP_FNC_LOAD_MONA_PCI_CARD_ASIC 0xd8 135*3895766dSshatty #define DSP_FNC_LOAD_LAYLA24_PCI_CARD_ASIC 0xd8 136*3895766dSshatty #define DSP_FNC_LOAD_MONA_EXTERNAL_ASIC 0xd9 137*3895766dSshatty #define DSP_FNC_LOAD_LAYLA24_EXTERNAL_ASIC 0xd9 138*3895766dSshatty 139*3895766dSshatty 140*3895766dSshatty //================================================================================== 141*3895766dSshatty // 142*3895766dSshatty // Defines to handle the MIDI input state engine; these are used to properly 143*3895766dSshatty // extract MIDI time code bytes and their timestamps from the MIDI input stream. 144*3895766dSshatty // 145*3895766dSshatty //================================================================================== 146*3895766dSshatty 147*3895766dSshatty #define MTC_STATE_NORMAL 0 148*3895766dSshatty #define MTC_STATE_TS_HIGH 1 149*3895766dSshatty #define MTC_STATE_TS_LOW 2 150*3895766dSshatty #define MTC_STATE_F1_DATA 3 151*3895766dSshatty 152*3895766dSshatty #define MTC_SKIP_DATA ((DWORD)-1) 153*3895766dSshatty 154*3895766dSshatty 155*3895766dSshatty /*------------------------------------------------------------------------------------ 156*3895766dSshatty 157*3895766dSshatty Setting the sample rates on Layla24 is somewhat schizophrenic. 158*3895766dSshatty 159*3895766dSshatty For standard rates, it works exactly like Mona and Gina24. That is, for 160*3895766dSshatty 8, 11.025, 16, 22.05, 32, 44.1, 48, 88.2, and 96 kHz, you just set the 161*3895766dSshatty appropriate bits in the control register and write the control register. 162*3895766dSshatty 163*3895766dSshatty In order to support MIDI time code sync (and possibly SMPTE LTC sync in 164*3895766dSshatty the future), Layla24 also has "continuous sample rate mode". In this mode, 165*3895766dSshatty Layla24 can generate any sample rate between 25 and 50 kHz inclusive, or 166*3895766dSshatty 50 to 100 kHz inclusive for double speed mode. 167*3895766dSshatty 168*3895766dSshatty To use continuous mode: 169*3895766dSshatty 170*3895766dSshatty -Set the clock select bits in the control register to 0xe (see the #define 171*3895766dSshatty below) 172*3895766dSshatty 173*3895766dSshatty -Set double-speed mode if you want to use sample rates above 50 kHz 174*3895766dSshatty 175*3895766dSshatty -Write the control register as you would normally 176*3895766dSshatty 177*3895766dSshatty -Now, you need to set the frequency register. First, you need to determine the 178*3895766dSshatty value for the frequency register. This is given by the following formula: 179*3895766dSshatty 180*3895766dSshatty frequency_reg = (LAYLA24_MAGIC_NUMBER / sample_rate) - 2 181*3895766dSshatty 182*3895766dSshatty Note the #define below for the magic number 183*3895766dSshatty 184*3895766dSshatty -Wait for the DSP handshake 185*3895766dSshatty -Write the frequency_reg value to the dwSampleRate field of the comm page 186*3895766dSshatty -Send the vector command SET_LAYLA24_FREQUENCY_REG (see vmonkey.h) 187*3895766dSshatty 188*3895766dSshatty Once you have set the control register up for continuous mode, you can just 189*3895766dSshatty write the frequency register to change the sample rate. This could be 190*3895766dSshatty used for MIDI time code sync. For MTC sync, the control register is set for 191*3895766dSshatty continuous mode. The driver then just keeps writing the 192*3895766dSshatty SET_LAYLA24_FREQUENCY_REG command. 193*3895766dSshatty 194*3895766dSshatty ----------------------------------------------------------------------------------*/ 195*3895766dSshatty 196*3895766dSshatty #define LAYLA24_MAGIC_NUMBER 677376000 197*3895766dSshatty #define LAYLA24_CONTINUOUS_CLOCK 0x000e 198*3895766dSshatty 199*3895766dSshatty 200*3895766dSshatty //================================================================================== 201*3895766dSshatty // 202*3895766dSshatty // DSP vector commands 203*3895766dSshatty // 204*3895766dSshatty //================================================================================== 205*3895766dSshatty 206*3895766dSshatty #define DSP_VC_RESET 0x80ff 207*3895766dSshatty 208*3895766dSshatty #ifndef DSP_56361 209*3895766dSshatty 210*3895766dSshatty // 211*3895766dSshatty // Vector commands for families that only use the 56301 212*3895766dSshatty // Only used for Darla20, Gina20, Layla20, and Darla24 213*3895766dSshatty // 214*3895766dSshatty #define DSP_VC_ACK_INT 0x8073 215*3895766dSshatty #define DSP_VC_SET_VMIXER_GAIN 0x0000 // Not used, only for compile 216*3895766dSshatty #define DSP_VC_START_TRANSFER 0x0075 // Handshke rqd. 217*3895766dSshatty #define DSP_VC_METERS_ON 0x0079 218*3895766dSshatty #define DSP_VC_METERS_OFF 0x007b 219*3895766dSshatty #define DSP_VC_UPDATE_OUTVOL 0x007d // Handshke rqd. 220*3895766dSshatty #define DSP_VC_UPDATE_INGAIN 0x007f // Handshke rqd. 221*3895766dSshatty #define DSP_VC_ADD_AUDIO_BUFFER 0x0081 // Handshke rqd. 222*3895766dSshatty #define DSP_VC_TEST_ASIC 0x00eb 223*3895766dSshatty #define DSP_VC_UPDATE_CLOCKS 0x00ef // Handshke rqd. 224*3895766dSshatty #define DSP_VC_SET_LAYLA_SAMPLE_RATE 0x00f1 // Handshke rqd. 225*3895766dSshatty #define DSP_VC_SET_GD_AUDIO_STATE 0x00f1 // Handshke rqd. 226*3895766dSshatty #define DSP_VC_WRITE_CONTROL_REG 0x00f1 // Handshke rqd. 227*3895766dSshatty #define DSP_VC_MIDI_WRITE 0x00f5 // Handshke rqd. 228*3895766dSshatty #define DSP_VC_STOP_TRANSFER 0x00f7 // Handshke rqd. 229*3895766dSshatty #define DSP_VC_UPDATE_FLAGS 0x00fd // Handshke rqd. 230*3895766dSshatty #define DSP_VC_GO_COMATOSE 0x00f9 231*3895766dSshatty 232*3895766dSshatty #else 233*3895766dSshatty 234*3895766dSshatty // 235*3895766dSshatty // Vector commands for families that use either the 56301 or 56361 236*3895766dSshatty // 237*3895766dSshatty #define DSP_VC_ACK_INT 0x80F5 238*3895766dSshatty #define DSP_VC_SET_VMIXER_GAIN 0x00DB // Handshke rqd. 239*3895766dSshatty #define DSP_VC_START_TRANSFER 0x00DD // Handshke rqd. 240*3895766dSshatty #define DSP_VC_METERS_ON 0x00EF 241*3895766dSshatty #define DSP_VC_METERS_OFF 0x00F1 242*3895766dSshatty #define DSP_VC_UPDATE_OUTVOL 0x00E3 // Handshke rqd. 243*3895766dSshatty #define DSP_VC_UPDATE_INGAIN 0x00E5 // Handshke rqd. 244*3895766dSshatty #define DSP_VC_ADD_AUDIO_BUFFER 0x00E1 // Handshke rqd. 245*3895766dSshatty #define DSP_VC_TEST_ASIC 0x00ED 246*3895766dSshatty #define DSP_VC_UPDATE_CLOCKS 0x00E9 // Handshke rqd. 247*3895766dSshatty #define DSP_VC_SET_LAYLA24_FREQUENCY_REG 0x00E9 // Handshke rqd. 248*3895766dSshatty #define DSP_VC_SET_LAYLA_SAMPLE_RATE 0x00EB // Handshke rqd. 249*3895766dSshatty #define DSP_VC_SET_GD_AUDIO_STATE 0x00EB // Handshke rqd. 250*3895766dSshatty #define DSP_VC_WRITE_CONTROL_REG 0x00EB // Handshke rqd. 251*3895766dSshatty #define DSP_VC_MIDI_WRITE 0x00E7 // Handshke rqd. 252*3895766dSshatty #define DSP_VC_STOP_TRANSFER 0x00DF // Handshke rqd. 253*3895766dSshatty #define DSP_VC_UPDATE_FLAGS 0x00FB // Handshke rqd. 254*3895766dSshatty #define DSP_VC_GO_COMATOSE 0x00d9 255*3895766dSshatty 256*3895766dSshatty #endif 257*3895766dSshatty 258*3895766dSshatty 259*3895766dSshatty //================================================================================== 260*3895766dSshatty // 261*3895766dSshatty // Timeouts 262*3895766dSshatty // 263*3895766dSshatty //================================================================================== 264*3895766dSshatty 265*3895766dSshatty #define HANDSHAKE_TIMEOUT 5000 // SendVector command timeout (times 2 u.s.) 266*3895766dSshatty #define MIDI_OUT_DELAY_USEC 2000 // How long to wait after MIDI fills up 267*3895766dSshatty 268*3895766dSshatty 269*3895766dSshatty //================================================================================== 270*3895766dSshatty // 271*3895766dSshatty // Flags for dwFlags field in the comm page 272*3895766dSshatty // 273*3895766dSshatty //================================================================================== 274*3895766dSshatty 275*3895766dSshatty #define DSP_FLAG_MIDI_INPUT 0x0001 // Enable MIDI input 276*3895766dSshatty #define DSP_FLAG_PROFESSIONAL_SPDIF 0x0008 // 1 Professional, 0 Consumer 277*3895766dSshatty 278*3895766dSshatty 279*3895766dSshatty //================================================================================== 280*3895766dSshatty // 281*3895766dSshatty // Clock detect bits reported by the DSP for Gina20, Layla20, Darla24, and Mia 282*3895766dSshatty // 283*3895766dSshatty //================================================================================== 284*3895766dSshatty 285*3895766dSshatty #define GLDM_CLOCK_DETECT_BIT_WORD 0x0002 286*3895766dSshatty #define GLDM_CLOCK_DETECT_BIT_SUPER 0x0004 287*3895766dSshatty #define GLDM_CLOCK_DETECT_BIT_SPDIF 0x0008 288*3895766dSshatty #define GLDM_CLOCK_DETECT_BIT_ESYNC 0x0010 289*3895766dSshatty 290*3895766dSshatty 291*3895766dSshatty //================================================================================== 292*3895766dSshatty // 293*3895766dSshatty // Clock detect bits reported by the DSP for Gina24, Mona, and Layla24 294*3895766dSshatty // 295*3895766dSshatty //================================================================================== 296*3895766dSshatty 297*3895766dSshatty #define GML_CLOCK_DETECT_BIT_WORD96 0x0002 298*3895766dSshatty #define GML_CLOCK_DETECT_BIT_WORD48 0x0004 299*3895766dSshatty #define GML_CLOCK_DETECT_BIT_SPDIF48 0x0008 300*3895766dSshatty #define GML_CLOCK_DETECT_BIT_SPDIF96 0x0010 301*3895766dSshatty #define GML_CLOCK_DETECT_BIT_WORD (GML_CLOCK_DETECT_BIT_WORD96|GML_CLOCK_DETECT_BIT_WORD48) 302*3895766dSshatty #define GML_CLOCK_DETECT_BIT_SPDIF (GML_CLOCK_DETECT_BIT_SPDIF48|GML_CLOCK_DETECT_BIT_SPDIF96) 303*3895766dSshatty #define GML_CLOCK_DETECT_BIT_ESYNC 0x0020 304*3895766dSshatty #define GML_CLOCK_DETECT_BIT_ADAT 0x0040 305*3895766dSshatty 306*3895766dSshatty 307*3895766dSshatty //================================================================================== 308*3895766dSshatty // 309*3895766dSshatty // Gina/Darla clock states 310*3895766dSshatty // 311*3895766dSshatty //================================================================================== 312*3895766dSshatty 313*3895766dSshatty #define GD_CLOCK_NOCHANGE 0 314*3895766dSshatty #define GD_CLOCK_44 1 315*3895766dSshatty #define GD_CLOCK_48 2 316*3895766dSshatty #define GD_CLOCK_SPDIFIN 3 317*3895766dSshatty #define GD_CLOCK_UNDEF 0xff 318*3895766dSshatty 319*3895766dSshatty 320*3895766dSshatty //================================================================================== 321*3895766dSshatty // 322*3895766dSshatty // Gina/Darla S/PDIF status bits 323*3895766dSshatty // 324*3895766dSshatty //================================================================================== 325*3895766dSshatty 326*3895766dSshatty #define GD_SPDIF_STATUS_NOCHANGE 0 327*3895766dSshatty #define GD_SPDIF_STATUS_44 1 328*3895766dSshatty #define GD_SPDIF_STATUS_48 2 329*3895766dSshatty #define GD_SPDIF_STATUS_UNDEF 0xff 330*3895766dSshatty 331*3895766dSshatty 332*3895766dSshatty //================================================================================== 333*3895766dSshatty // 334*3895766dSshatty // Return values from the DSP when ASIC is loaded 335*3895766dSshatty // 336*3895766dSshatty //================================================================================== 337*3895766dSshatty 338*3895766dSshatty #define ASIC_ALREADY_LOADED 0x1 339*3895766dSshatty #define ASIC_NOT_LOADED 0x0 340*3895766dSshatty 341*3895766dSshatty 342*3895766dSshatty //================================================================================== 343*3895766dSshatty // 344*3895766dSshatty // DSP Audio formats 345*3895766dSshatty // 346*3895766dSshatty // These are the audio formats that the DSP can transfer 347*3895766dSshatty // via input and output pipes. LE means little-endian, 348*3895766dSshatty // BE means big-endian. 349*3895766dSshatty // 350*3895766dSshatty // DSP_AUDIOFORM_MS_8 351*3895766dSshatty // 352*3895766dSshatty // 8-bit mono unsigned samples. For playback, 353*3895766dSshatty // mono data is duplicated out the left and right channels 354*3895766dSshatty // of the output bus. The "MS" part of the name 355*3895766dSshatty // means mono->stereo. 356*3895766dSshatty // 357*3895766dSshatty // DSP_AUDIOFORM_MS_16LE 358*3895766dSshatty // 359*3895766dSshatty // 16-bit signed little-endian mono samples. Playback works 360*3895766dSshatty // like the previous code. 361*3895766dSshatty // 362*3895766dSshatty // DSP_AUDIOFORM_MS_32LE 363*3895766dSshatty // 364*3895766dSshatty // 24-bit signed little-endian mono samples in a 32-bit 365*3895766dSshatty // container. In other words, each sample is a 32-bit signed 366*3895766dSshatty // integer, where the actual audio data is left-justified 367*3895766dSshatty // in the 32 bits and only the 24 most significant bits are valid. 368*3895766dSshatty // 369*3895766dSshatty // DSP_AUDIOFORM_SS_8 370*3895766dSshatty // DSP_AUDIOFORM_SS_16LE 371*3895766dSshatty // DSP_AUDIOFORM_SS_32LE 372*3895766dSshatty // 373*3895766dSshatty // Like the previous ones, except now with stereo interleaved 374*3895766dSshatty // data. "SS" means stereo->stereo. 375*3895766dSshatty // 376*3895766dSshatty // DSP_AUDIOFORM_MM_32LE 377*3895766dSshatty // 378*3895766dSshatty // Similar to DSP_AUDIOFORM_MS_32LE, except that the mono 379*3895766dSshatty // data is not duplicated out both the left and right outputs. 380*3895766dSshatty // This mode is used by the ASIO driver. Here, "MM" means 381*3895766dSshatty // mono->mono. 382*3895766dSshatty // 383*3895766dSshatty // DSP_AUDIOFORM_MM_32BE 384*3895766dSshatty // 385*3895766dSshatty // Just like DSP_AUDIOFORM_MM_32LE, but now the data is 386*3895766dSshatty // in big-endian format. 387*3895766dSshatty // 388*3895766dSshatty // DSP_AUDIOFORM_MS_16LE_ND 389*3895766dSshatty // 390*3895766dSshatty // Just like DSP_AUDIOFORM_MS_16LE; the only difference is 391*3895766dSshatty // that when recording, the signal is not dithered. This 392*3895766dSshatty // is useful when recording from digital inputs. 393*3895766dSshatty // 394*3895766dSshatty // DSP_AUDIOFORM_SS_16LE_ND 395*3895766dSshatty // 396*3895766dSshatty // Just like the last one, but for stereo interleaved data. 397*3895766dSshatty // 398*3895766dSshatty //================================================================================== 399*3895766dSshatty 400*3895766dSshatty #define DSP_AUDIOFORM_MS_8 0 // 8 bit mono 401*3895766dSshatty #define DSP_AUDIOFORM_MS_16LE 1 // 16 bit mono 402*3895766dSshatty #define DSP_AUDIOFORM_MS_32LE 3 // 32 bit mono 403*3895766dSshatty #define DSP_AUDIOFORM_SS_8 4 // 8 bit stereo 404*3895766dSshatty #define DSP_AUDIOFORM_SS_16LE 5 // 16 bit stereo 405*3895766dSshatty #define DSP_AUDIOFORM_SS_32LE 7 // 32 bit stereo 406*3895766dSshatty #define DSP_AUDIOFORM_MM_32LE 8 // 32 bit mono->mono little-endian 407*3895766dSshatty #define DSP_AUDIOFORM_MM_32BE 9 // 32 bit mono->mono big-endian 408*3895766dSshatty #define DSP_AUDIOFORM_MS_16LE_ND 10 // 16 bit mono no dither s/pdif 409*3895766dSshatty #define DSP_AUDIOFORM_SS_16LE_ND 11 // 16 bit stereo no dither s/pdif 410*3895766dSshatty #define DSP_AUDIOFORM_SS_32BE 12 // 32 bit stereo big endian 411*3895766dSshatty #define DSP_AUDIOFORM_INVALID 0xFF // Invalid audio format 412*3895766dSshatty 413*3895766dSshatty 414*3895766dSshatty //================================================================================== 415*3895766dSshatty // 416*3895766dSshatty // Super-interleave is defined as interleaving by 4 or more. Darla20 and Gina20 417*3895766dSshatty // do not support super interleave. 418*3895766dSshatty // 419*3895766dSshatty // Only 32 bit little endian samples are supported for super interleave. The 420*3895766dSshatty // interleave factor must be even. 16 - way interleave is the current maximum, 421*3895766dSshatty // so you can interleave by 4, 6, 8, 10, 12, 14, and 16. 422*3895766dSshatty // 423*3895766dSshatty // The actual format code is derived by taking the define below and or-ing with 424*3895766dSshatty // the interleave factor. So, interleave by 6 is 0x86 and interleave by 16 is 0x90. 425*3895766dSshatty // 426*3895766dSshatty //================================================================================== 427*3895766dSshatty 428*3895766dSshatty #define DSP_AUDIOFORM_SUPER_INTERLEAVE_32LE 0x80 429*3895766dSshatty 430*3895766dSshatty 431*3895766dSshatty //================================================================================== 432*3895766dSshatty // 433*3895766dSshatty // Gina24, Mona, and Layla24 control register defines 434*3895766dSshatty // 435*3895766dSshatty //================================================================================== 436*3895766dSshatty 437*3895766dSshatty #define GML_CONVERTER_ENABLE 0x0010 438*3895766dSshatty #define GML_SPDIF_PRO_MODE 0x0020 // Professional S/PDIF == 1, consumer == 0 439*3895766dSshatty #define GML_SPDIF_SAMPLE_RATE0 0x0040 440*3895766dSshatty #define GML_SPDIF_SAMPLE_RATE1 0x0080 441*3895766dSshatty #define GML_SPDIF_TWO_CHANNEL 0x0100 // 1 == two channels, 0 == one channel 442*3895766dSshatty #define GML_SPDIF_NOT_AUDIO 0x0200 443*3895766dSshatty #define GML_SPDIF_COPY_PERMIT 0x0400 444*3895766dSshatty #define GML_SPDIF_24_BIT 0x0800 // 1 == 24 bit, 0 == 20 bit 445*3895766dSshatty #define GML_ADAT_MODE 0x1000 // 1 == ADAT mode, 0 == S/PDIF mode 446*3895766dSshatty #define GML_SPDIF_OPTICAL_MODE 0x2000 // 1 == optical mode, 0 == RCA mode 447*3895766dSshatty #define GML_SPDIF_CDROM_MODE 0x3000 // 1 == CDROM mode, 0 == RCA or optical mode 448*3895766dSshatty #define GML_DOUBLE_SPEED_MODE 0x4000 // 1 == double speed, 0 == single speed 449*3895766dSshatty 450*3895766dSshatty #define GML_DIGITAL_IN_AUTO_MUTE 0x800000 451*3895766dSshatty 452*3895766dSshatty #define GML_96KHZ (0x0 | GML_DOUBLE_SPEED_MODE) 453*3895766dSshatty #define GML_88KHZ (0x1 | GML_DOUBLE_SPEED_MODE) 454*3895766dSshatty #define GML_48KHZ 0x2 455*3895766dSshatty #define GML_44KHZ 0x3 456*3895766dSshatty #define GML_32KHZ 0x4 457*3895766dSshatty #define GML_22KHZ 0x5 458*3895766dSshatty #define GML_16KHZ 0x6 459*3895766dSshatty #define GML_11KHZ 0x7 460*3895766dSshatty #define GML_8KHZ 0x8 461*3895766dSshatty #define GML_SPDIF_CLOCK 0x9 462*3895766dSshatty #define GML_ADAT_CLOCK 0xA 463*3895766dSshatty #define GML_WORD_CLOCK 0xB 464*3895766dSshatty #define GML_ESYNC_CLOCK 0xC 465*3895766dSshatty #define GML_ESYNCx2_CLOCK 0xD 466*3895766dSshatty 467*3895766dSshatty #define GML_CLOCK_CLEAR_MASK 0xffffbff0 468*3895766dSshatty #define GML_SPDIF_RATE_CLEAR_MASK (~(GML_SPDIF_SAMPLE_RATE0|GML_SPDIF_SAMPLE_RATE1)) 469*3895766dSshatty #define GML_DIGITAL_MODE_CLEAR_MASK 0xffffcfff 470*3895766dSshatty #define GML_SPDIF_FORMAT_CLEAR_MASK 0xfffff01f 471*3895766dSshatty 472*3895766dSshatty 473*3895766dSshatty //================================================================================== 474*3895766dSshatty // 475*3895766dSshatty // MIA Sample rate conversion constants 476*3895766dSshatty // 477*3895766dSshatty //================================================================================== 478*3895766dSshatty 479*3895766dSshatty #define MIA_1_TO_2 0x00010000 // Sample rate conversion ratio 1:2 480*3895766dSshatty #define MIA_1_TO_4 0x00020000 // Sample rate conversion ratio 1:4 481*3895766dSshatty 482*3895766dSshatty #define MIA_SRC_MASK 0xffff0000 483*3895766dSshatty 484*3895766dSshatty 485*3895766dSshatty //================================================================================== 486*3895766dSshatty // 487*3895766dSshatty // Mia sample rate and clock setting constants 488*3895766dSshatty // 489*3895766dSshatty //================================================================================== 490*3895766dSshatty 491*3895766dSshatty #define MIA_32000 0x0040 492*3895766dSshatty #define MIA_44100 0x0042 493*3895766dSshatty #define MIA_48000 0x0041 494*3895766dSshatty #define MIA_88200 0x0142 495*3895766dSshatty #define MIA_96000 0x0141 496*3895766dSshatty 497*3895766dSshatty #define MIA_8000 (MIA_1_TO_4 | MIA_32000) 498*3895766dSshatty #define MIA_11025 (MIA_1_TO_4 | MIA_44100) 499*3895766dSshatty #define MIA_12000 (MIA_1_TO_4 | MIA_48000) 500*3895766dSshatty #define MIA_16000 (MIA_1_TO_2 | MIA_32000) 501*3895766dSshatty #define MIA_22050 (MIA_1_TO_2 | MIA_44100) 502*3895766dSshatty #define MIA_24000 (MIA_1_TO_2 | MIA_48000) 503*3895766dSshatty 504*3895766dSshatty #define MIA_SPDIF 0x00000044 505*3895766dSshatty #define MIA_SPDIF96 0x00000144 506*3895766dSshatty 507*3895766dSshatty 508*3895766dSshatty //================================================================================== 509*3895766dSshatty // 510*3895766dSshatty // Gina20 & Layla20 have input gain controls for the analog inputs; 511*3895766dSshatty // this is the magic number for the hardware that gives you 0 dB at -10. 512*3895766dSshatty // 513*3895766dSshatty //================================================================================== 514*3895766dSshatty 515*3895766dSshatty #define GL20_INPUT_GAIN_MAGIC_NUMBER 0xC8 516*3895766dSshatty 517*3895766dSshatty 518*3895766dSshatty //================================================================================== 519*3895766dSshatty // 520*3895766dSshatty // Defines how much time must pass between DSP load attempts 521*3895766dSshatty // 522*3895766dSshatty //================================================================================== 523*3895766dSshatty 524*3895766dSshatty #define DSP_LOAD_ATTEMPT_PERIOD 1000000L // One million microseconds == one second 525*3895766dSshatty 526*3895766dSshatty 527*3895766dSshatty //================================================================================== 528*3895766dSshatty // 529*3895766dSshatty // Size of arrays for the comm page. MAX_PLAY_TAPS and MAX_REC_TAPS are no longer 530*3895766dSshatty // used, but the sizes must still be right for the DSP to see the comm page correctly. 531*3895766dSshatty // 532*3895766dSshatty //================================================================================== 533*3895766dSshatty 534*3895766dSshatty #define MONITOR_ARRAY_SIZE 0x180 535*3895766dSshatty #define VMIXER_ARRAY_SIZE 0x40 536*3895766dSshatty #define DSP_MIDI_BUFFER_SIZE 256 537*3895766dSshatty #define MAX_PLAY_TAPS 168 538*3895766dSshatty #define MAX_REC_TAPS 192 539*3895766dSshatty 540*3895766dSshatty 541*3895766dSshatty /**************************************************************************** 542*3895766dSshatty 543*3895766dSshatty The comm page. This structure is read and written by the DSP; the 544*3895766dSshatty DSP code is a firm believer in the byte offsets written in the comments 545*3895766dSshatty at the end of each line. This structure should not be changed. 546*3895766dSshatty 547*3895766dSshatty Any reads from or writes to this structure should be in little-endian 548*3895766dSshatty format. 549*3895766dSshatty 550*3895766dSshatty ****************************************************************************/ 551*3895766dSshatty 552*3895766dSshatty typedef struct 553*3895766dSshatty { 554*3895766dSshatty DWORD dwCommSize; // size of this object 0x000 4 555*3895766dSshatty 556*3895766dSshatty DWORD dwFlags; // See Appendix A below 0x004 4 557*3895766dSshatty DWORD dwUnused; // Unused entry 0x008 4 558*3895766dSshatty 559*3895766dSshatty DWORD dwSampleRate; // Card sample rate in Hz 0x00c 4 560*3895766dSshatty DWORD dwHandshake; // DSP command handshake 0x010 4 561*3895766dSshatty CChMaskDsp cmdStart; // Chs. to start mask 0x014 4 562*3895766dSshatty CChMaskDsp cmdStop; // Chs. to stop mask 0x018 4 563*3895766dSshatty CChMaskDsp cmdReset; // Chs. to reset mask 0x01c 4 564*3895766dSshatty WORD wAudioFormat[ DSP_MAXPIPES ]; 565*3895766dSshatty // Chs. audio format 0x020 16*2*2 566*3895766dSshatty DUCKENTRY dwDuckListPhys[ DSP_MAXPIPES ]; 567*3895766dSshatty // Chs. Physical duck addrs 0x060 16*2*8 568*3895766dSshatty DWORD dwPosition[ DSP_MAXPIPES ]; 569*3895766dSshatty // Positions for ea. ch. 0x160 16*2*4 570*3895766dSshatty BYTE VULevel[ DSP_MAXPIPES ]; 571*3895766dSshatty // VU meters 0x1e0 16*2*1 572*3895766dSshatty BYTE PeakMeter[ DSP_MAXPIPES ]; 573*3895766dSshatty // Peak meters 0x200 16*2*1 574*3895766dSshatty BYTE OutLineLevel[ DSP_MAXAUDIOOUTPUTS ]; 575*3895766dSshatty // Output gain 0x220 16*1 576*3895766dSshatty BYTE InLineLevel[ DSP_MAXAUDIOINPUTS ]; 577*3895766dSshatty // Input gain 0x230 16*1 578*3895766dSshatty BYTE byMonitors[ MONITOR_ARRAY_SIZE ]; 579*3895766dSshatty // Monitor map 0x240 0x180 580*3895766dSshatty DWORD dwPlayCoeff[ MAX_PLAY_TAPS ]; 581*3895766dSshatty // Gina/Darla play filters - obsolete 0x3c0 168*4 582*3895766dSshatty DWORD dwRecCoeff [ MAX_REC_TAPS ]; 583*3895766dSshatty // Gina/Darla record filters - obsolete 0x660 192*4 584*3895766dSshatty WORD wMidiInData[ DSP_MIDI_BUFFER_SIZE ]; 585*3895766dSshatty // MIDI input data transfer buffer 0x960 256*2 586*3895766dSshatty BYTE byGDClockState; // Chg Gina/Darla clock state 0xb60 4 587*3895766dSshatty BYTE byGDSpdifStatus; // Chg. Gina/Darla S/PDIF state 588*3895766dSshatty BYTE byGDResamplerState; // Should always be 3 589*3895766dSshatty BYTE byFiller2; 590*3895766dSshatty CChMaskDsp cmdNominalLevel; 591*3895766dSshatty // -10 level enable mask 0xb64 4 592*3895766dSshatty WORD wInputClock; // Chg. Input clock state 593*3895766dSshatty WORD wOutputClock; // Chg. Output clock state 0xb68 594*3895766dSshatty DWORD dwStatusClocks; // Current Input clock state 0xb6c 4 595*3895766dSshatty 596*3895766dSshatty DWORD dwMIDIOutData; // Output MIDI bytes to DSP 0xb70 597*3895766dSshatty CChMaskDsp cmdAddBuffer; // Pipes. to add 0xb74 4 598*3895766dSshatty DWORD dwMidiXmitStatus; // MIDI transmit status 0xb78 4 599*3895766dSshatty CChMaskDsp cmdCyclicBuffer; // Cyclic pipes 0xb7c 4 600*3895766dSshatty DWORD dwControlReg; // Mona, Gina24 & Layla24 control reg 0xb80 4 601*3895766dSshatty BYTE byFiller[28]; // filler 0xb84 602*3895766dSshatty BYTE byVmixerLevel[ VMIXER_ARRAY_SIZE ]; 603*3895766dSshatty // Vmixer levels 0xba0 64 604*3895766dSshatty } DspCommPage, *PDspCommPage; 605*3895766dSshatty 606*3895766dSshatty 607*3895766dSshatty /**************************************************************************** 608*3895766dSshatty 609*3895766dSshatty CDspCommObject is the class which wraps both the comm page and the 610*3895766dSshatty DSP registers. CDspCommObject talks directly to the hardware; anyone 611*3895766dSshatty who wants to do something to the hardware goes through CDspCommObject or 612*3895766dSshatty one of the derived classes. 613*3895766dSshatty 614*3895766dSshatty Note that an instance of CDspCommObject is never actually created; it 615*3895766dSshatty is treated as an abstract base class. 616*3895766dSshatty 617*3895766dSshatty ****************************************************************************/ 618*3895766dSshatty 619*3895766dSshatty class CDspCommObject 620*3895766dSshatty { 621*3895766dSshatty protected: 622*3895766dSshatty PDspCommPage m_pDspCommPage; // Physical memory seen by DSP 623*3895766dSshatty 624*3895766dSshatty // 625*3895766dSshatty // These members are not seen by the DSP; they are used internally by 626*3895766dSshatty // this class. 627*3895766dSshatty // 628*3895766dSshatty WORD m_wNumPipesOut; 629*3895766dSshatty WORD m_wNumPipesIn; 630*3895766dSshatty WORD m_wNumBussesOut; 631*3895766dSshatty WORD m_wNumBussesIn; 632*3895766dSshatty WORD m_wFirstDigitalBusOut; 633*3895766dSshatty WORD m_wFirstDigitalBusIn; 634*3895766dSshatty 635*3895766dSshatty BOOL m_fHasVmixer; 636*3895766dSshatty 637*3895766dSshatty WORD m_wNumMidiOut; // # MIDI out channels 638*3895766dSshatty WORD m_wNumMidiIn; // # MIDI in channels 639*3895766dSshatty PWORD m_pwDspCode; // Current DSP code loaded, NULL if nothing loaded 640*3895766dSshatty PWORD m_pwDspCodeToLoad; // DSP code to load 641*3895766dSshatty BOOL m_bHasASIC; // Set TRUE if card has an ASIC 642*3895766dSshatty BOOL m_bASICLoaded; // Set TRUE when ASIC loaded 643*3895766dSshatty DWORD m_dwCommPagePhys; // Physical addr of this object 644*3895766dSshatty PDWORD m_pdwDspRegBase; // DSP's register base 645*3895766dSshatty CChannelMask m_cmActive; // Chs. active mask 646*3895766dSshatty BOOL m_bBadBoard; // Set TRUE if DSP won't load 647*3895766dSshatty // or punks out 648*3895766dSshatty WORD m_wMeterOnCount; // How many times meters have been 649*3895766dSshatty // enabled 650*3895766dSshatty PCOsSupport m_pOsSupport; // Ptr to OS specific methods & data 651*3895766dSshatty CHAR m_szCardName[ 20 ]; 652*3895766dSshatty BYTE m_byDigitalMode; // Digital mode (see DIGITAL_MODE_?? 653*3895766dSshatty // defines in EchoGalsXface.h 654*3895766dSshatty WORD m_wInputClock; // Currently selected input clock 655*3895766dSshatty WORD m_wOutputClock; // Currently selected output clock 656*3895766dSshatty 657*3895766dSshatty ULONGLONG m_ullLastLoadAttemptTime; // Last system time that the driver 658*3895766dSshatty // attempted to load the DSP & ASIC 659*3895766dSshatty #ifdef DIGITAL_INPUT_AUTO_MUTE_SUPPORT 660*3895766dSshatty BOOL m_fDigitalInAutoMute; 661*3895766dSshatty #endif 662*3895766dSshatty 663*3895766dSshatty #ifdef MIDI_SUPPORT 664*3895766dSshatty WORD m_wMidiOnCount; // Count MIDI enabled cmds 665*3895766dSshatty ULONGLONG m_ullMidiInTime; // Last time MIDI in occured 666*3895766dSshatty ULONGLONG m_ullMidiOutTime; // Last time MIDI out occured 667*3895766dSshatty ULONGLONG m_ullNextMidiWriteTime; // Next time to try MIDI output 668*3895766dSshatty 669*3895766dSshatty WORD m_wMtcState; // State for MIDI input parsing state machine 670*3895766dSshatty #endif 671*3895766dSshatty 672*3895766dSshatty protected : 673*3895766dSshatty 674*3895766dSshatty virtual WORD ComputeAudioMonitorIndex 675*3895766dSshatty ( 676*3895766dSshatty WORD wBusOut, 677*3895766dSshatty WORD wBusIn 678*3895766dSshatty ) 679*3895766dSshatty { 680*3895766dSshatty return( wBusOut * m_wNumBussesIn + wBusIn ); 681*3895766dSshatty } 682*3895766dSshatty 683*3895766dSshatty // 684*3895766dSshatty // Load code into DSP 685*3895766dSshatty // 686*3895766dSshatty #ifdef DSP_56361 687*3895766dSshatty virtual ECHOSTATUS InstallResidentLoader(); 688*3895766dSshatty #endif 689*3895766dSshatty virtual ECHOSTATUS LoadDSP( PWORD pCode ); 690*3895766dSshatty 691*3895766dSshatty // 692*3895766dSshatty // Read the serial number from DSP 693*3895766dSshatty // 694*3895766dSshatty virtual ECHOSTATUS ReadSn(); 695*3895766dSshatty 696*3895766dSshatty // 697*3895766dSshatty // Load code into ASIC 698*3895766dSshatty // 699*3895766dSshatty virtual BOOL LoadASIC( DWORD dwCmd, PBYTE pCode, DWORD dwSize ); 700*3895766dSshatty virtual BOOL LoadASIC() { return TRUE; } 701*3895766dSshatty 702*3895766dSshatty // 703*3895766dSshatty // Check status of ASIC - loaded or not loaded 704*3895766dSshatty // 705*3895766dSshatty BOOL CheckAsicStatus(); 706*3895766dSshatty 707*3895766dSshatty // 708*3895766dSshatty // Write to DSP 709*3895766dSshatty // 710*3895766dSshatty ECHOSTATUS Write_DSP( DWORD dwData ); 711*3895766dSshatty 712*3895766dSshatty // 713*3895766dSshatty // Read from DSP 714*3895766dSshatty // 715*3895766dSshatty ECHOSTATUS Read_DSP( DWORD *pdwData ); 716*3895766dSshatty 717*3895766dSshatty // 718*3895766dSshatty // Get/Set handshake Flag 719*3895766dSshatty // 720*3895766dSshatty DWORD GetHandshakeFlag() 721*3895766dSshatty { ASSERT( NULL != m_pDspCommPage ); 722*3895766dSshatty return( SWAP( m_pDspCommPage->dwHandshake ) ); } 723*3895766dSshatty void ClearHandshake() 724*3895766dSshatty { ASSERT( NULL != m_pDspCommPage ); 725*3895766dSshatty m_pDspCommPage->dwHandshake = 0; } 726*3895766dSshatty 727*3895766dSshatty // 728*3895766dSshatty // Get/set DSP registers 729*3895766dSshatty // 730*3895766dSshatty DWORD GetDspRegister( DWORD dwIndex ) 731*3895766dSshatty { ASSERT( NULL != m_pdwDspRegBase ); 732*3895766dSshatty return( SWAP( m_pdwDspRegBase[ dwIndex ] ) ); } 733*3895766dSshatty void SetDspRegister( DWORD dwIndex, DWORD dwValue ) 734*3895766dSshatty { ASSERT( NULL != m_pdwDspRegBase ); 735*3895766dSshatty m_pdwDspRegBase[ dwIndex ] = SWAP( dwValue ); } 736*3895766dSshatty 737*3895766dSshatty // 738*3895766dSshatty // Set control register in CommPage 739*3895766dSshatty // 740*3895766dSshatty void SetControlRegister( DWORD dwControlRegister ) 741*3895766dSshatty { ASSERT( NULL != m_pDspCommPage ); 742*3895766dSshatty m_pDspCommPage->dwControlReg = SWAP( dwControlRegister ); } 743*3895766dSshatty 744*3895766dSshatty // 745*3895766dSshatty // Called after load firmware to restore old gains, meters on, monitors, etc. 746*3895766dSshatty // 747*3895766dSshatty virtual void RestoreDspSettings(); 748*3895766dSshatty 749*3895766dSshatty // 750*3895766dSshatty // Send a vector command to the DSP 751*3895766dSshatty // 752*3895766dSshatty ECHOSTATUS SendVector( DWORD dwCommand ); 753*3895766dSshatty 754*3895766dSshatty // 755*3895766dSshatty // Wait for DSP to finish the last vector command 756*3895766dSshatty // 757*3895766dSshatty BOOL WaitForHandshake(); 758*3895766dSshatty 759*3895766dSshatty // 760*3895766dSshatty // Send new input line setting to DSP 761*3895766dSshatty // 762*3895766dSshatty ECHOSTATUS UpdateAudioInLineLevel(); 763*3895766dSshatty 764*3895766dSshatty public: 765*3895766dSshatty 766*3895766dSshatty // 767*3895766dSshatty // Construction/destruction 768*3895766dSshatty // 769*3895766dSshatty CDspCommObject( PDWORD pdwRegBase, PCOsSupport pOsSupport ); 770*3895766dSshatty virtual ~CDspCommObject(); 771*3895766dSshatty 772*3895766dSshatty // 773*3895766dSshatty // Card information 774*3895766dSshatty // 775*3895766dSshatty virtual WORD GetCardType() = NULL; 776*3895766dSshatty // Undefined, must be done in derived class 777*3895766dSshatty const PCHAR GetCardName() { return( m_szCardName ); } 778*3895766dSshatty // Must be init in derived class 779*3895766dSshatty 780*3895766dSshatty // 781*3895766dSshatty // Get mask with active pipes 782*3895766dSshatty // 783*3895766dSshatty void GetActivePipes 784*3895766dSshatty ( 785*3895766dSshatty PCChannelMask pChannelMask 786*3895766dSshatty ); 787*3895766dSshatty 788*3895766dSshatty // 789*3895766dSshatty // Basic info methods 790*3895766dSshatty // 791*3895766dSshatty WORD GetNumPipesOut() 792*3895766dSshatty { 793*3895766dSshatty return m_wNumPipesOut; 794*3895766dSshatty } 795*3895766dSshatty 796*3895766dSshatty WORD GetNumPipesIn() 797*3895766dSshatty { 798*3895766dSshatty return m_wNumPipesIn; 799*3895766dSshatty } 800*3895766dSshatty 801*3895766dSshatty WORD GetNumBussesOut() 802*3895766dSshatty { 803*3895766dSshatty return m_wNumBussesOut; 804*3895766dSshatty } 805*3895766dSshatty 806*3895766dSshatty WORD GetNumBussesIn() 807*3895766dSshatty { 808*3895766dSshatty return m_wNumBussesIn; 809*3895766dSshatty } 810*3895766dSshatty 811*3895766dSshatty WORD GetNumPipes() 812*3895766dSshatty { 813*3895766dSshatty return m_wNumPipesOut + m_wNumPipesIn; 814*3895766dSshatty } 815*3895766dSshatty 816*3895766dSshatty WORD GetNumBusses() 817*3895766dSshatty { 818*3895766dSshatty return m_wNumBussesOut + m_wNumBussesIn; 819*3895766dSshatty } 820*3895766dSshatty 821*3895766dSshatty WORD GetFirstDigitalBusOut() 822*3895766dSshatty { 823*3895766dSshatty return m_wFirstDigitalBusOut; 824*3895766dSshatty } 825*3895766dSshatty 826*3895766dSshatty WORD GetFirstDigitalBusIn() 827*3895766dSshatty { 828*3895766dSshatty return m_wFirstDigitalBusIn; 829*3895766dSshatty } 830*3895766dSshatty 831*3895766dSshatty BOOL HasVmixer() 832*3895766dSshatty { 833*3895766dSshatty return m_fHasVmixer; 834*3895766dSshatty } 835*3895766dSshatty 836*3895766dSshatty WORD GetNumMidiOutChannels() 837*3895766dSshatty { return( m_wNumMidiOut ); } 838*3895766dSshatty WORD GetNumMidiInChannels() 839*3895766dSshatty { return( m_wNumMidiIn ); } 840*3895766dSshatty WORD GetNumMidiChannels() 841*3895766dSshatty { return( m_wNumMidiIn + m_wNumMidiOut ); } 842*3895766dSshatty 843*3895766dSshatty BOOL VerifySize( DWORD dwExpSize ) 844*3895766dSshatty { return( SWAP( dwExpSize ) == m_pDspCommPage->dwCommSize ); } 845*3895766dSshatty 846*3895766dSshatty // 847*3895766dSshatty // Get, set, and clear comm page flags 848*3895766dSshatty // 849*3895766dSshatty DWORD GetFlags() 850*3895766dSshatty { 851*3895766dSshatty return( SWAP( m_pDspCommPage->dwFlags ) ); } 852*3895766dSshatty DWORD SetFlags( DWORD dwFlags ) 853*3895766dSshatty { 854*3895766dSshatty DWORD dwCpFlags = SWAP( m_pDspCommPage->dwFlags ); 855*3895766dSshatty dwCpFlags |= dwFlags; 856*3895766dSshatty m_pDspCommPage->dwFlags = SWAP( dwCpFlags ); 857*3895766dSshatty 858*3895766dSshatty if ( m_bASICLoaded && WaitForHandshake() ) 859*3895766dSshatty UpdateFlags(); 860*3895766dSshatty return( GetFlags() ); 861*3895766dSshatty } 862*3895766dSshatty DWORD ClearFlags( DWORD dwFlags ) 863*3895766dSshatty { 864*3895766dSshatty DWORD dwCpFlags = SWAP( m_pDspCommPage->dwFlags ); 865*3895766dSshatty dwCpFlags &= ~dwFlags; 866*3895766dSshatty m_pDspCommPage->dwFlags = SWAP( dwCpFlags ); 867*3895766dSshatty 868*3895766dSshatty if ( m_bASICLoaded && WaitForHandshake() ) 869*3895766dSshatty UpdateFlags(); 870*3895766dSshatty return( GetFlags() ); 871*3895766dSshatty } 872*3895766dSshatty 873*3895766dSshatty // 874*3895766dSshatty // Returns currently selected input clock 875*3895766dSshatty // 876*3895766dSshatty WORD GetInputClock() 877*3895766dSshatty { 878*3895766dSshatty return m_wInputClock; 879*3895766dSshatty } 880*3895766dSshatty 881*3895766dSshatty // 882*3895766dSshatty // Returns what input clocks are currently detected 883*3895766dSshatty // 884*3895766dSshatty DWORD GetInputClockDetect() 885*3895766dSshatty { return( SWAP( m_pDspCommPage->dwStatusClocks ) ); } 886*3895766dSshatty 887*3895766dSshatty // 888*3895766dSshatty // Returns currently selected output clock 889*3895766dSshatty // 890*3895766dSshatty WORD GetOutputClock() 891*3895766dSshatty { 892*3895766dSshatty return m_wOutputClock; 893*3895766dSshatty } 894*3895766dSshatty 895*3895766dSshatty // 896*3895766dSshatty // Returns control register 897*3895766dSshatty // 898*3895766dSshatty DWORD GetControlRegister() 899*3895766dSshatty { ASSERT( NULL != m_pDspCommPage ); 900*3895766dSshatty return SWAP( m_pDspCommPage->dwControlReg ); } 901*3895766dSshatty 902*3895766dSshatty // 903*3895766dSshatty // Set input and output clocks 904*3895766dSshatty // 905*3895766dSshatty virtual ECHOSTATUS SetInputClock(WORD wClock); 906*3895766dSshatty virtual ECHOSTATUS SetOutputClock(WORD wClock); 907*3895766dSshatty 908*3895766dSshatty // 909*3895766dSshatty // Set digital mode 910*3895766dSshatty // 911*3895766dSshatty virtual ECHOSTATUS SetDigitalMode( BYTE byNewMode ) 912*3895766dSshatty { return ECHOSTATUS_DIGITAL_MODE_NOT_SUPPORTED; } 913*3895766dSshatty // 914*3895766dSshatty // Get digital mode 915*3895766dSshatty // 916*3895766dSshatty virtual BYTE GetDigitalMode() 917*3895766dSshatty { return( m_byDigitalMode ); } 918*3895766dSshatty 919*3895766dSshatty // 920*3895766dSshatty // Get mask of all supported digital modes. 921*3895766dSshatty // (See ECHOCAPS_HAS_DIGITAL_MODE_??? defines in EchoGalsXface.h) 922*3895766dSshatty // 923*3895766dSshatty // Note: If the card does not have a digital mode switch 924*3895766dSshatty // then return 0 (no digital modes supported). 925*3895766dSshatty // Some legacy cards support S/PDIF as their only 926*3895766dSshatty // digital mode. We still return 0 here because it 927*3895766dSshatty // is not switchable. 928*3895766dSshatty // 929*3895766dSshatty virtual DWORD GetDigitalModes() 930*3895766dSshatty { return( 0 ); } 931*3895766dSshatty 932*3895766dSshatty // 933*3895766dSshatty // Return audio channel position in bytes 934*3895766dSshatty // 935*3895766dSshatty DWORD GetAudioPosition( WORD wPipeIndex ) 936*3895766dSshatty { ASSERT( wPipeIndex < ECHO_MAXAUDIOPIPES ); 937*3895766dSshatty 938*3895766dSshatty return( ( wPipeIndex < ECHO_MAXAUDIOPIPES ) 939*3895766dSshatty ? SWAP( m_pDspCommPage->dwPosition[ wPipeIndex ] ) 940*3895766dSshatty : 0 ); } 941*3895766dSshatty 942*3895766dSshatty // 943*3895766dSshatty // Reset the pipe position for a single pipe 944*3895766dSshatty // 945*3895766dSshatty void ResetPipePosition(WORD wPipeIndex) 946*3895766dSshatty { 947*3895766dSshatty if (wPipeIndex < ECHO_MAXAUDIOPIPES) 948*3895766dSshatty { 949*3895766dSshatty m_pDspCommPage->dwPosition[ wPipeIndex ] = 0; 950*3895766dSshatty } 951*3895766dSshatty } 952*3895766dSshatty 953*3895766dSshatty // 954*3895766dSshatty // Warning: Never write to the pointer returned by this 955*3895766dSshatty // function!!! 956*3895766dSshatty // 957*3895766dSshatty // The data pointed to by this pointer is in little- 958*3895766dSshatty // endian format. 959*3895766dSshatty // 960*3895766dSshatty PDWORD GetAudioPositionPtr() 961*3895766dSshatty { return( m_pDspCommPage->dwPosition ); } 962*3895766dSshatty 963*3895766dSshatty // 964*3895766dSshatty // Get the current sample rate 965*3895766dSshatty // 966*3895766dSshatty DWORD GetSampleRate() 967*3895766dSshatty { return( SWAP( m_pDspCommPage->dwSampleRate ) ); } 968*3895766dSshatty 969*3895766dSshatty // 970*3895766dSshatty // Set the sample rate. 971*3895766dSshatty // Return rate that was set, 0xffffffff if error 972*3895766dSshatty // 973*3895766dSshatty virtual DWORD SetSampleRate( DWORD dwNewSampleRate ) = NULL; 974*3895766dSshatty 975*3895766dSshatty // 976*3895766dSshatty // Send current setting to DSP & return what it is 977*3895766dSshatty // 978*3895766dSshatty virtual DWORD SetSampleRate() = NULL; 979*3895766dSshatty 980*3895766dSshatty // 981*3895766dSshatty // Start a group of pipes 982*3895766dSshatty // 983*3895766dSshatty ECHOSTATUS StartTransport 984*3895766dSshatty ( 985*3895766dSshatty PCChannelMask pChannelMask, // Pipes to start 986*3895766dSshatty PCChannelMask pCyclicMask // Which pipes are cyclic buffers 987*3895766dSshatty ); 988*3895766dSshatty 989*3895766dSshatty // 990*3895766dSshatty // Stop a group of pipes 991*3895766dSshatty // 992*3895766dSshatty ECHOSTATUS StopTransport 993*3895766dSshatty ( 994*3895766dSshatty PCChannelMask pChannelMask 995*3895766dSshatty ); 996*3895766dSshatty 997*3895766dSshatty // 998*3895766dSshatty // Reset a group of pipes 999*3895766dSshatty // 1000*3895766dSshatty ECHOSTATUS ResetTransport 1001*3895766dSshatty ( 1002*3895766dSshatty PCChannelMask pChannelMask 1003*3895766dSshatty ); 1004*3895766dSshatty 1005*3895766dSshatty // 1006*3895766dSshatty // Tell DSP we added a buffer to a channel 1007*3895766dSshatty // 1008*3895766dSshatty ECHOSTATUS AddBuffer( WORD wPipeIndex ); 1009*3895766dSshatty 1010*3895766dSshatty // 1011*3895766dSshatty // Add start of duck list for one channel to commpage so DSP can read it. 1012*3895766dSshatty // 1013*3895766dSshatty void SetAudioDuckListPhys( WORD wPipeIndex, DWORD dwNewPhysAdr ); 1014*3895766dSshatty 1015*3895766dSshatty // 1016*3895766dSshatty // Read extended status register from the DSP 1017*3895766dSshatty // 1018*3895766dSshatty DWORD GetStatusReg() 1019*3895766dSshatty { return( SWAP( m_pdwDspRegBase[ CHI32_STATUS_REG ] ) ); } 1020*3895766dSshatty 1021*3895766dSshatty // 1022*3895766dSshatty // Tell DSP to release the hardware interrupt 1023*3895766dSshatty // 1024*3895766dSshatty void AckInt() 1025*3895766dSshatty { 1026*3895766dSshatty m_pDspCommPage->wMidiInData[ 0 ] = 0; 1027*3895766dSshatty SendVector( DSP_VC_ACK_INT ); 1028*3895766dSshatty } 1029*3895766dSshatty 1030*3895766dSshatty // 1031*3895766dSshatty // Overload new & delete so memory for this object is allocated 1032*3895766dSshatty // from contiguous non-paged memory. 1033*3895766dSshatty // 1034*3895766dSshatty PVOID operator new( size_t Size ); 1035*3895766dSshatty VOID operator delete( PVOID pVoid ); 1036*3895766dSshatty 1037*3895766dSshatty // 1038*3895766dSshatty // Get status of board 1039*3895766dSshatty // 1040*3895766dSshatty BOOL IsBoardBad() 1041*3895766dSshatty { return( m_bBadBoard ); } 1042*3895766dSshatty 1043*3895766dSshatty // 1044*3895766dSshatty // Tell DSP flags have been updated 1045*3895766dSshatty // 1046*3895766dSshatty ECHOSTATUS UpdateFlags() 1047*3895766dSshatty { 1048*3895766dSshatty ECHO_DEBUGPRINTF(("CDspCommObject::UpdateFlags\n")); 1049*3895766dSshatty ClearHandshake(); 1050*3895766dSshatty return( SendVector( DSP_VC_UPDATE_FLAGS ) ); 1051*3895766dSshatty } 1052*3895766dSshatty 1053*3895766dSshatty // 1054*3895766dSshatty // Get/Set Professional or consumer S/PDIF status 1055*3895766dSshatty // 1056*3895766dSshatty virtual BOOL IsProfessionalSpdif() 1057*3895766dSshatty { 1058*3895766dSshatty ECHO_DEBUGPRINTF(("CDspCommObject::IsProfessionalSpdif - flags are 0x%lx\n", 1059*3895766dSshatty GetFlags())); 1060*3895766dSshatty return( ( GetFlags() & DSP_FLAG_PROFESSIONAL_SPDIF ) ? TRUE : FALSE ); 1061*3895766dSshatty } 1062*3895766dSshatty 1063*3895766dSshatty virtual void SetProfessionalSpdif( BOOL bNewStatus ) 1064*3895766dSshatty { 1065*3895766dSshatty ECHO_DEBUGPRINTF(("CDspCommObject::SetProfessionalSpdif %d\n",bNewStatus)); 1066*3895766dSshatty if ( 0 != bNewStatus ) 1067*3895766dSshatty SetFlags( DSP_FLAG_PROFESSIONAL_SPDIF ); 1068*3895766dSshatty else 1069*3895766dSshatty ClearFlags( DSP_FLAG_PROFESSIONAL_SPDIF ); 1070*3895766dSshatty 1071*3895766dSshatty ECHO_DEBUGPRINTF(("CDspCommObject::SetProfessionalSpdif - flags are now 0x%lx\n", 1072*3895766dSshatty GetFlags())); 1073*3895766dSshatty } 1074*3895766dSshatty 1075*3895766dSshatty // 1076*3895766dSshatty // Mixer functions 1077*3895766dSshatty // 1078*3895766dSshatty virtual ECHOSTATUS SetNominalLevel( WORD wBus, BOOL bState ); 1079*3895766dSshatty ECHOSTATUS GetNominalLevel( WORD wBus, PBYTE pbyState ); 1080*3895766dSshatty 1081*3895766dSshatty ECHOSTATUS SetAudioMonitor 1082*3895766dSshatty ( 1083*3895766dSshatty WORD wOutCh, 1084*3895766dSshatty WORD wInCh, 1085*3895766dSshatty int iGain, 1086*3895766dSshatty BOOL fImmediate = TRUE 1087*3895766dSshatty ); 1088*3895766dSshatty 1089*3895766dSshatty // 1090*3895766dSshatty // SetBusOutGain - empty function on non-vmixer cards 1091*3895766dSshatty // 1092*3895766dSshatty virtual ECHOSTATUS SetBusOutGain(WORD wBusOut,int iGain) 1093*3895766dSshatty { 1094*3895766dSshatty return ECHOSTATUS_OK; 1095*3895766dSshatty } 1096*3895766dSshatty 1097*3895766dSshatty // Send volume to DSP 1098*3895766dSshatty ECHOSTATUS UpdateAudioOutLineLevel(); 1099*3895766dSshatty 1100*3895766dSshatty // Send vmixer volume to DSP 1101*3895766dSshatty virtual ECHOSTATUS UpdateVmixerLevel(); 1102*3895766dSshatty 1103*3895766dSshatty virtual ECHOSTATUS SetPipeOutGain 1104*3895766dSshatty ( 1105*3895766dSshatty WORD wPipeOut, 1106*3895766dSshatty WORD wBusOut, 1107*3895766dSshatty int iGain, 1108*3895766dSshatty BOOL fImmediate = TRUE 1109*3895766dSshatty ); 1110*3895766dSshatty 1111*3895766dSshatty virtual ECHOSTATUS GetPipeOutGain 1112*3895766dSshatty ( 1113*3895766dSshatty WORD wPipeOut, 1114*3895766dSshatty WORD wBusOut, 1115*3895766dSshatty int &iGain 1116*3895766dSshatty ); 1117*3895766dSshatty 1118*3895766dSshatty virtual ECHOSTATUS SetBusInGain 1119*3895766dSshatty ( 1120*3895766dSshatty WORD wBusIn, 1121*3895766dSshatty int iGain 1122*3895766dSshatty ); 1123*3895766dSshatty 1124*3895766dSshatty virtual ECHOSTATUS GetBusInGain( WORD wBusIn, int &iGain); 1125*3895766dSshatty 1126*3895766dSshatty // 1127*3895766dSshatty // See description of ECHOGALS_METERS above for 1128*3895766dSshatty // data format information. 1129*3895766dSshatty // 1130*3895766dSshatty virtual ECHOSTATUS GetAudioMeters 1131*3895766dSshatty ( 1132*3895766dSshatty PECHOGALS_METERS pMeters 1133*3895766dSshatty ); 1134*3895766dSshatty 1135*3895766dSshatty ECHOSTATUS GetMetersOn 1136*3895766dSshatty ( 1137*3895766dSshatty BOOL & bOn 1138*3895766dSshatty ) 1139*3895766dSshatty { bOn = ( 0 != m_wMeterOnCount ); return ECHOSTATUS_OK; } 1140*3895766dSshatty 1141*3895766dSshatty ECHOSTATUS SetMetersOn( BOOL bOn ); 1142*3895766dSshatty 1143*3895766dSshatty // 1144*3895766dSshatty // Set/get Audio Format 1145*3895766dSshatty // 1146*3895766dSshatty ECHOSTATUS SetAudioFormat 1147*3895766dSshatty ( 1148*3895766dSshatty WORD wPipeIndex, 1149*3895766dSshatty PECHOGALS_AUDIOFORMAT pFormat, 1150*3895766dSshatty BOOL fDitherDigitalInputs 1151*3895766dSshatty ); 1152*3895766dSshatty ECHOSTATUS GetAudioFormat 1153*3895766dSshatty ( 1154*3895766dSshatty WORD wPipeIndex, 1155*3895766dSshatty PECHOGALS_AUDIOFORMAT pFormat 1156*3895766dSshatty ); 1157*3895766dSshatty 1158*3895766dSshatty #ifdef MIDI_SUPPORT 1159*3895766dSshatty 1160*3895766dSshatty // 1161*3895766dSshatty // MIDI output activity 1162*3895766dSshatty // 1163*3895766dSshatty virtual BOOL IsMidiOutActive() 1164*3895766dSshatty { return FALSE; } 1165*3895766dSshatty 1166*3895766dSshatty // 1167*3895766dSshatty // Set MIDI I/O on or off 1168*3895766dSshatty // 1169*3895766dSshatty ECHOSTATUS SetMidiOn( BOOL bOn ); 1170*3895766dSshatty 1171*3895766dSshatty // 1172*3895766dSshatty // Read and write MIDI data 1173*3895766dSshatty // 1174*3895766dSshatty ECHOSTATUS WriteMidi 1175*3895766dSshatty ( 1176*3895766dSshatty PBYTE pData, 1177*3895766dSshatty DWORD dwLength, 1178*3895766dSshatty PDWORD pdwActualCt 1179*3895766dSshatty ); 1180*3895766dSshatty 1181*3895766dSshatty ECHOSTATUS ReadMidi 1182*3895766dSshatty ( 1183*3895766dSshatty WORD wIndex, // Buffer index 1184*3895766dSshatty DWORD & dwData // Return data 1185*3895766dSshatty ); 1186*3895766dSshatty 1187*3895766dSshatty // 1188*3895766dSshatty // Returns TRUE if no more MIDI data can be sent 1189*3895766dSshatty // right now 1190*3895766dSshatty // 1191*3895766dSshatty virtual BOOL MidiOutFull() 1192*3895766dSshatty { 1193*3895766dSshatty if (0 == (GetDspRegister( CHI32_STATUS_REG) & CHI32_STATUS_REG_HF4)) 1194*3895766dSshatty { 1195*3895766dSshatty return TRUE; 1196*3895766dSshatty } 1197*3895766dSshatty 1198*3895766dSshatty return FALSE; 1199*3895766dSshatty } 1200*3895766dSshatty 1201*3895766dSshatty #endif // MIDI_SUPPORT 1202*3895766dSshatty 1203*3895766dSshatty // 1204*3895766dSshatty // Reset the DSP and load new firmware. 1205*3895766dSshatty // 1206*3895766dSshatty virtual ECHOSTATUS LoadFirmware(); 1207*3895766dSshatty 1208*3895766dSshatty // 1209*3895766dSshatty // Put the hardware to sleep 1210*3895766dSshatty // 1211*3895766dSshatty virtual ECHOSTATUS GoComatose(); 1212*3895766dSshatty 1213*3895766dSshatty 1214*3895766dSshatty #ifdef DIGITAL_INPUT_AUTO_MUTE_SUPPORT 1215*3895766dSshatty // 1216*3895766dSshatty // Get and set the digital input auto-mute flag 1217*3895766dSshatty // 1218*3895766dSshatty virtual ECHOSTATUS GetDigitalInputAutoMute(BOOL &fAutoMute); 1219*3895766dSshatty virtual ECHOSTATUS SetDigitalInputAutoMute(BOOL fAutoMute); 1220*3895766dSshatty 1221*3895766dSshatty #endif // DIGITAL_INPUT_AUTO_MUTE_SUPPORT 1222*3895766dSshatty 1223*3895766dSshatty }; // class CDspCommObject 1224*3895766dSshatty 1225*3895766dSshatty typedef CDspCommObject * PCDspCommObject; 1226*3895766dSshatty 1227*3895766dSshatty #ifdef _WIN32 1228*3895766dSshatty #pragma pack( pop ) 1229*3895766dSshatty #endif 1230*3895766dSshatty 1231*3895766dSshatty #endif 1232*3895766dSshatty 1233*3895766dSshatty // **** DspCommObject.h **** 1234