1 /* Simple AHI_BestAudioID() example */
3 #include <devices/ahi.h>
4 #include <proto/exec.h>
10 struct Library
*AHIBase
;
11 struct MsgPort
*AHImp
=NULL
;
12 struct AHIRequest
*AHIio
=NULL
;
18 CloseDevice((struct IORequest
*)AHIio
);
19 DeleteIORequest((struct IORequest
*)AHIio
);
24 void printmode(ULONG id
) {
27 if(id
!= AHI_INVALID_ID
) {
29 AHI_GetAudioAttrs(id
, NULL
,
31 AHIDB_Name
, (IPTR
) name
,
35 strncpy(name
, "Non-existing mode!", 40);
38 Printf("\nMode 0x%08lx (%s):\n", id
, name
);
46 if(AHImp
=CreateMsgPort())
47 if(AHIio
=(struct AHIRequest
*)CreateIORequest(AHImp
,sizeof(struct AHIRequest
))) {
48 AHIio
->ahir_Version
= 4;
49 AHIDevice
=OpenDevice(AHINAME
,AHI_NO_UNIT
,(struct IORequest
*)AHIio
,NULL
);
53 Printf("Unable to open %s version 4\n",AHINAME
);
56 AHIBase
=(struct Library
*)AHIio
->ahir_Std
.io_Device
;
58 mainid
= AHI_BestAudioID(AHIDB_Stereo
,TRUE
,
64 Printf("Stereo, Volume, >= 8 bits and >= 4 channels.\n");
67 struct TagItem tags
[] = {
73 id
= AHI_BestAudioID(AHIDB_Stereo
,TRUE
,
77 AHIB_Dizzy
, (IPTR
) &tags
,
80 Printf("Same as 0x%08lx but also, if possible, "
81 ">= 12 bits, free stereo panning and HiFi mixing.\n", mainid
);
85 struct TagItem tags
[] = {
91 id
= AHI_BestAudioID(AHIDB_AudioID
,id
,
92 AHIB_Dizzy
, (IPTR
) &tags
,
96 Printf("Using the same audio hardware at last mode, "
97 "this modes may have >= 16 bit resolution and be mono. But "
101 id
= AHI_BestAudioID(AHIDB_Realtime
, FALSE
,
102 AHIDB_MaxChannels
, 4,
105 Printf("A non-realtime mode with 4 channels.\n");