2 /* Shows the current Audio database in memory */
5 #include <devices/ahi.h>
6 #include <utility/tagitem.h>
7 #include <proto/exec.h>
13 LONG __OSlibversion
=37;
15 UBYTE vers
[] = "\0$VER: ScanAudioModes 1.1 (28.4.96)";
17 struct Library
*AHIBase
;
18 struct MsgPort
*AHImp
=NULL
;
19 struct AHIRequest
*AHIio
=NULL
;
25 CloseDevice((struct IORequest
*)AHIio
);
26 DeleteIORequest((struct IORequest
*)AHIio
);
33 ULONG id
=AHI_INVALID_ID
;
34 LONG volume
,stereo
,panning
,hifi
,pingpong
,record
,realtime
,fullduplex
,
35 bits
,channels
,minmix
,maxmix
,freqs
,inputs
,outputs
;
36 Fixed minmon
,maxmon
,mingain
,maxgain
,minout
,maxout
;
37 UBYTE name
[LEN
],driver
[LEN
],author
[LEN
],copyright
[LEN
],version
[LEN
],anno
[LEN
],
38 inputdesc
[LEN
],outputdesc
[LEN
];
41 if((AHImp
=CreateMsgPort()))
42 if((AHIio
=(struct AHIRequest
*)CreateIORequest(AHImp
,sizeof(struct AHIRequest
)))) {
43 AHIio
->ahir_Version
=1;
44 AHIDevice
=OpenDevice(AHINAME
,AHI_NO_UNIT
,(struct IORequest
*)AHIio
,NULL
);
48 Printf("Unable to open %s version 1\n",(IPTR
) AHINAME
);
51 AHIBase
=(struct Library
*)AHIio
->ahir_Std
.io_Device
;
53 while ((id
=AHI_NextAudioID(id
)) != AHI_INVALID_ID
) {
54 if(SetSignal(0L,SIGBREAKF_CTRL_C
) & SIGBREAKF_CTRL_C
)
61 volume
=0;stereo
=0;panning
=0;hifi
=0;pingpong
=0;record
=0;realtime
=0;fullduplex
=0;
62 bits
=0;channels
=0;minmix
=0;maxmix
=0;freqs
=0;inputs
=0;outputs
=0;
63 name
[0]='\0'; driver
[0]='\0'; author
[0]='\0'; copyright
[0]='\0'; version
[0]='\0';
64 anno
[0]='\0'; inputdesc
[0]='\0'; outputdesc
[0]='\0';
66 Printf("\x1b[2mMode 0x%08lx\x1b[0m\n",id
);
67 AHI_GetAudioAttrs(id
, NULL
,
69 AHIDB_Frequencies
,(IPTR
) &freqs
,
70 AHIDB_Volume
, (IPTR
) &volume
,
71 AHIDB_Stereo
, (IPTR
) &stereo
,
72 AHIDB_Panning
, (IPTR
) &panning
,
73 AHIDB_HiFi
,(IPTR
) &hifi
,
74 AHIDB_PingPong
,(IPTR
) &pingpong
,
75 AHIDB_Record
,(IPTR
) &record
,
76 AHIDB_FullDuplex
,(IPTR
) &fullduplex
,
77 AHIDB_Realtime
,(IPTR
) &realtime
,
78 AHIDB_Name
,(IPTR
) &name
,
79 AHIDB_Driver
,(IPTR
) &driver
,
80 AHIDB_Bits
,(IPTR
) &bits
,
81 AHIDB_MaxChannels
,(IPTR
) &channels
,
82 AHIDB_MinMixFreq
,(IPTR
) &minmix
,
83 AHIDB_MaxMixFreq
,(IPTR
) &maxmix
,
84 AHIDB_Author
,(IPTR
) &author
,
85 AHIDB_Copyright
,(IPTR
) ©right
,
86 AHIDB_Version
,(IPTR
) &version
,
87 AHIDB_Annotation
,(IPTR
) &anno
,
88 AHIDB_MinMonitorVolume
,(IPTR
) &minmon
,
89 AHIDB_MaxMonitorVolume
,(IPTR
) &maxmon
,
90 AHIDB_MinInputGain
,(IPTR
) &mingain
,
91 AHIDB_MaxInputGain
,(IPTR
) &maxgain
,
92 AHIDB_MinOutputVolume
,(IPTR
) &minout
,
93 AHIDB_MaxOutputVolume
,(IPTR
) &maxout
,
94 AHIDB_Inputs
,(IPTR
) &inputs
,
95 AHIDB_Outputs
,(IPTR
) &outputs
,
97 Printf(" Name: \"%s\" Driver: \"DEVS:AHI/%s.audio\"\n",
98 (IPTR
) name
, (IPTR
) driver
);
100 Printf(" Driver programmed by: %s\n",(IPTR
) author
);
102 Printf(" Copyright: %s\n",(IPTR
) copyright
);
104 if(version
[i
]=='\n' || version
[i
]=='\r')
107 Printf(" Version: %s\n",(IPTR
) version
);
109 Printf(" %s\n",(IPTR
) anno
);
110 Printf(" The hardware has %ld output(s)",outputs
);
114 for(i
=0;i
<outputs
;i
++)
116 AHI_GetAudioAttrs(id
, NULL
,
119 AHIDB_Output
,(IPTR
) &outputdesc
,
121 Printf(" %s",(IPTR
) &outputdesc
);
124 Printf("\n and %ld input(s)",inputs
);
128 for(i
=0;i
<inputs
;i
++)
130 AHI_GetAudioAttrs(id
, NULL
,
133 AHIDB_Input
,(IPTR
) &inputdesc
,
135 Printf(" %s",(IPTR
) &inputdesc
);
140 Printf(" No input monitor.\n");
142 Printf(" Input monitor volume range: %ld-%ld%%.\n",minmon
*100>>16,maxmon
*100>>16);
144 Printf(" No input gain.\n");
146 Printf(" Input gain range: %ld-%ld%%.\n",mingain
*100>>16,maxgain
*100>>16);
148 Printf(" No volume control.\n");
150 Printf(" Output volume range: %ld-%ld%%.\n",minout
*100>>16,maxout
*100>>16);
152 Printf("\n %s output%s in %ld bits.\n", (IPTR
) (stereo
? "Stereo" : "Mono"),
153 (IPTR
) (stereo
? (panning
? " (with panning)" : "" ) : ""),
155 Printf(" Can play samples on max %ld channels at %s, %s.\n", channels
,
156 (IPTR
) (volume
? "any volume" : "full volume only"),
157 (IPTR
) (pingpong
? "both forwards and backwards" : "forwards only"));
158 Printf(" The mixing %sdestructive.\n", (IPTR
) (hifi
? "is non-" : "may be "));
159 Printf(" %ld mixing frequencies between %ld and %ld are available.\n",freqs
,minmix
,maxmix
);
160 Printf(" Recording is %ssupported", (IPTR
) (record
? "" : "not "));
162 Printf(" (%s duplex)", (IPTR
) (fullduplex
? "Full" : "Half"));
164 Printf(" This is a %srealtime mode.\n", (IPTR
) (realtime
? "" : "non-"));
169 Printf("No more modes in the audio database.\n");
171 return RETURN_OK
; // Make compiler happy