revert between 56095 -> 55830 in arch
[AROS.git] / workbench / devs / AHI / Include / Asm / devices / ahi.i
blob6dbc74e2c7ab3614145927e2d4ede6e03ca6ae21
1 IFND DEVICES_AHI_I
2 DEVICES_AHI_I SET 1
4 **
5 ** $VER: ahi.i 6.0 (02.02.2005)
6 ** :ts=8 (TAB SIZE: 8)
7 **
8 ** ahi.device definitions
9 **
10 ** (C) Copyright 1994-2005 Martin Blom
11 ** All Rights Reserved.
15 *------------------------------------------------------------------------*
18 IFND EXEC_TYPES_I
19 INCLUDE 'exec/types.i'
20 ENDC
22 IFND EXEC_IO_I
23 INCLUDE 'exec/io.i'
24 ENDC
26 IFND UTILITY_TAGITEM_I
27 INCLUDE 'utility/tagitem.i'
28 ENDC
30 *------------------------------------------------------------------------*
33 *** MACROS
35 Fixed MACRO ; A fixed-point value, 16 bits
36 \1 EQU SOFFSET ; to the left of the point and
37 SOFFSET SET SOFFSET+4 ; 16 bits to the right
38 ENDM
40 AHINAME MACRO
41 dc.b "ahi.device",0
42 ENDM
44 ; A handy macro to open the device for use as a library.
45 ; Usage: OPENAHI <version>
46 ; On exit: d0=_AHIBase or NULL for error.
48 OPENAHI MACRO
49 movem.l d1/a0-a1/a6,-(sp)
50 lea AHI_PORT(pc),a0
51 clr.l (a0)+
52 clr.l (a0)+
53 moveq #0,d0
54 move.l d0,(a0)+
56 move.l 4.w,a6
57 jsr _LVOCreateMsgPort(a6)
58 lea AHI_PORT(pc),a0
59 move.l d0,(a0)
60 beq.b AHI_ERROR
61 move.l d0,a0
62 moveq #AHIRequest_SIZEOF,d0
63 jsr _LVOCreateIORequest(a6)
64 lea AHI_IOR(pc),a0
65 move.l d0,(a0)
66 beq.b AHI_ERROR
67 lea AHI_NAME(pc),a0
68 move.l d0,a1
69 move.w #\1,ahir_Version(a1)
70 move.l #AHI_NO_UNIT,d0
71 moveq #0,d1
72 jsr _LVOOpenDevice(a6)
73 lea AHI_DEVICE(pc),a0
74 move.l d0,(a0)
75 bne.b AHI_ERROR
77 move.l AHI_IOR(PC),a0
78 move.l IO_DEVICE(a0),d0
79 bra.b AHI_EXIT
81 AHI_PORT: dc.l 0
82 AHI_IOR: dc.l 0
83 AHI_DEVICE: dc.l 0
84 AHI_NAME: AHINAME
85 even
86 AHI_ERROR:
87 moveq #0,D0
88 AHI_EXIT:
89 movem.l (sp)+,d1/a0-a1/a6
90 ENDM
92 ; Here is the macro for closing the device after it has been
93 ; opened with the OPENAHI macro. Call CLOSEAHI even if OPENAHI
94 ; failed!
96 CLOSEAHI MACRO
97 movem.l d0-d1/a0-a1/a6,-(sp)
98 move.l 4.w,a6
99 lea AHI_DEVICE(pc),a1
100 tst.l (a1)
101 bne.b .ahi_nodevice
102 subq.l #1,(a1)
103 move.l AHI_IOR(pc),a1
104 jsr _LVOCloseDevice(a6)
105 lea AHI_IOR(pc),a1
106 move.l (a1),a0
107 clr.l (a1)
108 jsr _LVODeleteIORequest(a6)
109 .ahi_nodevice
110 lea AHI_PORT(pc),a1
111 move.l (a1),a0
112 clr.l (a1)
113 jsr _LVODeleteMsgPort(a6)
114 movem.l (sp)+,d0-d1/a0-a1/a6
115 ENDM
117 *** STRUCTURES
119 ; AHIAudioCtrl
120 STRUCTURE AHIAudioCtrl,0
121 APTR ahiac_UserData
122 ; Lots of private data follows!
123 LABEL AHIAudioCtrl_SIZEOF ; Do not use!
125 ; AHISoundMessage
126 STRUCTURE AHISoundMessage,0
127 UWORD ahism_Channel
128 LABEL AHISoundMessage_SIZEOF
130 ; AHIRecordMessage
131 STRUCTURE AHIRecordMessage,0
132 ULONG ahirm_Type ; Format of buffer (object)
133 APTR ahirm_Buffer ; Pointer to the sample array
134 ULONG ahirm_Length ; Number of sample frames in buffer
135 LABEL AHIRecordMessage_SIZEOF
137 ; AHISampleInfo
138 STRUCTURE AHISampleInfo,0
139 ULONG ahisi_Type ; Format of samples
140 APTR ahisi_Address ; Address to array of samples
141 ULONG ahisi_Length ; Number of samples in array
142 LABEL AHISampleInfo_SIZEOF
144 ; AHIAudioModeRequester
145 STRUCTURE AHIAudioModeRequester,0
146 ULONG ahiam_AudioID; ; Selected audio mode
147 ULONG ahiam_MixFreq; ; Selected mixing/sampling frequency
149 WORD ahiam_LeftEdge; ; Coordinates of requester on exit
150 WORD ahiam_TopEdge;
151 WORD ahiam_Width;
152 WORD ahiam_Height;
154 BOOL ahiam_InfoOpened; ; Info window opened on exit
155 WORD ahiam_InfoLeftEdge; ; Last coordinates of Info window
156 WORD ahiam_InfoTopEdge;
157 WORD ahiam_InfoWidth;
158 WORD ahiam_InfoHeight;
160 UWORD ahiam_ObsoleteUserData0;
161 UWORD ahiam_ObsoleteUserData1;
162 UWORD ahiam_Pad;
163 APTR ahiam_UserData; ; You can store your own data here (V6)
165 ; Lots of private data follows!
166 LABEL AHIAudioModeRequester_SIZEOF
168 ahie_Effect EQU 0
170 ; AHIEffMasterVolume
171 STRUCTURE AHIEffMasterVolume,0
172 ULONG ahiemv_Effect ; Set to AHIET_MASTERVOLUME
173 Fixed ahiemv_Volume ; See autodocs for range!
174 LABEL AHIEffMasterVolume_SIZEOF
176 ; AHIEffOutputBuffer
177 STRUCTURE AHIEffOutputBuffer,0
178 ULONG ahieob_Effect ; Set to AHIET_OUTPUTBUFFER
179 APTR ahieob_Func
180 ; These fields are filled by AHI
181 ULONG ahieob_Type ; Format of buffer
182 APTR ahieob_Buffer ; Pointer to the sample array
183 ULONG ahieob_Length ; Number of sample frames in buffer
184 LABEL AHIEffOutputBuffer_SIZEOF
186 ; AHIEffDSPMask (V4)
187 STRUCTURE AHIEffDSPMask,0
188 ULONG ahiedm_Effect ; Set to AHIET_DSPMASK
189 UWORD ahiedm_Channels ; Number of elements in array
190 LABEL ahiedm_Mask ; Here follows the UBYTE array
191 LABEL AHIEffDSPMask_SIZEOF
193 AHIEDM_WET EQU 0
194 AHIEDM_DRY EQU 1
196 ; AHIEffDSPEcho (V4)
197 STRUCTURE AHIEffDSPEcho,0
198 ULONG ahiede_Effect ; Set to AHIET_DSPECHO
199 ULONG ahiede_Delay ; In samples
200 Fixed ahiede_Feedback
201 Fixed ahiede_Mix
202 Fixed ahiede_Cross
203 LABEL AHIEffDSPEcho_SIZEOF
205 ; AHIEffChannelInfo (V4)
206 STRUCTURE AHIEffChannelInfo,0
207 ULONG ahieci_Effect ; Set to AHIET_CHANNELINFO
208 APTR ahieci_Func
209 UWORD ahieci_Channels
210 UWORD ahieci_Pad
211 ; The rest is filled by AHI
212 LABEL ahieci_Offset ; The ULONG array follows
213 LABEL AHIEffChannelInfo_SIZEOF
215 *** TAGS
217 AHI_TagBase EQU TAG_USER
218 AHI_TagBaseR EQU AHI_TagBase|$8000
220 ; AHI_AllocAudioA tags
221 AHIA_AudioID EQU AHI_TagBase+1 ; Desired audio mode
222 AHIA_MixFreq EQU AHI_TagBase+2 ; Suggested mixing frequency
223 AHIA_Channels EQU AHI_TagBase+3 ; Suggested number of channels
224 AHIA_Sounds EQU AHI_TagBase+4 ; Number of sounds to use
225 AHIA_SoundFunc EQU AHI_TagBase+5 ; End-of-Sound Hook
226 AHIA_PlayerFunc EQU AHI_TagBase+6 ; Player Hook
227 AHIA_PlayerFreq EQU AHI_TagBase+7 ; Frequency for player Hook (Fixed)
228 AHIA_MinPlayerFreq EQU AHI_TagBase+8 ; Minimum Frequency for player Hook
229 AHIA_MaxPlayerFreq EQU AHI_TagBase+9 ; Maximum Frequency for player Hook
230 AHIA_RecordFunc EQU AHI_TagBase+10 ; Sample recording Hook
231 AHIA_UserData EQU AHI_TagBase+11 ; What to put in ahiac_UserData
232 AHIA_AntiClickSamples EQU AHI_TagBase+13 ; # of samples to smooth (V6)
234 ; AHI_PlayA tags (V4)
235 AHIP_BeginChannel EQU AHI_TagBase+40 ; All command tags should be...
236 AHIP_EndChannel EQU AHI_TagBase+41 ; ... enclosed by these tags.
237 AHIP_Freq EQU AHI_TagBase+50
238 AHIP_Vol EQU AHI_TagBase+51
239 AHIP_Pan EQU AHI_TagBase+52
240 AHIP_Sound EQU AHI_TagBase+53
241 AHIP_Offset EQU AHI_TagBase+54
242 AHIP_Length EQU AHI_TagBase+55
243 AHIP_LoopFreq EQU AHI_TagBase+60
244 AHIP_LoopVol EQU AHI_TagBase+61
245 AHIP_LoopPan EQU AHI_TagBase+62
246 AHIP_LoopSound EQU AHI_TagBase+63
247 AHIP_LoopOffset EQU AHI_TagBase+64
248 AHIP_LoopLength EQU AHI_TagBase+65
250 ; AHI_ControlAudioA tags
251 AHIC_Play EQU AHI_TagBase+80 ; Boolean
252 AHIC_Record EQU AHI_TagBase+81 ; Boolean
253 AHIC_MonitorVolume EQU AHI_TagBase+82
254 AHIC_MonitorVolume_Query EQU AHI_TagBase+83 ; ti_Data is pointer to Fixed (LONG)
255 AHIC_MixFreq_Query EQU AHI_TagBase+84 ; ti_Data is pointer to ULONG
256 * --- New for V2, they will be ignored by V1 ---
257 AHIC_InputGain EQU AHI_TagBase+85
258 AHIC_InputGain_Query EQU AHI_TagBase+86 ; ti_Data is pointer to Fixed (LONG)
259 AHIC_OutputVolume EQU AHI_TagBase+87
260 AHIC_OutputVolume_Query EQU AHI_TagBase+88 ; ti_Data is pointer to Fixed (LONG)
261 AHIC_Input EQU AHI_TagBase+89
262 AHIC_Input_Query EQU AHI_TagBase+90 ; ti_Data is pointer to ULONG
263 AHIC_Output EQU AHI_TagBase+91
264 AHIC_Output_Query EQU AHI_TagBase+92 ; ti_Data is pointer to ULONG
266 ; AHI_GetAudioAttrsA tags
267 AHIDB_AudioID EQU AHI_TagBase+100
268 AHIDB_Driver EQU AHI_TagBaseR+101 ; Pointer to name of driver
269 AHIDB_Flags EQU AHI_TagBase+102 ; Private!
270 AHIDB_Volume EQU AHI_TagBase+103 ; Boolean
271 AHIDB_Panning EQU AHI_TagBase+104 ; Boolean
272 AHIDB_Stereo EQU AHI_TagBase+105 ; Boolean
273 AHIDB_HiFi EQU AHI_TagBase+106 ; Boolean
274 AHIDB_PingPong EQU AHI_TagBase+107 ; Boolean
275 AHIDB_MultTable EQU AHI_TagBase+108 ; Private!
276 AHIDB_Name EQU AHI_TagBaseR+109 ; Pointer to name of this mode
277 AHIDB_Bits EQU AHI_TagBase+110 ; Output bits
278 AHIDB_MaxChannels EQU AHI_TagBase+111 ; Max supported channels
279 AHIDB_MinMixFreq EQU AHI_TagBase+112 ; Min mixing freq. supported
280 AHIDB_MaxMixFreq EQU AHI_TagBase+113 ; Max mixing freq. supported
281 AHIDB_Record EQU AHI_TagBase+114 ; Boolean
282 AHIDB_Frequencies EQU AHI_TagBase+115
283 AHIDB_FrequencyArg EQU AHI_TagBase+116 ; ti_Data is index number!
284 AHIDB_Frequency EQU AHI_TagBase+117
285 AHIDB_Author EQU AHI_TagBase+118 ; Pointer to driver author name
286 AHIDB_Copyright EQU AHI_TagBase+119 ; Pointer to driver copyright notice
287 AHIDB_Version EQU AHI_TagBase+120 ; Pointer to driver version string
288 AHIDB_Annotation EQU AHI_TagBase+121 ; Pointer to driver annotation text
289 AHIDB_IndexArg EQU AHI_TagBase+123 ; ti_Data is frequency!
290 AHIDB_BufferLen EQU AHI_TagBase+122 ; Specifies the string buffer size
291 AHIDB_Index EQU AHI_TagBase+124
292 AHIDB_Realtime EQU AHI_TagBase+125 ; Boolean
293 AHIDB_MaxPlaySamples EQU AHI_TagBase+126 ; It's sample *frames*
294 AHIDB_MaxRecordSamples EQU AHI_TagBase+127 ; It's sample *frames*
295 AHIDB_MixFreq EQU AHI_TagBase+128
296 AHIDB_FullDuplex EQU AHI_TagBase+129 ; Boolean
297 * --- New for V2, they will be ignored by V1 ---
298 AHIDB_MinMonitorVolume EQU AHI_TagBase+130
299 AHIDB_MaxMonitorVolume EQU AHI_TagBase+131
300 AHIDB_MinInputGain EQU AHI_TagBase+132
301 AHIDB_MaxInputGain EQU AHI_TagBase+133
302 AHIDB_MinOutputVolume EQU AHI_TagBase+134
303 AHIDB_MaxOutputVolume EQU AHI_TagBase+135
304 AHIDB_Inputs EQU AHI_TagBase+136
305 AHIDB_InputArg EQU AHI_TagBase+137 * ti_Data is input index
306 AHIDB_Input EQU AHI_TagBase+138
307 AHIDB_Outputs EQU AHI_TagBase+139
308 AHIDB_OutputArg EQU AHI_TagBase+140 * ti_Data is input index
309 AHIDB_Output EQU AHI_TagBase+141
310 * --- New for V4, they will be ignored by V2 and earlier ---
311 AHIDB_Data EQU AHI_TagBaseR+142 ; Private!
312 AHIDB_DriverBaseName EQU AHI_TagBaseR+143 ; Private!
313 * --- New for V6, they will be ignored by V4 and earlier ---
314 AHIDB_MultiChannel EQU AHI_TagBase+144 ; Boolean
316 ; AHI_BestAudioIDA tags
317 * --- New for V4, they will be ignored by V2 and earlier ---
318 AHIB_Dizzy EQU (AHI_TagBase+190)
320 ; AHI_AudioRequestA tags
321 ; Window control
322 AHIR_Window EQU AHI_TagBase+200 ; Parent window
323 AHIR_Screen EQU AHI_TagBase+201 ; Screen to open on if no window
324 AHIR_PubScreenName EQU AHI_TagBase+202 ; Name of public screen
325 AHIR_PrivateIDCMP EQU AHI_TagBase+203 ; Allocate private IDCMP?
326 AHIR_IntuiMsgFunc EQU AHI_TagBase+204 ; Function to handle IntuiMessages
327 AHIR_SleepWindow EQU AHI_TagBase+205 ; Block input in AHIR_Window?
328 AHIR_ObsoleteUserData EQU AHI_TagBase+206 ; V4 UserData
329 AHIR_UserData EQU AHI_TagBase+207 ; What to put in ahiam_UserData (V6)
330 ; Text display
331 AHIR_TextAttr EQU AHI_TagBase+220 ; Text font to use for gadget text
332 AHIR_Locale EQU AHI_TagBase+221 ; Locale to use for text
333 AHIR_TitleText EQU AHI_TagBase+222 ; Title of requester
334 AHIR_PositiveText EQU AHI_TagBase+223 ; Positive gadget text
335 AHIR_NegativeText EQU AHI_TagBase+224 ; Negative gadget text
336 ; Initial settings
337 AHIR_InitialLeftEdge EQU AHI_TagBase+240 ; Initial requester coordinates
338 AHIR_InitialTopEdge EQU AHI_TagBase+241
339 AHIR_InitialWidth EQU AHI_TagBase+242 ; Initial requester dimensions
340 AHIR_InitialHeight EQU AHI_TagBase+243
341 AHIR_InitialAudioID EQU AHI_TagBase+244 ; Initial audio mode id
342 AHIR_InitialMixFreq EQU AHI_TagBase+245 ; Initial mixing/sampling frequency
343 AHIR_InitialInfoOpened EQU AHI_TagBase+246 ; Info window initially opened?
344 AHIR_InitialInfoLeftEdge EQU AHI_TagBase+247 ; Initial Info window coords.
345 AHIR_InitialInfoTopEdge EQU AHI_TagBase+248
346 AHIR_InitialInfoWidth EQU AHI_TagBase+249 ; Not used!
347 AHIR_InitialInfoHeight EQU AHI_TagBase+250 ; Not used!
348 ; Options
349 AHIR_DoMixFreq EQU AHI_TagBase+260 ; Allow selection of mixing frequency?
350 AHIR_DoDefaultMode EQU AHI_TagBase+261 ; Allow selection of default mode? (V4)
351 ; Filtering
352 AHIR_FilterTags EQU AHI_TagBase+270 ; Pointer to filter taglist
353 AHIR_FilterFunc EQU AHI_TagBase+271 ; Function to filter mode id's
356 *** DEFS
358 AHI_INVALID_ID EQU ~0 ; Invalid Audio ID
359 AHI_DEFAULT_ID EQU $00000000 ; Only for AHI_AllocAudioA()!
360 AHI_LOOPBACK_ID EQU $00000001 ; Special sample render ID
361 AHI_DEFAULT_FREQ EQU 0 ; Only for AHI_AllocAudioA()!
362 AHI_MIXFREQ EQU ~0 ; Special frequency for AHI_SetFreq()
363 AHI_NOSOUND EQU ~0 ; Turns a channel off
365 ; Set#? Flags
366 BITDEF AHIS,IMM,0 ; Trigger action immediately
367 BITDEF AHIS,NODELAY,1 ; Don't wait for zero-crossing
369 AHISF_NONE EQU 0 ; No flags (V6)
372 ; Effect types
373 AHIET_CANCEL EQU 1<<31 ; OR with effect to disable
374 AHIET_MASTERVOLUME EQU 1
375 AHIET_OUTPUTBUFFER EQU 2
376 * --- New for V4 ---
377 AHIET_DSPMASK EQU 3
378 AHIET_DSPECHO EQU 4
379 AHIET_CHANNELINFO EQU 5
381 ; Sound types
382 AHIST_NOTYPE EQU ~0 ; Private
383 AHIST_SAMPLE EQU 0 ; 8 or 16 bit sample
384 AHIST_DYNAMICSAMPLE EQU 1 ; Dynamic sample
385 AHIST_INPUT EQU 1<<29 ; The input from your sampler
386 AHIST_BW EQU 1<<30 ; Private
388 ; Sample types
389 ; Note that only AHIST_M8S, AHIST_S8S, AHIST_M16S and AHIST_S16S
390 ; (plus AHIST_M32S, AHIST_S32S and AHIST_L7_1 in V6)
391 ; are supported by AHI_LoadSound().
392 AHIST_M8S EQU 0 ; Mono, 8 bit signed (BYTE)
393 AHIST_M16S EQU 1 ; Mono, 16 bit signed (WORD)
394 AHIST_S8S EQU 2 ; Stereo, 8 bit signed (2×BYTE)
395 AHIST_S16S EQU 3 ; Stereo, 16 bit signed (2×WORD)
396 AHIST_M32S EQU 8 ; Mono, 32 bit signed (LONG)
397 AHIST_S32S EQU 10 ; Stereo, 32 bit signed (2×LONG)
399 AHIST_M8U EQU 4 ; OBSOLETE!
401 AHIST_L7_1 EQU $00c3000a ; 7.1, 32 bit signed (8×LONG)
403 ; Error codes
404 AHIE_OK EQU 0 ; No error
405 AHIE_NOMEM EQU 1 ; Out of memory
406 AHIE_BADSOUNDTYPE EQU 2 ; Unknown sound type
407 AHIE_BADSAMPLETYPE EQU 3 ; Unknown/unsupported sample type
408 AHIE_ABORTED EQU 4 ; User-triggered abortion
409 AHIE_UNKNOWN EQU 5 ; Error, but unknown
410 AHIE_HALFDUPLEX EQU 6 ; CMD_WRITE/CMD_READ failure
414 *- DEVICE INTERFACE DEFINITIONS FOLLOWS ------------------------------------*
416 ; Device units
418 AHI_DEFAULT_UNIT EQU 0
419 AHI_NO_UNIT EQU 255
422 ; The preference file
424 ID_AHIU EQU "AHIU"
425 ID_AHIG EQU "AHIG"
427 STRUCTURE AHIUnitPrefs,0
428 UBYTE ahiup_Unit
429 UBYTE ahiup_Obsolete ; Was ahiup_ScaleMode
430 UWORD ahiup_Channels
431 ULONG ahiup_AudioMode
432 ULONG ahiup_Frequency
433 Fixed ahiup_MonitorVolume
434 Fixed ahiup_InputGain
435 Fixed ahiup_OutputVolume
436 ULONG ahiup_Input
437 ULONG ahiup_Output
438 LABEL AHIUnitPrefs_SIZEOF
441 STRUCTURE AHIGlobalPrefs,0
442 UWORD ahigp_DebugLevel ; Range: 0-3 (for None, Low,
443 ; High and All
444 BOOL ahigp_DisableSurround
445 BOOL ahigp_DisableEcho
446 BOOL ahigp_FastEcho
447 Fixed ahigp_MaxCPU
448 BOOL ahigp_ClipMasterVolume
449 UWORD ahigp_Pad;
450 Fixed ahigp_AntiClickTime; ; In seconds (V6)
451 UWORD ahigp_ScaleMode ; See below (V6)
452 LABEL AHIGlobalPrefs_SIZEOF
454 ; Debug levels
456 AHI_DEBUG_NONE EQU (0)
457 AHI_DEBUG_LOW EQU (1)
458 AHI_DEBUG_HIGH EQU (2)
459 AHI_DEBUG_ALL EQU (3)
461 ; Scale modes
463 AHI_SCALE_FIXED_SAFE EQU (0) ; x=y*1/max(ch)
464 AHI_SCALE_DYNAMIC_SAFE EQU (1) ; x=y*1/ch
465 AHI_SCALE_FIXED_0_DB EQU (2) ; x=y
466 AHI_SCALE_FIXED_3_DB EQU (3) ; x=y*1/sqrt(2)
467 AHI_SCALE_FIXED_6_DB EQU (4) ; x=y*1/2
469 ; AHIRequest
471 STRUCTURE AHIRequest,0
472 STRUCT ahir_Std,IOSTD_SIZE ; Standard IO request
473 UWORD ahir_Version ; Needed version
474 * --- New for V4, they will be ignored by V2 and earlier ---
475 UWORD ahir_Pad1
476 ULONG ahir_Private1 ; Hands off!
477 ULONG ahir_Private2 ; Hands off!
478 ULONG ahir_Type ; Sample format
479 ULONG ahir_Frequency ; Sample/Record frequency
480 Fixed ahir_Volume ; Sample volume
481 Fixed ahir_Position ; Stereo position
482 APTR ahir_Link ; For double buffering
483 LABEL AHIRequest_SIZEOF
485 ; Flags for OpenDevice()
487 BITDEF AHID,NOMODESCAN,0
489 ENDC ; DEVICES_AHI_I