1 #ifndef DATATYPES_SOUNDCLASS_H
    2 #define DATATYPES_SOUNDCLASS_H
    3 
    4 /*
    5 	datatypes sound-object definitions (V50)
    6 
    7 	$VER: soundclass.h 50.14 (19.8.2003)
    8 
    9 	Copyright © 2003 The MorphOS Development Team, All Rights Reserved.
   10 */
   11 
   12 #ifndef UTILITY_TAGITEM_H
   13 # include <utility/tagitem.h>
   14 #endif
   15 
   16 #ifndef DATATYPES_DATATYPESCLASS_H
   17 # include <datatypes/datatypesclass.h>
   18 #endif
   19 
   20 #ifndef LIBRARIES_IFFPARSE_H
   21 # include <libraries/iffparse.h>
   22 #endif
   23 
   24 #ifndef DEVICES_TIMER_H
   25 # include <devices/timer.h>
   26 #endif
   27 
   28 #pragma pack(2)
   29 
   30 /*****************************************************************************/
   31 
   32 #define SOUNDDTCLASS    "sound.datatype"
   33 
   34 
   35 /*****************************************************************************/
   36 /* Sound streaming methods */
   37 
   38 #define SDTM_Dummy            (DTM_Dummy + 0x200)
   39 
   40 #define SDTM_FETCH            (SDTM_Dummy + 1)
   41 #define SDTM_APPEND           (SDTM_Dummy + 2)
   42 #define SDTM_REWIND           (SDTM_Dummy + 3)
   43 
   44 
   45 /* message structure for streaming methods */
   46 
   47 struct sdtFetch
   48 {
   49 	ULONG MethodID;             /* SDTM_FETCH */
   50 	APTR  sdtf_Buffer;          /* pointer to application provided buffer */
   51 	ULONG sdtf_Length;          /* length of the buffer in bytes*/
   52 	ULONG sdtf_Actual;          /* actual length of fetched data in bytes */
   53 	ULONG sdtf_EndOfStream;     /* true for end of stream */
   54 };
   55 
   56 struct sdtAppend
   57 {
   58 	ULONG MethodID;             /* SDTM_APPEND */
   59 	BPTR  sdta_Handle;          /* DOS file handle data will be written to */
   60 	APTR  sdta_Buffer;          /* pointer to data provided by application */
   61 	ULONG sdta_Length;          /* length of the data in bytes*/
   62 	ULONG sdta_EndOfStream;     /* set to true for end of stream */
   63 };
   64 
   65 
   66 /*****************************************************************************/
   67 /* Sound attributes */
   68 
   69 #define SDTA_Dummy            (DTA_Dummy + 500)
   70 
   71 #define SDTA_VoiceHeader      (SDTA_Dummy + 1)	/* OBSOLETE! */
   72 #define SDTA_Sample           (SDTA_Dummy + 2)
   73 #define SDTA_SampleLength     (SDTA_Dummy + 3)
   74 #define SDTA_Period           (SDTA_Dummy + 4)	/* OBSOLETE! */
   75 #define SDTA_Volume           (SDTA_Dummy + 5)
   76 #define SDTA_Cycles           (SDTA_Dummy + 6)  /* not supported yet  */
   77 #define SDTA_SignalTask       (SDTA_Dummy + 7)
   78 
   79 /*         NOTE: Due to a bug in sound.datatype V40 SDTA_SignalBit
   80  *               was actually implemented as a signal mask as opposed
   81  *               to a bit number. The documentation now reflects
   82  *               this. If you intend to use a signal bit number
   83  *               instead of the mask, use the new V44 tag
   84  *               SDTA_SignalBitNumber below.
   85  */
   86 
   87 #define SDTA_SignalBit        (SDTA_Dummy + 8)
   88 #define SDTA_SignalBitMask     SDTA_SignalBit
   89 #define SDTA_Continuous       (SDTA_Dummy + 9)
   90 #define SDTA_SignalBitNumber  (SDTA_Dummy + 10)
   91 
   92 /* #define SDTA_ReplayPeriod     (SDTA_Dummy + 12)  not supported yet */
   93 /* #define SDTA_SyncSampleChange (SDTA_Dummy + 17)  not supported yet */
   94 
   95 #define SDTA_Panning          (SDTA_Dummy + 31)
   96 #define SDTA_Frequency        (SDTA_Dummy + 32)
   97 #define SDTA_Mode             (SDTA_Dummy + 33)
   98 #define SDTA_PreciseVolume    (SDTA_Dummy + 34)
   99 #define SDTA_Duration         (SDTA_Dummy + 35)
  100 #define SDTA_SampleType       (SDTA_Dummy + 36)
  101 #define SDTA_Codec            (SDTA_Dummy + 37)
  102 
  103 /*****************************************************************************/
  104 /* SDTA_Mode sound.datatype API modes */
  105 
  106 #define SDTA_Mode_Compatible    0
  107 #define SDTA_Mode_Extended      1
  108 
  109 
  110 /*****************************************************************************/
  111 /* definitions for SDTA_SampleType (all types are signed) */
  112 
  113 #define SDTST_M8S   0x00010001   /* 8bit mono sample (default) */
  114 #define SDTST_S8S   0x00020001   /* 8bit stereo sample (samplewise left/right) */
  115 #define SDTST_M16S  0x00010002   /* same as SDTST_M8S but 16bit */
  116 #define SDTST_S16S  0x00020002   /* same as SDTST_S8S but 16bit */
  117 
  118 /* How to construct SDTA_SampleValue for any number of channels and sample   */
  119 /* size? The high word of sample type contains number of channels. The low   */
  120 /* word contains size of single sample (not frame) in bytes.                 */
  121 /* example: 5-channel 48-bit sound sample has sample type of 0x00050006.     */
  122 /* Some common types are defined above.                                      */
  123 
  124 
  125 /****************************************************************************/
  126 /* some handy macros */
  127 
  128 #define SDTM_CHANNELS(SampleType)        (SampleType >> 16)
  129 #define SDTM_BYTESPERSAMPLE(SampleType)  (SampleType & 0xFFFF)
  130 #define SDTM_BYTESPERPOINT(SampleType)   (SDTM_CHANNELS(SampleType) * SDTM_BYTESPERSAMPLE(SampleType))
  131 
  132 
  133 /*****************************************************************************/
  134 /* Data compression methods for 8SVX / 16SV */
  135 
  136 #define CMP_NONE      0
  137 #define CMP_FIBDELTA  1
  138 #define CMP_EXPDELTA  2
  139 
  140 /*****************************************************************************/
  141 /* Supported data compression methods for WAVE */
  142 
  143 #define CMP_WAVE_PCM               1
  144 #define CMP_WAVE_MICROSOFT_ADPCM   2
  145 #define CMP_WAVE_FLOAT32           3
  146 #define CMP_WAVE_ALAW              6
  147 #define CMP_WAVE_ULAW              7
  148 
  149 /*****************************************************************************/
  150 /* Unity = Fixed 1.0 = maximum volume */
  151 
  152 #define Unity  0x10000UL
  153 
  154 
  155 /*****************************************************************************/
  156 
  157 struct VoiceHeader
  158 {
  159 	ULONG vh_OneShotHiSamples;  /* # samples in the high octave 1-shot part */
  160 	ULONG vh_RepeatHiSamples;   /* # samples in the high octave repeat part */
  161 	ULONG vh_SamplesPerHiCycle; /* # samples/cycle in high octave, else 0 */
  162 	UWORD vh_SamplesPerSec;     /* data sampling rate */
  163 	UBYTE vh_Octaves;           /* # of octaves of waveforms */
  164 	UBYTE vh_Compression;       /* data compression technique used */
  165 	ULONG vh_Volume;            /* playback nominal volume from 0 to Unity
  166 	                             * (full volume). Map this value into
  167 	                             * the output hardware's dynamic range.
  168 	                             */
  169 };
  170 
  171 
  172 /*****************************************************************************/
  173 /* IFF types */
  174 
  175 #define ID_8SVX  MAKE_ID('8','S','V','X')
  176 #define ID_16SV  MAKE_ID('1','6','S','V')
  177 #define ID_VHDR  MAKE_ID('V','H','D','R')
  178 #define ID_CHAN  MAKE_ID('C','H','A','N')
  179 #define ID_BODY  MAKE_ID('B','O','D','Y')
  180 #define ID_NAME  MAKE_ID('N','A','M','E')
  181 #define ID_AUTH  MAKE_ID('A','U','T','H')
  182 #define ID_ANNO  MAKE_ID('A','N','N','O')
  183 #define ID_COPY  MAKE_ID('(','c',')',' ')
  184 
  185 
  186 /*****************************************************************************/
  187 /* IFF 8SVX sample types ('CHAN' property) */
  188 
  189 #define SVX_LEFT    (2L)
  190 #define SVX_RIGHT   (4L)
  191 #define SVX_STEREO  (6L)
  192 
  193 
  194 /*****************************************************************************/
  195 
  196 
  197 
  198 
  199 #pragma pack()
  200 
  201 #endif  /* DATATYPES_SOUNDCLASS_H */