Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / AHI / Device / debug.c
blobd7c9d4c8104297763d3f44bad675c87bb817ef24
1 /*
2 AHI - Hardware independent audio subsystem
3 Copyright (C) 1996-2005 Martin Blom <martin@blom.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
18 MA 02139, USA.
21 #include <config.h>
23 #include <utility/tagitem.h>
24 #include <proto/exec.h>
25 #include <proto/utility.h>
27 #include "ahi_def.h"
28 #include "debug.h"
30 /******************************************************************************
31 ** Support code ***************************************************************
32 ******************************************************************************/
34 static const char*
35 GetTagName( Tag tag )
37 switch( tag )
39 case AHIA_AudioID: return "AHIA_AudioID";
40 case AHIA_MixFreq: return "AHIA_MixFreq";
41 case AHIA_Channels: return "AHIA_Channels";
42 case AHIA_Sounds: return "AHIA_Sounds";
43 case AHIA_SoundFunc: return "AHIA_SoundFunc";
44 case AHIA_PlayerFunc: return "AHIA_PlayerFunc";
45 case AHIA_PlayerFreq: return "AHIA_PlayerFreq";
46 case AHIA_MinPlayerFreq: return "AHIA_MinPlayerFreq";
47 case AHIA_MaxPlayerFreq: return "AHIA_MaxPlayerFreq";
48 // case AHIA_PlayerFreqUnit: return "AHIA_PlayerFreqUnit";
49 case AHIA_RecordFunc: return "AHIA_RecordFunc";
50 case AHIA_UserData: return "AHIA_UserData";
51 // case AHIA_ErrorFunc: return "AHIA_ErrorFunc";
52 case AHIA_AntiClickSamples: return "AHIA_AntiClickSamples";
53 case AHIP_BeginChannel: return "AHIP_BeginChannel";
54 case AHIP_EndChannel: return "AHIP_EndChannel";
55 case AHIP_Freq: return "AHIP_Freq";
56 case AHIP_Vol: return "AHIP_Vol";
57 case AHIP_Pan: return "AHIP_Pan";
58 case AHIP_Sound: return "AHIP_Sound";
59 case AHIP_Offset: return "AHIP_Offset";
60 case AHIP_Length: return "AHIP_Length";
61 case AHIP_LoopFreq: return "AHIP_LoopFreq";
62 case AHIP_LoopVol: return "AHIP_LoopVol";
63 case AHIP_LoopPan: return "AHIP_LoopPan";
64 case AHIP_LoopSound: return "AHIP_LoopSound";
65 case AHIP_LoopOffset: return "AHIP_LoopOffset";
66 case AHIP_LoopLength: return "AHIP_LoopLength";
67 case AHIC_Play: return "AHIC_Play";
68 case AHIC_Record: return "AHIC_Record";
69 // case AHIC_PausePlay: return "AHIC_PausePlay";
70 // case AHIC_PauseRecord: return "AHIC_PauseRecord";
71 case AHIC_MixFreq_Query: return "AHIC_MixFreq_Query";
72 case AHIC_Input: return "AHIC_Input";
73 case AHIC_Input_Query: return "AHIC_Input_Query";
74 case AHIC_Output: return "AHIC_Output";
75 case AHIC_Output_Query: return "AHIC_Output_Query";
76 // case AHIC_MonitorVolumeLeft: return "AHIC_MonitorVolumeLeft";
77 // case AHIC_MonitorVolumeLeft_Query: return "AHIC_MonitorVolumeLeft_Query";
78 // case AHIC_MonitorVolumeRight: return "AHIC_MonitorVolumeRight";
79 // case AHIC_MonitorVolumeRight_Query: return "AHIC_MonitorVolumeRight_Query";
80 // case AHIC_OutputVolumeLeft: return "AHIC_OutputVolumeLeft";
81 // case AHIC_OutputVolumeLeft_Query: return "AHIC_OutputVolumeLeft_Query";
82 // case AHIC_OutputVolumeRight: return "AHIC_OutputVolumeRight";
83 // case AHIC_OutputVolumeRight_Query: return "AHIC_OutputVolumeRight_Query";
84 // case AHIC_InputGainLeft: return "AHIC_InputGainLeft";
85 // case AHIC_InputGainLeft_Query: return "AHIC_InputGainLeft_Query";
86 // case AHIC_InputGainRight: return "AHIC_InputGainRight";
87 // case AHIC_InputGainRight_Query: return "AHIC_InputGainRight_Query";
88 // case AHIC_PlaySampleFormat: return "AHIC_PlaySampleFormat";
89 // case AHIC_PlaySampleFormat_Query: return "AHIC_PlaySampleFormat_Query";
90 // case AHIC_RecordSampleFormat: return "AHIC_RecordSampleFormat";
91 // case AHIC_RecordSampleFormat_Query: return "AHIC_RecordSampleFormat_Query";
92 case AHIDB_AudioID: return "AHIDB_AudioID";
93 case AHIDB_BufferLen: return "AHIDB_BufferLen";
94 case AHIDB_Driver: return "AHIDB_Driver";
95 case AHIDB_Author: return "AHIDB_Author";
96 case AHIDB_Copyright: return "AHIDB_Copyright";
97 case AHIDB_Version: return "AHIDB_Version";
98 case AHIDB_Annotation: return "AHIDB_Annotation";
99 case AHIDB_Name: return "AHIDB_Name";
100 case AHIDB_Data: return "AHIDB_Data";
101 case AHIDB_Flags: return "AHIDB_Flags";
102 // case AHIDB_Play: return "AHIDB_Play";
103 case AHIDB_Record: return "AHIDB_Record";
104 // case AHIDB_Direct: return "AHIDB_Direct";
105 case AHIDB_Volume: return "AHIDB_Volume";
106 case AHIDB_Stereo: return "AHIDB_Stereo";
107 case AHIDB_Panning: return "AHIDB_Panning";
108 // case AHIDB_Surround: return "AHIDB_Surround";
109 case AHIDB_PingPong: return "AHIDB_PingPong";
110 case AHIDB_MultTable: return "AHIDB_MultTable";
111 case AHIDB_MaxChannels: return "AHIDB_MaxChannels";
112 case AHIDB_MaxPlaySamples: return "AHIDB_MaxPlaySamples";
113 case AHIDB_MaxRecordSamples: return "AHIDB_MaxRecordSamples";
114 case AHIDB_Bits: return "AHIDB_Bits";
115 case AHIDB_HiFi: return "AHIDB_HiFi";
116 case AHIDB_Realtime: return "AHIDB_Realtime";
117 case AHIDB_FullDuplex: return "AHIDB_FullDuplex";
118 // case AHIDB_Accelerated: return "AHIDB_Accelerated";
119 // case AHIDB_Available: return "AHIDB_Available";
120 // case AHIDB_Hidden: return "AHIDB_Hidden";
121 case AHIDB_Frequencies: return "AHIDB_Frequencies";
122 case AHIDB_FrequencyArg: return "AHIDB_FrequencyArg";
123 case AHIDB_Frequency: return "AHIDB_Frequency";
124 // case AHIDB_FrequencyArray: return "AHIDB_FrequencyArray";
125 case AHIDB_IndexArg: return "AHIDB_IndexArg";
126 case AHIDB_Index: return "AHIDB_Index";
127 case AHIDB_Inputs: return "AHIDB_Inputs";
128 case AHIDB_InputArg: return "AHIDB_InputArg";
129 case AHIDB_Input: return "AHIDB_Input";
130 // case AHIDB_InputArray: return "AHIDB_InputArray";
131 case AHIDB_Outputs: return "AHIDB_Outputs";
132 case AHIDB_OutputArg: return "AHIDB_OutputArg";
133 case AHIDB_Output: return "AHIDB_Output";
134 case AHIDB_MultiChannel: return "AHIDB_MultiChannel";
135 // case AHIDB_OutputArray: return "AHIDB_OutputArray";
136 // case AHIDB_MonitorVolumesLeft: return "AHIDB_MonitorVolumesLeft";
137 // case AHIDB_MonitorVolumeLeftArg: return "AHIDB_MonitorVolumeLeftArg";
138 // case AHIDB_MonitorVolumeLeft: return "AHIDB_MonitorVolumeLeft";
139 // case AHIDB_MonitorVolumeLeftArray: return "AHIDB_MonitorVolumeLeftArray";
140 // case AHIDB_MonitorVolumesRight: return "AHIDB_MonitorVolumesRight";
141 // case AHIDB_MonitorVolumeRightArg: return "AHIDB_MonitorVolumeRightArg";
142 // case AHIDB_MonitorVolumeRight: return "AHIDB_MonitorVolumeRight";
143 // case AHIDB_MonitorVolumeRightArray: return "AHIDB_MonitorVolumeRightArray";
144 // case AHIDB_OutputVolumesLeft: return "AHIDB_OutputVolumesLeft";
145 // case AHIDB_OutputVolumeLeftArg: return "AHIDB_OutputVolumeLeftArg";
146 // case AHIDB_OutputVolumeLeft: return "AHIDB_OutputVolumeLeft";
147 // case AHIDB_OutputVolumeLeftArray: return "AHIDB_OutputVolumeLeftArray";
148 // case AHIDB_OutputVolumesRight: return "AHIDB_OutputVolumesRight";
149 // case AHIDB_OutputVolumeRightArg: return "AHIDB_OutputVolumeRightArg";
150 // case AHIDB_OutputVolumeRight: return "AHIDB_OutputVolumeRight";
151 // case AHIDB_OutputVolumeRightArray: return "AHIDB_OutputVolumeRightArray";
152 // case AHIDB_InputGainsLeft: return "AHIDB_InputGainsLeft";
153 // case AHIDB_InputGainLeftArg: return "AHIDB_InputGainLeftArg";
154 // case AHIDB_InputGainLeft: return "AHIDB_InputGainLeft";
155 // case AHIDB_InputGainLeftArray: return "AHIDB_InputGainLeftArray";
156 // case AHIDB_InputGainsRight: return "AHIDB_InputGainsRight";
157 // case AHIDB_InputGainRightArg: return "AHIDB_InputGainRightArg";
158 // case AHIDB_InputGainRight: return "AHIDB_InputGainRight";
159 // case AHIDB_InputGainRightArray: return "AHIDB_InputGainRightArray";
160 // case AHIDB_PlaySampleFormats: return "AHIDB_PlaySampleFormats";
161 // case AHIDB_PlaySampleFormatArg: return "AHIDB_PlaySampleFormatArg";
162 // case AHIDB_PlaySampleFormat: return "AHIDB_PlaySampleFormat";
163 // case AHIDB_PlaySampleFormatArray: return "AHIDB_PlaySampleFormatArray";
164 // case AHIDB_RecordSampleFormats: return "AHIDB_RecordSampleFormats";
165 // case AHIDB_RecordSampleFormatArg: return "AHIDB_RecordSampleFormatArg";
166 // case AHIDB_RecordSampleFormat: return "AHIDB_RecordSampleFormat";
167 // case AHIDB_RecordSampleFormatArray: return "AHIDB_RecordSampleFormatArray";
168 case AHIB_Dizzy: return "AHIB_Dizzy";
169 case AHIR_Window: return "AHIR_Window";
170 case AHIR_Screen: return "AHIR_Screen";
171 case AHIR_PubScreenName: return "AHIR_PubScreenName";
172 case AHIR_PrivateIDCMP: return "AHIR_PrivateIDCMP";
173 case AHIR_IntuiMsgFunc: return "AHIR_IntuiMsgFunc";
174 case AHIR_SleepWindow: return "AHIR_SleepWindow";
175 case AHIR_ObsoleteUserData: return "AHIR_ObsoleteUserData";
176 case AHIR_UserData: return "AHIR_UserData";
177 case AHIR_TextAttr: return "AHIR_TextAttr";
178 case AHIR_Locale: return "AHIR_Locale";
179 case AHIR_TitleText: return "AHIR_TitleText";
180 case AHIR_PositiveText: return "AHIR_PositiveText";
181 case AHIR_NegativeText: return "AHIR_NegativeText";
182 case AHIR_InitialLeftEdge: return "AHIR_InitialLeftEdge";
183 case AHIR_InitialTopEdge: return "AHIR_InitialTopEdge";
184 case AHIR_InitialWidth: return "AHIR_InitialWidth";
185 case AHIR_InitialHeight: return "AHIR_InitialHeight";
186 case AHIR_InitialAudioID: return "AHIR_InitialAudioID";
187 case AHIR_InitialMixFreq: return "AHIR_InitialMixFreq";
188 case AHIR_InitialInfoOpened: return "AHIR_InitialInfoOpened";
189 case AHIR_InitialInfoLeftEdge: return "AHIR_InitialInfoLeftEdge";
190 case AHIR_InitialInfoTopEdge: return "AHIR_InitialInfoTopEdge";
191 case AHIR_InitialInfoWidth: return "AHIR_InitialInfoWidth";
192 case AHIR_InitialInfoHeight: return "AHIR_InitialInfoHeight";
193 case AHIR_DoMixFreq: return "AHIR_DoMixFreq";
194 case AHIR_DoDefaultMode: return "AHIR_DoDefaultMode";
195 // case AHIR_DoChannels: return "AHIR_DoChannels";
196 // case AHIR_DoHidden: return "AHIR_DoHidden";
197 // case AHIR_DoDirectModes: return "AHIR_DoDirectModes";
198 case AHIR_FilterTags: return "AHIR_FilterTags";
199 case AHIR_FilterFunc: return "AHIR_FilterFunc";
200 case AHIC_MonitorVolume: return "AHIC_MonitorVolume";
201 case AHIC_MonitorVolume_Query: return "AHIC_MonitorVolume_Query";
202 case AHIC_InputGain: return "AHIC_InputGain";
203 case AHIC_InputGain_Query: return "AHIC_InputGain_Query";
204 case AHIC_OutputVolume: return "AHIC_OutputVolume";
205 case AHIC_OutputVolume_Query: return "AHIC_OutputVolume_Query";
206 case AHIDB_MinMixFreq: return "AHIDB_MinMixFreq";
207 case AHIDB_MaxMixFreq: return "AHIDB_MaxMixFreq";
208 case AHIDB_MinMonitorVolume: return "AHIDB_MinMonitorVolume";
209 case AHIDB_MaxMonitorVolume: return "AHIDB_MaxMonitorVolume";
210 case AHIDB_MinInputGain: return "AHIDB_MinInputGain";
211 case AHIDB_MaxInputGain: return "AHIDB_MaxInputGain";
212 case AHIDB_MinOutputVolume: return "AHIDB_MinOutputVolume";
213 case AHIDB_MaxOutputVolume: return "AHIDB_MaxOutputVolume";
215 default:
216 return "Unknown";
220 enum Datatype
222 dt_Hex,
223 dt_Dec,
224 dt_Boolean,
225 dt_String,
226 dt_Fixed
229 static enum Datatype
230 GetDatatype( Tag tag )
232 switch( tag )
234 case AHIA_AudioID: return dt_Hex;
235 case AHIA_MixFreq: return dt_Dec;
236 case AHIA_Channels: return dt_Dec;
237 case AHIA_Sounds: return dt_Dec;
238 case AHIA_SoundFunc: return dt_Hex;
239 case AHIA_PlayerFunc: return dt_Hex;
240 case AHIA_PlayerFreq: return dt_Fixed;
241 case AHIA_MinPlayerFreq: return dt_Fixed;
242 case AHIA_MaxPlayerFreq: return dt_Fixed;
243 // case AHIA_PlayerFreqUnit: return dt_Hex;
244 case AHIA_RecordFunc: return dt_Hex;
245 case AHIA_UserData: return dt_Hex;
246 // case AHIA_ErrorFunc: return dt_Hex;
247 case AHIA_AntiClickSamples: return dt_Dec;
248 case AHIP_BeginChannel: return dt_Dec;
249 case AHIP_EndChannel: return dt_Dec;
250 case AHIP_Freq: return dt_Dec;
251 case AHIP_Vol: return dt_Fixed;
252 case AHIP_Pan: return dt_Fixed;
253 case AHIP_Sound: return dt_Dec;
254 case AHIP_Offset: return dt_Hex;
255 case AHIP_Length: return dt_Hex;
256 case AHIP_LoopFreq: return dt_Dec;
257 case AHIP_LoopVol: return dt_Fixed;
258 case AHIP_LoopPan: return dt_Fixed;
259 case AHIP_LoopSound: return dt_Dec;
260 case AHIP_LoopOffset: return dt_Hex;
261 case AHIP_LoopLength: return dt_Hex;
262 case AHIC_Play: return dt_Boolean;
263 case AHIC_Record: return dt_Boolean;
264 // case AHIC_PausePlay: return dt_Boolean;
265 // case AHIC_PauseRecord: return dt_Boolean;
266 case AHIC_MixFreq_Query: return dt_Hex;
267 case AHIC_Input: return dt_Dec;
268 case AHIC_Input_Query: return dt_Hex;
269 case AHIC_Output: return dt_Dec;
270 case AHIC_Output_Query: return dt_Hex;
271 // case AHIC_MonitorVolumeLeft: return dt_Fixed;
272 // case AHIC_MonitorVolumeLeft_Query: return dt_Hex;
273 // case AHIC_MonitorVolumeRight: return dt_Fixed;
274 // case AHIC_MonitorVolumeRight_Query: return dt_Hex;
275 // case AHIC_OutputVolumeLeft: return dt_Fixed;
276 // case AHIC_OutputVolumeLeft_Query: return dt_Hex;
277 // case AHIC_OutputVolumeRight: return dt_Fixed;
278 // case AHIC_OutputVolumeRight_Query: return dt_Hex;
279 // case AHIC_InputGainLeft: return dt_Fixed;
280 // case AHIC_InputGainLeft_Query: return dt_Hex;
281 // case AHIC_InputGainRight: return dt_Fixed;
282 // case AHIC_InputGainRight_Query: return dt_Hex;
283 // case AHIC_PlaySampleFormat: return dt_Hex;
284 // case AHIC_PlaySampleFormat_Query: return dt_Hex;
285 // case AHIC_RecordSampleFormat: return dt_Hex;
286 // case AHIC_RecordSampleFormat_Query: return dt_Dec;
287 case AHIDB_AudioID: return dt_Hex;
288 case AHIDB_BufferLen: return dt_Dec;
289 case AHIDB_Driver: return dt_Hex;
290 case AHIDB_Author: return dt_Hex;
291 case AHIDB_Copyright: return dt_Hex;
292 case AHIDB_Version: return dt_Hex;
293 case AHIDB_Annotation: return dt_Hex;
294 case AHIDB_Name: return dt_Hex;
295 case AHIDB_Data: return dt_Hex;
296 case AHIDB_Flags: return dt_Hex;
297 // case AHIDB_Play: return dt_Hex;
298 case AHIDB_Record: return dt_Hex;
299 // case AHIDB_Direct: return dt_Hex;
300 case AHIDB_Volume: return dt_Hex;
301 case AHIDB_Stereo: return dt_Hex;
302 case AHIDB_Panning: return dt_Hex;
303 // case AHIDB_Surround: return dt_Hex;
304 case AHIDB_PingPong: return dt_Hex;
305 case AHIDB_MultTable: return dt_Hex;
306 case AHIDB_MaxChannels: return dt_Hex;
307 case AHIDB_MaxPlaySamples: return dt_Hex;
308 case AHIDB_MaxRecordSamples: return dt_Hex;
309 case AHIDB_Bits: return dt_Hex;
310 case AHIDB_HiFi: return dt_Hex;
311 case AHIDB_Realtime: return dt_Hex;
312 case AHIDB_FullDuplex: return dt_Hex;
313 // case AHIDB_Accelerated: return dt_Hex;
314 // case AHIDB_Available: return dt_Hex;
315 // case AHIDB_Hidden: return dt_Hex;
316 case AHIDB_Frequencies: return dt_Hex;
317 case AHIDB_FrequencyArg: return dt_Dec;
318 case AHIDB_Frequency: return dt_Hex;
319 // case AHIDB_FrequencyArray: return dt_Hex;
320 case AHIDB_IndexArg: return dt_Dec;
321 case AHIDB_Index: return dt_Hex;
322 case AHIDB_Inputs: return dt_Hex;
323 case AHIDB_InputArg: return dt_Dec;
324 case AHIDB_Input: return dt_Hex;
325 // case AHIDB_InputArray: return dt_Hex;
326 case AHIDB_Outputs: return dt_Hex;
327 case AHIDB_OutputArg: return dt_Dec;
328 case AHIDB_Output: return dt_Hex;
329 case AHIDB_MultiChannel: return dt_Hex;
330 // case AHIDB_OutputArray: return dt_Hex;
331 // case AHIDB_MonitorVolumesLeft: return dt_Hex;
332 // case AHIDB_MonitorVolumeLeftArg: return dt_Dec;
333 // case AHIDB_MonitorVolumeLeft: return dt_Hex;
334 // case AHIDB_MonitorVolumeLeftArray: return dt_Hex;
335 // case AHIDB_MonitorVolumesRight: return dt_Hex;
336 // case AHIDB_MonitorVolumeRightArg: return dt_Dec;
337 // case AHIDB_MonitorVolumeRight: return dt_Hex;
338 // case AHIDB_MonitorVolumeRightArray: return dt_Hex;
339 // case AHIDB_OutputVolumesLeft: return dt_Hex;
340 // case AHIDB_OutputVolumeLeftArg: return dt_Dec;
341 // case AHIDB_OutputVolumeLeft: return dt_Hex;
342 // case AHIDB_OutputVolumeLeftArray: return dt_Hex;
343 // case AHIDB_OutputVolumesRight: return dt_Hex;
344 // case AHIDB_OutputVolumeRightArg: return dt_Dec;
345 // case AHIDB_OutputVolumeRight: return dt_Hex;
346 // case AHIDB_OutputVolumeRightArray: return dt_Hex;
347 // case AHIDB_InputGainsLeft: return dt_Hex;
348 // case AHIDB_InputGainLeftArg: return dt_Dec;
349 // case AHIDB_InputGainLeft: return dt_Hex;
350 // case AHIDB_InputGainLeftArray: return dt_Hex;
351 // case AHIDB_InputGainsRight: return dt_Hex;
352 // case AHIDB_InputGainRightArg: return dt_Dec;
353 // case AHIDB_InputGainRight: return dt_Hex;
354 // case AHIDB_InputGainRightArray: return dt_Hex;
355 // case AHIDB_PlaySampleFormats: return dt_Hex;
356 // case AHIDB_PlaySampleFormatArg: return dt_Dec;
357 // case AHIDB_PlaySampleFormat: return dt_Hex;
358 // case AHIDB_PlaySampleFormatArray: return dt_Hex;
359 // case AHIDB_RecordSampleFormats: return dt_Hex;
360 // case AHIDB_RecordSampleFormatArg: return dt_Dec;
361 // case AHIDB_RecordSampleFormat: return dt_Hex;
362 // case AHIDB_RecordSampleFormatArray: return dt_Hex;
363 case AHIB_Dizzy: return dt_Boolean;
364 case AHIR_Window: return dt_Hex;
365 case AHIR_Screen: return dt_Hex;
366 case AHIR_PubScreenName: return dt_String;
367 case AHIR_PrivateIDCMP: return dt_Hex;
368 case AHIR_IntuiMsgFunc: return dt_Hex;
369 case AHIR_SleepWindow: return dt_Boolean;
370 case AHIR_ObsoleteUserData: return dt_Hex;
371 case AHIR_UserData: return dt_Hex;
372 case AHIR_TextAttr: return dt_Hex;
373 case AHIR_Locale: return dt_Hex;
374 case AHIR_TitleText: return dt_String;
375 case AHIR_PositiveText: return dt_String;
376 case AHIR_NegativeText: return dt_String;
377 case AHIR_InitialLeftEdge: return dt_Dec;
378 case AHIR_InitialTopEdge: return dt_Dec;
379 case AHIR_InitialWidth: return dt_Dec;
380 case AHIR_InitialHeight: return dt_Dec;
381 case AHIR_InitialAudioID: return dt_Hex;
382 case AHIR_InitialMixFreq: return dt_Dec;
383 case AHIR_InitialInfoOpened: return dt_Boolean;
384 case AHIR_InitialInfoLeftEdge: return dt_Dec;
385 case AHIR_InitialInfoTopEdge: return dt_Dec;
386 case AHIR_InitialInfoWidth: return dt_Dec;
387 case AHIR_InitialInfoHeight: return dt_Dec;
388 case AHIR_DoMixFreq: return dt_Boolean;
389 case AHIR_DoDefaultMode: return dt_Boolean;
390 // case AHIR_DoChannels: return dt_Boolean;
391 // case AHIR_DoHidden: return dt_Boolean;
392 // case AHIR_DoDirectModes: return dt_Boolean;
393 case AHIR_FilterTags: return dt_Hex;
394 case AHIR_FilterFunc: return dt_Hex;
395 case AHIC_MonitorVolume: return dt_Fixed;
396 case AHIC_MonitorVolume_Query: return dt_Hex;
397 case AHIC_InputGain: return dt_Fixed;
398 case AHIC_InputGain_Query: return dt_Hex;
399 case AHIC_OutputVolume: return dt_Fixed;
400 case AHIC_OutputVolume_Query: return dt_Hex;
401 case AHIDB_MinMixFreq: return dt_Dec;
402 case AHIDB_MaxMixFreq: return dt_Dec;
403 case AHIDB_MinMonitorVolume: return dt_Hex;
404 case AHIDB_MaxMonitorVolume: return dt_Hex;
405 case AHIDB_MinInputGain: return dt_Hex;
406 case AHIDB_MaxInputGain: return dt_Hex;
407 case AHIDB_MinOutputVolume: return dt_Hex;
408 case AHIDB_MaxOutputVolume: return dt_Hex;
410 default:
411 return dt_Hex;
416 // tags may be NULL
418 static void
419 PrintTagList(struct TagItem *tags)
421 struct TagItem *tstate;
422 struct TagItem *tag;
424 if( tags == NULL )
426 KPrintF( "No taglist!\n" );
428 else
430 tstate = tags;
432 while( ( tag = NextTagItem( &tstate ) ) )
434 switch( GetDatatype( tag->ti_Tag ) )
436 case dt_Hex:
437 KPrintF( "\n %30s, 0x%P,",
438 (IPTR)GetTagName( tag->ti_Tag ), tag->ti_Data );
439 break;
441 case dt_Dec:
442 KPrintF( "\n %30s, %ld,",
443 (IPTR)GetTagName( tag->ti_Tag ), tag->ti_Data );
444 break;
446 case dt_Boolean:
447 KPrintF( "\n %30s, %s,",
448 (IPTR)GetTagName( tag->ti_Tag ),
449 (IPTR)(tag->ti_Data ? "TRUE" : "FALSE") );
450 break;
452 case dt_String:
453 KPrintF( "\n %30s, %s,",
454 (IPTR)GetTagName( tag->ti_Tag ),
455 tag->ti_Data != 0 ? tag->ti_Data : (IPTR)"(null)" );
456 break;
458 case dt_Fixed:
460 KPrintF( "\n %30s, %ld.%ld,",
461 (IPTR)GetTagName( tag->ti_Tag ),
462 tag->ti_Data >> 16,
463 ( ( tag->ti_Data & 0xffff ) * 1000 ) >> 16 );
464 break;
469 KPrintF("\n TAG_DONE)");
474 /******************************************************************************
475 ** Send debug to serial port **************************************************
476 ******************************************************************************/
478 #ifndef __AMIGAOS4__
479 #if defined( __AROS__ ) && !defined( __mc68000__ )
481 #include <aros/asmcall.h>
483 AROS_UFH2( void,
484 rawputchar_m68k,
485 AROS_UFHA( UBYTE, c, D0 ),
486 AROS_UFHA( struct ExecBase*, SysBase, A3 ) )
488 AROS_USERFUNC_INIT
489 RawPutChar( c );
490 AROS_USERFUNC_EXIT
493 #else
495 static const UWORD rawputchar_m68k[] =
497 0x2C4B, // MOVEA.L A3,A6
498 0x4EAE, 0xFDFC, // JSR -$0204(A6)
499 0x4E75 // RTS
502 #endif
504 void
505 KPrintFArgs( UBYTE* fmt,
506 ULONG* args )
508 RawDoFmt( fmt, args, (void(*)(void)) rawputchar_m68k, SysBase );
510 #endif
513 /******************************************************************************
514 ** All functions **************************************************************
515 ******************************************************************************/
518 void
519 Debug_AllocAudioA( struct TagItem *tags )
521 KPrintF("AHI_AllocAudioA(");
522 PrintTagList(tags);
525 void
526 Debug_FreeAudio( struct AHIPrivAudioCtrl *audioctrl )
528 KPrintF("AHI_FreeAudio(0x%P)\n", (IPTR)audioctrl);
531 void
532 Debug_KillAudio( void )
534 KPrintF("AHI_KillAudio()\n");
537 void
538 Debug_ControlAudioA( struct AHIPrivAudioCtrl *audioctrl, struct TagItem *tags )
540 KPrintF("AHI_ControlAudioA(0x%P,", (IPTR)audioctrl);
541 PrintTagList(tags);
545 void
546 Debug_SetVol( UWORD chan, Fixed vol, sposition pan, struct AHIPrivAudioCtrl *audioctrl, ULONG flags)
548 KPrintF("AHI_SetVol(%ld, 0x%08lx, 0x%08lx, 0x%P, %ld)\n",
549 chan & 0xffff, vol, pan, (IPTR)audioctrl, flags);
552 void
553 Debug_SetFreq( UWORD chan, ULONG freq, struct AHIPrivAudioCtrl *audioctrl, ULONG flags)
555 KPrintF("AHI_SetFreq(%ld, %ld, 0x%P, %ld)\n",
556 chan & 0xffff, freq, (IPTR)audioctrl, flags);
559 void
560 Debug_SetSound( UWORD chan, UWORD sound, ULONG offset, LONG length, struct AHIPrivAudioCtrl *audioctrl, ULONG flags)
562 KPrintF("AHI_SetSound(%ld, %ld, 0x%08lx, 0x%08lx, 0x%P, %ld)\n",
563 chan & 0xffff, sound & 0xffff, offset, length, (IPTR)audioctrl, flags);
566 void
567 Debug_SetEffect( ULONG *effect, struct AHIPrivAudioCtrl *audioctrl )
569 KPrintF("AHI_SetEffect(0x%08lx (Effect 0x%P), 0x%P)\n",
570 (IPTR)effect, *effect, (IPTR)audioctrl);
573 void
574 Debug_LoadSound( UWORD sound, ULONG type, APTR info, struct AHIPrivAudioCtrl *audioctrl )
576 KPrintF("AHI_LoadSound(%ld, %ld, 0x%08lx, 0x%08lx) ", sound, type, (ULONG) info, (ULONG) audioctrl);
578 if(type == AHIST_SAMPLE || type == AHIST_DYNAMICSAMPLE)
580 struct AHISampleInfo *si = (struct AHISampleInfo *) info;
582 KPrintF("[T:0x%08lx A:0x%P L:%ld]", si->ahisi_Type,
583 (IPTR)si->ahisi_Address, si->ahisi_Length);
587 void
588 Debug_UnloadSound( UWORD sound, struct AHIPrivAudioCtrl *audioctrl )
590 KPrintF("AHI_UnloadSound(%ld, 0x%P)\n", sound, (IPTR)audioctrl);
593 void
594 Debug_NextAudioID( ULONG id)
596 KPrintF("AHI_NextAudioID(0x%08lx)",id);
599 void
600 Debug_GetAudioAttrsA( ULONG id, struct AHIPrivAudioCtrl *audioctrl, struct TagItem *tags )
602 KPrintF("AHI_GetAudioAttrsA(0x%08lx, 0x%P,",id, (IPTR)audioctrl);
603 PrintTagList(tags);
606 void
607 Debug_BestAudioIDA( struct TagItem *tags )
609 KPrintF("AHI_BestAudioIDA(");
610 PrintTagList(tags);
613 void
614 Debug_AllocAudioRequestA( struct TagItem *tags )
616 KPrintF("AHI_AllocAudioRequestA(");
617 PrintTagList(tags);
620 void
621 Debug_AudioRequestA( struct AHIAudioModeRequester *req, struct TagItem *tags )
623 KPrintF("AHI_AudioRequestA(0x%P,", (IPTR)req);
624 PrintTagList(tags);
627 void
628 Debug_FreeAudioRequest( struct AHIAudioModeRequester *req )
630 KPrintF("AHI_FreeAudioRequest(0x%P)\n", (IPTR)req);
633 void
634 Debug_PlayA( struct AHIPrivAudioCtrl *audioctrl, struct TagItem *tags )
636 KPrintF("AHI_PlayA(0x%P,", (IPTR)audioctrl);
637 PrintTagList(tags);
638 KPrintF("\n");
641 void
642 Debug_SampleFrameSize( ULONG sampletype)
644 KPrintF("AHI_SampleFrameSize(%ld)",sampletype);
647 void
648 Debug_AddAudioMode(struct TagItem *tags )
650 KPrintF("AHI_AddAudioMode(");
651 PrintTagList(tags);
654 void
655 Debug_RemoveAudioMode( ULONG id)
657 KPrintF("AHI_RemoveAudioMode(0x%08lx)",id);
660 void
661 Debug_LoadModeFile( STRPTR name)
663 KPrintF("AHI_LoadModeFile(%s)", (IPTR)name);