1 #ifndef DEVICES_AHI_H 2 #define DEVICES_AHI_H 3 4 /* 5 ** $VER: ahi.h 5.5 (5.1.2005) 6 ** 7 ** ahi.device definitions 8 ** 9 ** (C) Copyright 1994-2005 Martin Blom 10 ** All Rights Reserved. 11 ** 12 ** (TAB SIZE: 8) 13 */ 14 15 /*****************************************************************************/ 16 17 #ifndef EXEC_TYPES_H 18 #include <exec/types.h> 19 #endif 20 21 #ifndef EXEC_IO_H 22 #include <exec/io.h> 23 #endif 24 25 #ifndef UTILITY_TAGITEM_H 26 #include <utility/tagitem.h> 27 #endif 28 29 #ifndef LIBRARIES_IFFPARSE_H 30 #include <libraries/iffparse.h> 31 #endif 32 33 #pragma pack(2) 34 35 /*****************************************************************************/ 36 37 #ifndef EIGHTSVX_H /* Do not define Fixed twice */ 38 39 typedef LONG Fixed; /* A fixed-point value, 16 bits 40 to the left of the point and 41 16 bits to the right */ 42 #endif 43 typedef Fixed sposition; 44 45 /*** STRUCTURES */ 46 47 /* AHIAudioCtrl */ 48 struct AHIAudioCtrl 49 { 50 APTR ahiac_UserData; 51 /* Lots of private data follows! */ 52 }; 53 54 /* AHISoundMessage */ 55 struct AHISoundMessage 56 { 57 UWORD ahism_Channel; 58 }; 59 60 /* AHIRecordMessage */ 61 struct AHIRecordMessage 62 { 63 ULONG ahirm_Type; /* Format of buffer (object) */ 64 APTR ahirm_Buffer; /* Pointer to the sample array */ 65 ULONG ahirm_Length; /* Number of sample frames in buffer */ 66 }; 67 68 /* AHISampleInfo */ 69 struct AHISampleInfo 70 { 71 ULONG ahisi_Type; /* Format of samples */ 72 APTR ahisi_Address; /* Address to array of samples */ 73 ULONG ahisi_Length; /* Number of samples in array */ 74 }; 75 76 77 /* AHIAudioModeRequester */ 78 struct AHIAudioModeRequester 79 { 80 ULONG ahiam_AudioID; /* Selected audio mode */ 81 ULONG ahiam_MixFreq; /* Selected mixing/sampling frequency */ 82 83 WORD ahiam_LeftEdge; /* Coordinates of requester on exit */ 84 WORD ahiam_TopEdge; 85 WORD ahiam_Width; 86 WORD ahiam_Height; 87 88 BOOL ahiam_InfoOpened; /* Info window opened on exit? */ 89 WORD ahiam_InfoLeftEdge; /* Last coordinates of Info window */ 90 WORD ahiam_InfoTopEdge; 91 WORD ahiam_InfoWidth; 92 WORD ahiam_InfoHeight; 93 94 UWORD ahiam_ObsoleteUserData[2]; 95 UWORD ahiam_Pad; 96 APTR ahiam_UserData; /* You can store your own data here (V6) */ 97 /* Lots of private data follows! */ 98 }; 99 100 /* AHIEffMasterVolume */ 101 struct AHIEffMasterVolume 102 { 103 ULONG ahie_Effect; /* Set to AHIET_MASTERVOLUME */ 104 Fixed ahiemv_Volume; /* See autodocs for range! */ 105 }; 106 107 /* AHIEffOutputBuffer */ 108 struct AHIEffOutputBuffer 109 { 110 ULONG ahie_Effect; /* Set to AHIET_OUTPUTBUFFER */ 111 struct Hook *ahieob_Func; 112 /* These fields are filled by AHI */ 113 ULONG ahieob_Type; /* Format of buffer */ 114 APTR ahieob_Buffer; /* Pointer to the sample array */ 115 ULONG ahieob_Length; /* Number of sample frames in buffer */ 116 }; 117 118 /* AHIEffDSPMask (V4) */ 119 struct AHIEffDSPMask 120 { 121 ULONG ahie_Effect; /* Set to AHIET_DSPMASK */ 122 UWORD ahiedm_Channels; /* Number of elements in array */ 123 UBYTE ahiedm_Mask[0]; /* Here follows the array */ 124 }; 125 126 #define AHIEDM_WET (0) 127 #define AHIEDM_DRY (1) 128 129 /* AHIEffDSPEcho (V4) */ 130 struct AHIEffDSPEcho 131 { 132 ULONG ahie_Effect; /* Set to AHIET_DSPECHO */ 133 ULONG ahiede_Delay; /* In samples */ 134 Fixed ahiede_Feedback; 135 Fixed ahiede_Mix; 136 Fixed ahiede_Cross; 137 }; 138 139 #define AHIDSPEcho AHIEffDSPEcho /* Fix for error in V4 includes */ 140 141 /* AHIEffChannelInfo (V4) */ 142 143 struct AHIEffChannelInfo 144 { 145 ULONG ahie_Effect; /* Set to AHIET_CHANNELINFO */ 146 struct Hook *ahieci_Func; 147 UWORD ahieci_Channels; 148 UWORD ahieci_Pad; 149 /* The rest is filled by AHI */ 150 ULONG ahieci_Offset[0]; /* The array follows */ 151 }; 152 153 /*** TAGS */ 154 155 #define AHI_TagBase (TAG_USER) 156 #define AHI_TagBaseR (AHI_TagBase|0x8000) 157 158 /* AHI_AllocAudioA tags */ 159 #define AHIA_AudioID (AHI_TagBase+1) /* Desired audio mode */ 160 #define AHIA_MixFreq (AHI_TagBase+2) /* Suggested mixing frequency */ 161 #define AHIA_Channels (AHI_TagBase+3) /* Suggested number of channels */ 162 #define AHIA_Sounds (AHI_TagBase+4) /* Number of sounds to use */ 163 #define AHIA_SoundFunc (AHI_TagBase+5) /* End-of-Sound Hook */ 164 #define AHIA_PlayerFunc (AHI_TagBase+6) /* Player Hook */ 165 #define AHIA_PlayerFreq (AHI_TagBase+7) /* Frequency for player Hook (Fixed)*/ 166 #define AHIA_MinPlayerFreq (AHI_TagBase+8) /* Minimum Frequency for player Hook */ 167 #define AHIA_MaxPlayerFreq (AHI_TagBase+9) /* Maximum Frequency for player Hook */ 168 #define AHIA_RecordFunc (AHI_TagBase+10) /* Sample recording Hook */ 169 #define AHIA_UserData (AHI_TagBase+11) /* What to put in ahiac_UserData */ 170 #define AHIA_AntiClickSamples (AHI_TagBase+13) /* # of samples to smooth (V6) */ 171 172 /* AHI_PlayA tags (V4) */ 173 #define AHIP_BeginChannel (AHI_TagBase+40) /* All command tags should be... */ 174 #define AHIP_EndChannel (AHI_TagBase+41) /* ... enclosed by these tags. */ 175 #define AHIP_Freq (AHI_TagBase+50) 176 #define AHIP_Vol (AHI_TagBase+51) 177 #define AHIP_Pan (AHI_TagBase+52) 178 #define AHIP_Sound (AHI_TagBase+53) 179 #define AHIP_Offset (AHI_TagBase+54) 180 #define AHIP_Length (AHI_TagBase+55) 181 #define AHIP_LoopFreq (AHI_TagBase+60) 182 #define AHIP_LoopVol (AHI_TagBase+61) 183 #define AHIP_LoopPan (AHI_TagBase+62) 184 #define AHIP_LoopSound (AHI_TagBase+63) 185 #define AHIP_LoopOffset (AHI_TagBase+64) 186 #define AHIP_LoopLength (AHI_TagBase+65) 187 188 /* AHI_ControlAudioA tags */ 189 #define AHIC_Play (AHI_TagBase+80) /* Boolean */ 190 #define AHIC_Record (AHI_TagBase+81) /* Boolean */ 191 #define AHIC_MonitorVolume (AHI_TagBase+82) 192 #define AHIC_MonitorVolume_Query (AHI_TagBase+83) /* ti_Data is pointer to Fixed (LONG) */ 193 #define AHIC_MixFreq_Query (AHI_TagBase+84) /* ti_Data is pointer to ULONG */ 194 /* --- New for V2, they will be ignored by V1 --- */ 195 #define AHIC_InputGain (AHI_TagBase+85) 196 #define AHIC_InputGain_Query (AHI_TagBase+86) /* ti_Data is pointer to Fixed (LONG) */ 197 #define AHIC_OutputVolume (AHI_TagBase+87) 198 #define AHIC_OutputVolume_Query (AHI_TagBase+88) /* ti_Data is pointer to Fixed (LONG) */ 199 #define AHIC_Input (AHI_TagBase+89) 200 #define AHIC_Input_Query (AHI_TagBase+90) /* ti_Data is pointer to ULONG */ 201 #define AHIC_Output (AHI_TagBase+91) 202 #define AHIC_Output_Query (AHI_TagBase+92) /* ti_Data is pointer to ULONG */ 203 204 /* AHI_GetAudioAttrsA tags */ 205 #define AHIDB_AudioID (AHI_TagBase+100) 206 #define AHIDB_Driver (AHI_TagBaseR+101) /* Pointer to name of driver */ 207 #define AHIDB_Flags (AHI_TagBase+102) /* Private! */ 208 #define AHIDB_Volume (AHI_TagBase+103) /* Boolean */ 209 #define AHIDB_Panning (AHI_TagBase+104) /* Boolean */ 210 #define AHIDB_Stereo (AHI_TagBase+105) /* Boolean */ 211 #define AHIDB_HiFi (AHI_TagBase+106) /* Boolean */ 212 #define AHIDB_PingPong (AHI_TagBase+107) /* Boolean */ 213 #define AHIDB_MultTable (AHI_TagBase+108) /* Private! */ 214 #define AHIDB_Name (AHI_TagBaseR+109) /* Pointer to name of this mode */ 215 #define AHIDB_Bits (AHI_TagBase+110) /* Output bits */ 216 #define AHIDB_MaxChannels (AHI_TagBase+111) /* Max supported channels */ 217 #define AHIDB_MinMixFreq (AHI_TagBase+112) /* Min mixing freq. supported */ 218 #define AHIDB_MaxMixFreq (AHI_TagBase+113) /* Max mixing freq. supported */ 219 #define AHIDB_Record (AHI_TagBase+114) /* Boolean */ 220 #define AHIDB_Frequencies (AHI_TagBase+115) 221 #define AHIDB_FrequencyArg (AHI_TagBase+116) /* ti_Data is frequency index */ 222 #define AHIDB_Frequency (AHI_TagBase+117) 223 #define AHIDB_Author (AHI_TagBase+118) /* Pointer to driver author name */ 224 #define AHIDB_Copyright (AHI_TagBase+119) /* Pointer to driver copyright notice */ 225 #define AHIDB_Version (AHI_TagBase+120) /* Pointer to driver version string */ 226 #define AHIDB_Annotation (AHI_TagBase+121) /* Pointer to driver annotation text */ 227 #define AHIDB_BufferLen (AHI_TagBase+122) /* Specifies the string buffer size */ 228 #define AHIDB_IndexArg (AHI_TagBase+123) /* ti_Data is frequency! */ 229 #define AHIDB_Index (AHI_TagBase+124) 230 #define AHIDB_Realtime (AHI_TagBase+125) /* Boolean */ 231 #define AHIDB_MaxPlaySamples (AHI_TagBase+126) /* It's sample *frames* */ 232 #define AHIDB_MaxRecordSamples (AHI_TagBase+127) /* It's sample *frames* */ 233 #define AHIDB_FullDuplex (AHI_TagBase+129) /* Boolean */ 234 /* --- New for V2, they will be ignored by V1 --- */ 235 #define AHIDB_MinMonitorVolume (AHI_TagBase+130) 236 #define AHIDB_MaxMonitorVolume (AHI_TagBase+131) 237 #define AHIDB_MinInputGain (AHI_TagBase+132) 238 #define AHIDB_MaxInputGain (AHI_TagBase+133) 239 #define AHIDB_MinOutputVolume (AHI_TagBase+134) 240 #define AHIDB_MaxOutputVolume (AHI_TagBase+135) 241 #define AHIDB_Inputs (AHI_TagBase+136) 242 #define AHIDB_InputArg (AHI_TagBase+137) /* ti_Data is input index */ 243 #define AHIDB_Input (AHI_TagBase+138) 244 #define AHIDB_Outputs (AHI_TagBase+139) 245 #define AHIDB_OutputArg (AHI_TagBase+140) /* ti_Data is input index */ 246 #define AHIDB_Output (AHI_TagBase+141) 247 /* --- New for V4, they will be ignored by V2 and earlier --- */ 248 #define AHIDB_Data (AHI_TagBaseR+142) /* Private! */ 249 #define AHIDB_DriverBaseName (AHI_TagBaseR+143) /* Private! */ 250 /* --- New for V6, they will be ignored by V4 and earlier --- */ 251 #define AHIDB_MultiChannel (AHI_TagBase+144) /* Boolean */ 252 253 /* AHI_BestAudioIDA tags */ 254 /* --- New for V4, they will be ignored by V2 and earlier --- */ 255 #define AHIB_Dizzy (AHI_TagBase+190) 256 257 /* AHI_AudioRequestA tags */ 258 /* Window control */ 259 #define AHIR_Window (AHI_TagBase+200) /* Parent window */ 260 #define AHIR_Screen (AHI_TagBase+201) /* Screen to open on if no window */ 261 #define AHIR_PubScreenName (AHI_TagBase+202) /* Name of public screen */ 262 #define AHIR_PrivateIDCMP (AHI_TagBase+203) /* Allocate private IDCMP? */ 263 #define AHIR_IntuiMsgFunc (AHI_TagBase+204) /* Function to handle IntuiMessages */ 264 #define AHIR_SleepWindow (AHI_TagBase+205) /* Block input in AHIR_Window? */ 265 #define AHIR_ObsoleteUserData (AHI_TagBase+206) /* V4 UserData */ 266 #define AHIR_UserData (AHI_TagBase+207) /* What to put in ahiam_UserData (V6) */ 267 /* Text display */ 268 #define AHIR_TextAttr (AHI_TagBase+220) /* Text font to use for gadget text */ 269 #define AHIR_Locale (AHI_TagBase+221) /* Locale to use for text */ 270 #define AHIR_TitleText (AHI_TagBase+222) /* Title of requester */ 271 #define AHIR_PositiveText (AHI_TagBase+223) /* Positive gadget text */ 272 #define AHIR_NegativeText (AHI_TagBase+224) /* Negative gadget text */ 273 /* Initial settings */ 274 #define AHIR_InitialLeftEdge (AHI_TagBase+240) /* Initial requester coordinates */ 275 #define AHIR_InitialTopEdge (AHI_TagBase+241) 276 #define AHIR_InitialWidth (AHI_TagBase+242) /* Initial requester dimensions */ 277 #define AHIR_InitialHeight (AHI_TagBase+243) 278 #define AHIR_InitialAudioID (AHI_TagBase+244) /* Initial audio mode id */ 279 #define AHIR_InitialMixFreq (AHI_TagBase+245) /* Initial mixing/sampling frequency */ 280 #define AHIR_InitialInfoOpened (AHI_TagBase+246) /* Info window initially opened? */ 281 #define AHIR_InitialInfoLeftEdge (AHI_TagBase+247) /* Initial Info window coords. */ 282 #define AHIR_InitialInfoTopEdge (AHI_TagBase+248) 283 #define AHIR_InitialInfoWidth (AHI_TagBase+249) /* Not used! */ 284 #define AHIR_InitialInfoHeight (AHI_TagBase+250) /* Not used! */ 285 /* Options */ 286 #define AHIR_DoMixFreq (AHI_TagBase+260) /* Allow selection of mixing frequency? */ 287 #define AHIR_DoDefaultMode (AHI_TagBase+261) /* Allow selection of default mode? (V4) */ 288 /* Filtering */ 289 #define AHIR_FilterTags (AHI_TagBase+270) /* Pointer to filter taglist */ 290 #define AHIR_FilterFunc (AHI_TagBase+271) /* Function to filter mode id's */ 291 292 /*** DEFS */ 293 294 #define AHINAME "ahi.device" 295 #define AHI_INVALID_ID (~0UL) /* Invalid Audio ID */ 296 #define AHI_DEFAULT_ID (0x00000000UL) /* Only for AHI_AllocAudioA()! */ 297 #define AHI_LOOPBACK_ID (0x00000001UL) /* Special sample render Audio ID */ 298 #define AHI_DEFAULT_FREQ (0UL) /* Only for AHI_AllocAudioA()! */ 299 #define AHI_MIXFREQ (~0UL) /* Special frequency for AHI_SetFreq() */ 300 #define AHI_NOSOUND (0xffffU) /* Turns a channel off */ 301 302 /* Set#? Flags */ 303 #define AHISF_IMM (1UL<<0) /* Trigger action immediately */ 304 #define AHISF_NODELAY (1UL<<1) /* Don't wait for zero-crossing */ 305 306 #define AHISF_NONE (0UL) /* No flags (V6) */ 307 308 #define AHISB_IMM (0UL) 309 #define AHISB_NODELAY (1UL) 310 311 /* Effect Types */ 312 #define AHIET_CANCEL (1UL<<31) /* OR with effect to disable */ 313 #define AHIET_MASTERVOLUME (1UL) 314 #define AHIET_OUTPUTBUFFER (2UL) 315 /* --- New for V4 --- */ 316 #define AHIET_DSPMASK (3UL) 317 #define AHIET_DSPECHO (4UL) 318 #define AHIET_CHANNELINFO (5UL) 319 320 /* Sound Types */ 321 #define AHIST_NOTYPE (~0UL) /* Private */ 322 #define AHIST_SAMPLE (0UL) /* 8 or 16 bit sample */ 323 #define AHIST_DYNAMICSAMPLE (1UL) /* Dynamic sample */ 324 #define AHIST_INPUT (1UL<<29) /* The input from your sampler */ 325 #define AHIST_BW (1UL<<30) /* Private */ 326 327 /* Sample types */ 328 /* Note that only AHIST_M8S, AHIST_S8S, AHIST_M16S and AHIST_S16S 329 (plus AHIST_M32S, AHIST_S32S and AHIST_L7_1 in V6) 330 are supported by AHI_LoadSound(). */ 331 #define AHIST_M8S (0UL) /* Mono, 8 bit signed (BYTE) */ 332 #define AHIST_M16S (1UL) /* Mono, 16 bit signed (WORD) */ 333 #define AHIST_S8S (2UL) /* Stereo, 8 bit signed (2×BYTE) */ 334 #define AHIST_S16S (3UL) /* Stereo, 16 bit signed (2×WORD) */ 335 #define AHIST_M32S (8UL) /* Mono, 32 bit signed (LONG) */ 336 #define AHIST_S32S (10UL) /* Stereo, 32 bit signed (2×LONG) */ 337 338 #define AHIST_M8U (4UL) /* OBSOLETE! */ 339 #define AHIST_L7_1 (0x00c3000aUL) /* 7.1, 32 bit signed (8×LONG) */ 340 341 /* Error codes */ 342 #define AHIE_OK (0UL) /* No error */ 343 #define AHIE_NOMEM (1UL) /* Out of memory */ 344 #define AHIE_BADSOUNDTYPE (2UL) /* Unknown sound type */ 345 #define AHIE_BADSAMPLETYPE (3UL) /* Unknown/unsupported sample type */ 346 #define AHIE_ABORTED (4UL) /* User-triggered abortion */ 347 #define AHIE_UNKNOWN (5UL) /* Error, but unknown */ 348 #define AHIE_HALFDUPLEX (6UL) /* CMD_WRITE/CMD_READ failure */ 349 350 351 352 /* DEVICE INTERFACE DEFINITIONS FOLLOWS ************************************/ 353 354 /* Device units */ 355 356 #define AHI_DEFAULT_UNIT (0U) 357 #define AHI_NO_UNIT (255U) 358 359 360 /* The preference file */ 361 362 #define ID_AHIU MAKE_ID('A','H','I','U') 363 #define ID_AHIG MAKE_ID('A','H','I','G') 364 365 struct AHIUnitPrefs 366 { 367 UBYTE ahiup_Unit; 368 UBYTE ahiup_Obsolete; /* Was ahiup_ScaleMode */ 369 UWORD ahiup_Channels; 370 ULONG ahiup_AudioMode; 371 ULONG ahiup_Frequency; 372 Fixed ahiup_MonitorVolume; 373 Fixed ahiup_InputGain; 374 Fixed ahiup_OutputVolume; 375 ULONG ahiup_Input; 376 ULONG ahiup_Output; 377 }; 378 #define ahiup_Pad ahiup_Obsolete /* For src compatibility */ 379 380 struct AHIGlobalPrefs 381 { 382 UWORD ahigp_DebugLevel; /* Range: 0-3 (for None, Low, 383 High and All) */ 384 BOOL ahigp_DisableSurround; 385 BOOL ahigp_DisableEcho; 386 BOOL ahigp_FastEcho; 387 Fixed ahigp_MaxCPU; 388 BOOL ahigp_ClipMasterVolume; 389 UWORD ahigp_Pad; 390 Fixed ahigp_AntiClickTime; /* In seconds (V6) */ 391 UWORD ahigp_ScaleMode; /* See below (V6) */ 392 }; 393 394 /* Debug levels */ 395 #define AHI_DEBUG_NONE (0U) 396 #define AHI_DEBUG_LOW (1U) 397 #define AHI_DEBUG_HIGH (2U) 398 #define AHI_DEBUG_ALL (3U) 399 400 /* Scale modes */ 401 #define AHI_SCALE_FIXED_SAFE (0U) /* x=y*1/max(ch) */ 402 #define AHI_SCALE_DYNAMIC_SAFE (1U) /* x=y*1/ch */ 403 #define AHI_SCALE_FIXED_0_DB (2U) /* x=y */ 404 #define AHI_SCALE_FIXED_3_DB (3U) /* x=y*1/sqrt(2) */ 405 #define AHI_SCALE_FIXED_6_DB (4U) /* x=y*1/2 */ 406 407 /* AHIRequest */ 408 409 struct AHIRequest 410 { 411 struct IOStdReq ahir_Std; /* Standard IO request */ 412 UWORD ahir_Version; /* Needed version */ 413 /* --- New for V4, they will be ignored by V2 and earlier --- */ 414 UWORD ahir_Pad1; 415 ULONG ahir_Private[2]; /* Hands off! */ 416 ULONG ahir_Type; /* Sample format */ 417 ULONG ahir_Frequency; /* Sample/Record frequency */ 418 Fixed ahir_Volume; /* Sample volume */ 419 Fixed ahir_Position; /* Stereo position */ 420 struct AHIRequest *ahir_Link; /* For double buffering */ 421 }; 422 423 /* Flags for OpenDevice() */ 424 425 #define AHIDF_NOMODESCAN (1UL<<0) 426 #define AHIDB_NOMODESCAN (0UL) 427 428 #pragma pack() 429 430 #endif /* DEVICES_AHI_H */