home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 106 / EnigmaAmiga106CD.iso / software / sviluppo / ahisrc / device / ahi_def.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-29  |  9.8 KB  |  339 lines

  1. /* $Id: ahi_def.h,v 4.27 1999/08/29 23:53:02 lcs Exp $ */
  2.  
  3. /*
  4.      AHI - Hardware independent audio subsystem
  5.      Copyright (C) 1996-1999 Martin Blom <martin@blom.org>
  6.      
  7.      This library is free software; you can redistribute it and/or
  8.      modify it under the terms of the GNU Library General Public
  9.      License as published by the Free Software Foundation; either
  10.      version 2 of the License, or (at your option) any later version.
  11.      
  12.      This library is distributed in the hope that it will be useful,
  13.      but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.      Library General Public License for more details.
  16.      
  17.      You should have received a copy of the GNU Library General Public
  18.      License along with this library; if not, write to the
  19.      Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
  20.      MA 02139, USA.
  21. */
  22.  
  23. #ifndef _AHI_DEF_H_
  24. #define _AHI_DEF_H_
  25.  
  26. /*** Debug stuff ***/
  27.  
  28. extern void KPrintF(char *fmt,...);
  29. extern void kprintf(char *fmt,...);
  30. #define HIT {char *a=0; *a=0;}
  31.  
  32. /*** Processor identification ****/
  33.  
  34. #ifdef mc68020
  35. # define MC68020_PLUS
  36. #endif
  37.  
  38. #ifdef mc68030
  39. # define MC68020_PLUS
  40. # define MC68030_PLUS
  41. #endif
  42.  
  43. #ifdef mc68040
  44. # define MC68020_PLUS
  45. # define MC68030_PLUS
  46. # define MC68040_PLUS
  47. #endif
  48.  
  49. #ifdef mc68060
  50. # define MC68020_PLUS
  51. # define MC68030_PLUS
  52. # define MC68040_PLUS
  53. # define MC68060_PLUS
  54. #endif
  55.  
  56. #ifdef MC68020_PLUS
  57. # define HAVE_HIFI
  58. # define HAVE_CLIPPING
  59. #endif
  60.  
  61. /*** AHI include files ***/
  62.  
  63. #include <config.h>
  64. #include <CompilerSpecific.h>
  65.  
  66. #include <exec/semaphores.h>
  67. #include <exec/devices.h>
  68. #include <devices/ahi.h>
  69. #include <devices/timer.h>
  70. #include <libraries/ahi_sub.h>
  71. #include <utility/hooks.h>
  72.  
  73. struct Echo;
  74. struct AHIDevUnit;
  75.  
  76.  
  77. /*** Globals ***/
  78.  
  79. extern struct ExecBase          *SysBase;
  80. extern struct AHIBase           *AHIBase;
  81. extern struct DosLibrary        *DOSBase;
  82. extern struct Library           *GadToolsBase;
  83. extern struct GfxBase           *GfxBase;
  84. extern struct Library           *IFFParseBase;
  85. extern struct IntuitionBase     *IntuitionBase;
  86. extern struct LocaleBase        *LocaleBase;
  87. extern struct Device            *TimerBase;
  88. extern struct UtilityBase       *UtilityBase;
  89. extern struct Library           *PowerPCBase;
  90. extern struct Library           *PPCLibBase;
  91. extern void                     *PPCObject;
  92.  
  93.  
  94. /*** Definitions ***/
  95.  
  96. #ifdef VERSION68K
  97.  
  98. struct Fixed64
  99. {
  100.         LONG    I;
  101.         ULONG   F;
  102. };
  103.  
  104. typedef struct Fixed64  Fixed64;
  105.  
  106. #else /* VERSION68K */
  107.  
  108. typedef long long int   Fixed64;
  109.  
  110. #endif /* VERSION68K */
  111.  
  112.  
  113. #define AHI_UNITS       4       /* Normal units, excluding AHI_NO_UNIT */
  114.  
  115. #define AHIBB_NOSURROUND        (0)
  116. #define AHIBF_NOSURROUND        (1L<<0)
  117. #define AHIBB_NOECHO            (1)
  118. #define AHIBF_NOECHO            (1L<<1)
  119. #define AHIBB_FASTECHO          (2)
  120. #define AHIBF_FASTECHO          (1L<<2)
  121. #define AHIBB_CLIPPING          (3)
  122. #define AHIBF_CLIPPING          (1L<<3)
  123.  
  124. /* AHIBase */
  125. struct AHIBase
  126. {
  127.   struct Library           ahib_Library;
  128.   UBYTE                    ahib_Flags;
  129.   UBYTE                    ahib_DebugLevel;
  130.   struct ExecBase         *ahib_SysLib;
  131.   ULONG                    ahib_SegList;
  132.   APTR                     ahib_AudioCtrl;
  133.   struct AHIDevUnit       *ahib_DevUnits[AHI_UNITS];
  134.   struct SignalSemaphore   ahib_Lock;
  135.   ULONG                    ahib_AudioMode;
  136.   ULONG                    ahib_Frequency;
  137.   Fixed                    ahib_MonitorVolume;
  138.   Fixed                    ahib_InputGain;
  139.   Fixed                    ahib_OutputVolume;
  140.   ULONG                    ahib_Input;
  141.   ULONG                    ahib_Output;
  142.   Fixed                    ahib_MaxCPU;
  143.   Fixed                    ahib_AntiClickTime;
  144. };
  145.  
  146.  
  147. struct Timer
  148. {
  149.   struct EClockVal         EntryTime;
  150.   struct EClockVal         ExitTime;
  151. };
  152.  
  153.  
  154. struct AHISoundData
  155. {
  156.   ULONG   sd_Type;
  157.   APTR    sd_Addr;
  158.   ULONG   sd_Length;
  159.   APTR    sd_InputBuffer[3];
  160. };
  161.  
  162. /* Private AHIChannelData */
  163.  
  164. #ifdef VERSION68K
  165.  
  166. struct AHIChannelData
  167. {
  168.   UWORD   cd_EOS;                 /* $FFFF: Sample has reached end */
  169.   UBYTE   cd_FreqOK;              /* $00: Freq=0 ; $FF: Freq<>0 */
  170.   UBYTE   cd_SoundOK;             /* $00: No sound set ; $FF: S. OK. */
  171.   Fixed64 cd_Offset;
  172.   Fixed64 cd_Add;
  173.   APTR    cd_DataStart;
  174.   Fixed64 cd_LastOffset;
  175.   Fixed   cd_ScaleLeft;
  176.   Fixed   cd_ScaleRight;
  177.   APTR    cd_AddRoutine;
  178.   Fixed   cd_VolumeLeft;
  179.   Fixed   cd_VolumeRight;
  180.   ULONG   cd_Type;
  181.  
  182.   UWORD   cd_NextEOS;             /* Not in use */
  183.   UBYTE   cd_NextFreqOK;
  184.   UBYTE   cd_NextSoundOK;
  185.   Fixed64 cd_NextOffset;
  186.   Fixed64 cd_NextAdd;
  187.   APTR    cd_NextDataStart;
  188.   Fixed64 cd_NextLastOffset;
  189.   Fixed   cd_NextScaleLeft;
  190.   Fixed   cd_NextScaleRight;
  191.   APTR    cd_NextAddRoutine;
  192.   Fixed   cd_NextVolumeLeft;
  193.   Fixed   cd_NextVolumeRight;
  194.   ULONG   cd_NextType;
  195.  
  196.   LONG    cd_Samples;             /* Samples left to store (down-counter) */
  197.   LONG    cd_FirstOffsetI;        /* for linear interpolation routines */
  198.   LONG    cd_LastSampleL;         /* for linear interpolation routines */
  199.   LONG    cd_TempLastSampleL;     /* for linear interpolation routines */
  200.   LONG    cd_LastSampleR;         /* for linear interpolation routines */
  201.   LONG    cd_TempLastSampleR;     /* for linear interpolation routines */
  202.  
  203.   struct AHIChannelData *cd_Succ; /* For the wet and dry lists */
  204.   UWORD   cd_ChannelNo;
  205.   UWORD   cd_Pad;
  206. } __attribute__  ((packed));
  207.  
  208. #else
  209.  
  210. struct AHIChannelData
  211. {
  212.   UWORD   cd_EOS;                 /* $FFFF: Sample has reached end */
  213.  
  214.   UBYTE   cd_FreqOK;              /* $00: Freq=0 ; $FF: Freq<>0 */
  215.   UBYTE   cd_SoundOK;             /* $00: No sound set ; $FF: S. OK. */
  216.   APTR    cd_DataStart;
  217.   Fixed64 cd_Offset;
  218.   Fixed64 cd_Add;
  219.   Fixed64 cd_LastOffset;
  220.   Fixed   cd_ScaleLeft;
  221.   Fixed   cd_ScaleRight;
  222.   Fixed   cd_VolumeLeft;
  223.   Fixed   cd_VolumeRight;
  224.   APTR    cd_AddRoutine;
  225.   ULONG   cd_Type;
  226.  
  227.   UWORD   cd_Pad0;
  228.  
  229.   UBYTE   cd_NextFreqOK;
  230.   UBYTE   cd_NextSoundOK;
  231.   APTR    cd_NextDataStart;
  232.   Fixed64 cd_NextOffset;
  233.   Fixed64 cd_NextAdd;
  234.   Fixed64 cd_NextLastOffset;
  235.   Fixed   cd_NextScaleLeft;
  236.   Fixed   cd_NextScaleRight;
  237.   Fixed   cd_NextVolumeLeft;
  238.   Fixed   cd_NextVolumeRight;
  239.   APTR    cd_NextAddRoutine;
  240.   ULONG   cd_NextType;
  241.  
  242.   UWORD   cd_Pad1;
  243.  
  244.   UBYTE   cd_DelayedFreqOK;
  245.   UBYTE   cd_DelayedSoundOK;
  246.   APTR    cd_DelayedDataStart;
  247.   Fixed64 cd_DelayedOffset;
  248.   Fixed64 cd_DelayedAdd;
  249.   Fixed64 cd_DelayedLastOffset;
  250.   Fixed   cd_DelayedScaleLeft;
  251.   Fixed   cd_DelayedScaleRight;
  252.   Fixed   cd_DelayedVolumeLeft;
  253.   Fixed   cd_DelayedVolumeRight;
  254.   APTR    cd_DelayedAddRoutine;
  255.   ULONG   cd_DelayedType;
  256.  
  257.   BOOL    cd_SoundDelayed;
  258.   BOOL    cd_FreqDelayed;
  259.   BOOL    cd_VolDelayed;
  260.   UWORD   cd_Pad2;
  261.  
  262.   LONG    cd_Samples;             /* Samples left to store (down-counter) */
  263.   LONG    cd_FirstOffsetI;        /* for linear interpolation routines */
  264.  
  265.   LONG    cd_DelayedSamples;
  266.   LONG    cd_DelayedFirstOffsetI;
  267.  
  268.   LONG    cd_StartPointL;         /* for linear interpolation routines */
  269.   LONG    cd_TempStartPointL;     /* for linear interpolation routines */
  270.   LONG    cd_StartPointR;         /* for linear interpolation routines */
  271.   LONG    cd_TempStartPointR;     /* for linear interpolation routines */
  272.  
  273.   struct AHIChannelData *cd_Succ; /* For the wet and dry lists */
  274.   UWORD   cd_ChannelNo;
  275.   UWORD   cd_Pad3;
  276.   LONG    cd_AntiClickCount;
  277. };
  278.  
  279. #endif
  280.  
  281. #define AHIACB_NOMIXING 31              /* private ahiac_Flags flag */
  282. #define AHIACF_NOMIXING (1L<<31)        /* private ahiac_Flags flag */
  283. #define AHIACB_NOTIMING 30              /* private ahiac_Flags flag */
  284. #define AHIACF_NOTIMING (1L<<30)        /* private ahiac_Flags flag */
  285. #define AHIACB_POSTPROC 29              /* private ahiac_Flags flag */
  286. #define AHIACF_POSTPROC (1L<<29)        /* private ahiac_Flags flag */
  287. #define AHIACB_CLIPPING 28              /* private ahiac_Flags flag */
  288. #define AHIACF_CLIPPING (1L<<28)        /* private ahiac_Flags flag */
  289.  
  290. /* Private AudioCtrl structure */
  291.  
  292. struct AHIPrivAudioCtrl
  293. {
  294.   struct  AHIAudioCtrlDrv    ac;
  295.   struct  Library           *ahiac_SubLib;
  296.   ULONG                      ahiac_SubAllocRC;
  297.   struct AHIChannelData     *ahiac_ChannelDatas;
  298.   struct AHISoundData       *ahiac_SoundDatas;
  299.   ULONG                      ahiac_BuffSizeNow;     /* How many bytes of the buffer are used? */
  300.  
  301.   APTR                       ahiac_MasterVolumeTable;
  302.   APTR                       ahiac_MultTableS;
  303.   APTR                       ahiac_MultTableU;
  304.   struct Hook               *ahiac_RecordFunc;      /* AHIA_RecordFunc */
  305.   ULONG                      ahiac_AudioID;
  306.   Fixed                      ahiac_MasterVolume;    /* Real */
  307.   Fixed                      ahiac_SetMasterVolume; /* Set by user */
  308.   Fixed                      ahiac_EchoMasterVolume;/* Set by dspecho */
  309.   struct AHIEffOutputBuffer *ahiac_EffOutputBufferStruct;
  310.   struct Echo               *ahiac_EffDSPEchoStruct;
  311.   struct AHIEffChannelInfo  *ahiac_EffChannelInfoStruct;
  312.   struct AHIChannelData     *ahiac_WetList;
  313.   struct AHIChannelData     *ahiac_DryList;
  314.   UBYTE                      ahiac_WetOrDry;
  315.   UBYTE                      ahiac_MaxCPU;
  316.   UWORD                      ahiac_Channels2;       /* Max virtual channels/hw channel */
  317.   struct Timer               ahiac_Timer;
  318.   UWORD                      ahiac_UsedCPU;
  319.   volatile UWORD             ahiac_PPCCommand;
  320.   volatile void             *ahiac_PPCArgument;
  321.   APTR                       ahiac_PPCMixBuffer;
  322.   struct Interrupt          *ahiac_PPCMixInterrupt;
  323.   APTR                       ahiac_M68KPort;
  324.   APTR                       ahiac_PPCStartupMsg;
  325.   APTR                       ahiac_PPCTask;
  326.   char                       ahiac_DriverName[ 256 ];
  327. };  
  328.  
  329. #define AHIAC_COM_NONE          0
  330. #define AHIAC_COM_START         1
  331. #define AHIAC_COM_ACK           2
  332. #define AHIAC_COM_INIT          3
  333. #define AHIAC_COM_SOUNDFUNC     4
  334. #define AHIAC_COM_QUIT          5
  335. #define AHIAC_COM_DEBUG         6
  336. #define AHIAC_COM_FINISHED      7
  337.  
  338. #endif /* AHI_DEF_H_ */
  339.