home *** CD-ROM | disk | FTP | other *** search
- /* Simple (and useless) test for AHI_BestAudioID() */
-
- #include <devices/ahi.h>
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/ahi.h>
- #include <stdlib.h>
-
- struct Library *AHIBase;
- struct MsgPort *AHImp=NULL;
- struct AHIRequest *AHIio=NULL;
- BYTE AHIDevice=-1;
-
- void cleanup(LONG rc)
- {
- if(!AHIDevice)
- CloseDevice((struct IORequest *)AHIio);
- DeleteIORequest((struct IORequest *)AHIio);
- DeleteMsgPort(AHImp);
- exit(rc);
- }
-
- void main(void)
- {
- ULONG id=0;
-
- if(AHImp=CreateMsgPort())
- if(AHIio=(struct AHIRequest *)CreateIORequest(AHImp,sizeof(struct AHIRequest))) {
- AHIio->ahir_Version=1;
- AHIDevice=OpenDevice(AHINAME,AHI_NO_UNIT,(struct IORequest *)AHIio,NULL);
- }
-
- if(AHIDevice) {
- Printf("Unable to open %s version 1\n",AHINAME);
- cleanup(RETURN_FAIL);
- }
- AHIBase=(struct Library *)AHIio->ahir_Std.io_Device;
-
- id=AHI_BestAudioID(AHIDB_Stereo,TRUE,
- AHIDB_Volume,TRUE,
- AHIDB_Bits,8,
- AHIDB_MaxChannels,4,
- TAG_DONE);
- Printf("Best mode for modules: 0x%08lx.\n",id);
-
- id=AHI_BestAudioID(AHIDB_Stereo,FALSE,
- AHIDB_MaxChannels,1,
- AHIDB_MinMixFreq,8000,
- AHIDB_MaxMixFreq,8000,
- TAG_DONE);
- Printf("Best mode for mono sample at 8000 Hz: 0x%08lx.\n",id);
-
- id=AHI_BestAudioID(AHIDB_AudioID,id,
- AHIDB_Stereo,TRUE,
- AHIDB_Volume,TRUE,
- AHIDB_Bits,8,
- AHIDB_MaxChannels,4,
- TAG_DONE);
- Printf("Best mode for modules, using the same hardware as the last one: 0x%08lx.\n",id);
- cleanup(0);
- }
-