home *** CD-ROM | disk | FTP | other *** search
-
- /*******************************************************************
- $CRT 19 Dec 1996 : hb
-
- $AUT Holger Burkarth
- $DAT >>AudioInfo.c<< 26 Jan 1997 13:14:53 - (C) ProDAD
- *******************************************************************/
-
- //##ex mcpp:cppc -gs -o pos:pos/Ex/AudioInfo p:pLib/StartCode.o p:/pOS_RKRM/pAudio/AudioInfo.c p:pLib/StdIO.o -l pOSStub -l pOS
-
- /***********************************************************
- pOS programing example - Copyright (C) 1995-97 proDAD
-
- This code was written as an easy to understand example,
- how to program pOS features. It is provided 'as-is',
- without any express or implied warranty.
-
- Permission is hereby granted to use, copy and modify
- this source code for any purpose, without fee, subject
- to the following conditions:
-
- (1) This notice may not be removed or altered from any
- source distribution.
-
- (2) Altered source versions must be plainly marked as
- such, and must not be misrepresented as being
- the original source code.
-
- (3) If only executable code is distributed, then the
- accompanying documentation have to state that
- "this software is based in part on examples of
- the pOS developer packet".
-
- (4) Permission for use of this code is granted only
- if the user accepts full responsibility for any
- undesirable consequences. proDAD accept NO LIABILITY
- for damages of any kind.
-
- ©proDAD
- ***********************************************************/
-
- /*\
- *** Example:
- ***
- \*/
-
-
- #define __COMPUTER_AMIGA 1
- #define NOMYDEBUG
-
- #include "p:pExec/Types.h"
- #include "p:pExec/MsgPort.h"
- #include "p:pDOS/ArgTags.h"
- #include "p:pDOS/DosSig.h"
- #include "p:pDOS/DosErrors.h"
- #include "p:Device/Audio.h"
- #include "p:pAudio/InfoData.h"
-
- #include "p:proto/pLibExt.h"
- #include "p:proto/pExec2.h"
- #include "p:proto/pDOS2.h"
- #include "p:proto/pAudio2.h"
-
- #ifdef _____ME_____
- #include "grund/inc_string.h"
- #include "grund/inc_stdio.h"
- #else
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <string.h>
- #include <stdio.h>
- #ifdef __cplusplus
- }
- #endif
- #endif
-
-
- const CHAR *HelpText=
- ""
- ;
-
- const CHAR *PrgHeader=
- "";
-
- const CHAR *PrgVerText=
- "$VER: 1.0 ("__DATE2__") (Copyright 1996-97 by proDAD) (Created by Holger Burkarth)";
-
-
- struct pOS_AudioDevice *gb_AudioBase;
-
- /*----------------------------------
- -----------------------------------*/
- #ifdef __cplusplus
- extern "C"
- #endif
-
- VOID main()
- {
- struct pOS_DosArgs* Args;
- UWORD Err=0;
- ULONG Ops[1]={0};
-
- Args=pOS_ReadDosArgs(
- //
- "",
- Ops,sizeof(Ops)/sizeof(ULONG),
-
- ARGTAG_PrgHeaderText, (ULONG)PrgHeader, /* kurze Programm-Beschreibung */
- ARGTAG_HelpText, (ULONG)HelpText, /* Help-Texte */
- ARGTAG_PrgVerText, (ULONG)PrgVerText, /* VER-String */
- TAG_END);
-
- if(Args) {
- pOS_MsgPort Port;
- pOS_AudioIO *IO;
-
- if(pOS_ConstructMsgPort(&Port)) {
- if(IO=(pOS_AudioIO*)pOS_CreateIORequest(&Port,sizeof(pOS_AudioIO))) {
- pOS_OpenDevice("pAudio.device",~0,(pOS_IORequest*)IO,0,0);
- if(IO->aio_Error==0) {
- IO->aio_Command=AUDIOCMD_Info;
- pOS_DoIO((pOS_IORequest*)IO);
- printf(
- "aiio_FirstHwChannels =%ld\n"
- "aiio_NumHwChannels =%ld\n"
- "aiio_FirstSwChannels =%ld\n"
- "aiio_NumSwChannels =%ld\n",
- IO->aio_U.aio_Info.aiio_FirstHwChannels,
- IO->aio_U.aio_Info.aiio_NumHwChannels,
- IO->aio_U.aio_Info.aiio_FirstSwChannels,
- IO->aio_U.aio_Info.aiio_NumSwChannels
- );
- {
- ULONG FirstH=IO->aio_U.aio_Info.aiio_FirstHwChannels;
- ULONG NumH =IO->aio_U.aio_Info.aiio_NumHwChannels;
- ULONG FirstS=IO->aio_U.aio_Info.aiio_FirstSwChannels;
- ULONG NumS =IO->aio_U.aio_Info.aiio_NumSwChannels;
- ULONG Num;
- pOS_AudioInfoData Data={sizeof(pOS_AudioInfoData)};
-
- IO->aio_Command=AUDIOCMD_ChannelInfo;
- IO->aio_U.aio_ChInfo.acio_InfoSize=sizeof(pOS_AudioInfoData);
- IO->aio_U.aio_ChInfo.acio_InfoData=&Data;
-
- printf("Hardware-Channel Info:\n");
- for(Num=0; Num<NumH; ++Num) {
- IO->aio_U.aio_ChInfo.acio_Channel=FirstH+Num;
- pOS_DoIO((pOS_IORequest*)IO);
- if(IO->aio_Error==0) {
- printf(
- "Channel = %ld\n"
- " ID = <%.40s>\n"
- " AudioMapType = 0x%lx\n"
- " Flags = 0x%lx\n"
- " Min. Freq. = %ld Hz\n"
- " Max. Freq. = %ld Hz\n"
- ,
- IO->aio_U.aio_ChInfo.acio_Channel,
- Data.aid_IDName,
- Data.aid_Type,
- Data.aid_Channel,
- Data.aid_MinFrequence,
- Data.aid_MaxFrequence
- );
- }
- else printf("AUDIOCMD_ChannelInfo error=%ld\n",IO->aio_Error);
- }
-
-
- printf("Software-Channel Info:\n");
- for(Num=0; Num<NumS; ++Num) {
- IO->aio_U.aio_ChInfo.acio_Channel=FirstS+Num;
- pOS_DoIO((pOS_IORequest*)IO);
- if(IO->aio_Error==0) {
- printf(
- "Channel = %ld\n"
- " ID = <%.40s>\n"
- " AudioMapType = 0x%lx\n"
- " Flags = 0x%lx\n"
- " Min. Freq. = %ld Hz\n"
- " Max. Freq. = %ld Hz\n"
- ,
- IO->aio_U.aio_ChInfo.acio_Channel,
- Data.aid_IDName,
- Data.aid_Type,
- Data.aid_Channel,
- Data.aid_MinFrequence,
- Data.aid_MaxFrequence
- );
- }
- else printf("AUDIOCMD_ChannelInfo error=%ld\n",IO->aio_Error);
- }
- }
- pOS_CloseDevice((pOS_IORequest*)IO);
- }
- else printf("pOS_OpenDevice failed, error=%ld\n",IO->aio_Error);
- pOS_DeleteIORequest((pOS_IORequest*)IO);
- }
- else printf("pOS_CreateIORequest failed\n");
- pOS_DestructMsgPort(&Port);
- }
- else printf("pOS_ConstructMsgPort failed\n");
-
- pOS_DeleteDosArgs(Args); /* Args freigeben */
- }
- else Err=DOSFAIL_FAIL; /* vollkommen fehlgeschlagen */
-
- pOS_SetShellFail(Err);
- }
-