home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / Sound.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  21.1 KB  |  627 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Sound.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __SOUND__
  18. #define __SOUND__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __MIXEDMODE__
  27. #include <MixedMode.h>
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if GENERATINGPOWERPC
  35. #pragma options align=mac68k
  36. #endif
  37.  
  38. #ifdef __CFM68K__
  39. #pragma lib_export on
  40. #endif
  41.  
  42.  
  43.  
  44. /*
  45. Interface for Sound Driver, !!! OBSOLETE and NOT SUPPORTED !!!
  46.  
  47. These items are no longer defined, but appear here so that someone
  48. searching the interfaces might find them. If you are using one of these
  49. items, you must change your code to support the Sound Manager.
  50.  
  51.     swMode, ftMode, ffMode
  52.     FreeWave, FFSynthRec, Tone, SWSynthRec, Wave, FTSoundRec
  53.     SndCompletionProcPtr
  54.     StartSound, StopSound, SoundDone
  55. */
  56.  
  57.  
  58. #define twelfthRootTwo            1.05946309434
  59. enum {
  60.     soundListRsrc                = 'snd ',                        /*Resource type used by Sound Manager*/
  61.     rate44khz                    = 0xAC440000L,                    /*44100.00000 in fixed-point*/
  62.     rate22050hz                    = 0x56220000L,                    /*22050.00000 in fixed-point*/
  63.     rate22khz                    = 0x56EE8BA3L,                    /*22254.54545 in fixed-point*/
  64.     rate11khz                    = 0x2B7745D1L,                    /*11127.27273 in fixed-point*/
  65.     rate11025hz                    = 0x2B110000,                    /*11025.00000 in fixed-point*/
  66. /*synthesizer numbers for SndNewChannel*/
  67.     squareWaveSynth                = 1,                            /*square wave synthesizer*/
  68.     waveTableSynth                = 3,                            /*wave table synthesizer*/
  69.     sampledSynth                = 5,                            /*sampled sound synthesizer*/
  70. /*old Sound Manager MACE synthesizer numbers*/
  71.     MACE3snthID                    = 11,
  72.     MACE6snthID                    = 13,
  73.     kMiddleC                    = 60,                            /*MIDI note value for middle C*/
  74.     kSimpleBeepID                = 1,                            /*reserved resource ID for Simple Beep*/
  75.     kFullVolume                    = 0x0100,                        /*1.0, setting for full hardware output volume*/
  76.     kNoVolume                    = 0,                            /*setting for no sound volume*/
  77. /*command numbers for SndDoCommand and SndDoImmediate*/
  78.     nullCmd                        = 0,
  79.     initCmd                        = 1,
  80.     freeCmd                        = 2,
  81.     quietCmd                    = 3,
  82.     flushCmd                    = 4,
  83.     reInitCmd                    = 5,
  84.     waitCmd                        = 10,
  85.     pauseCmd                    = 11,
  86.     resumeCmd                    = 12,
  87.     callBackCmd                    = 13
  88. };
  89.  
  90. enum {
  91.     syncCmd                        = 14,
  92.     availableCmd                = 24,
  93.     versionCmd                    = 25,
  94.     totalLoadCmd                = 26,
  95.     loadCmd                        = 27,
  96.     freqDurationCmd                = 40,
  97.     restCmd                        = 41,
  98.     freqCmd                        = 42,
  99.     ampCmd                        = 43,
  100.     timbreCmd                    = 44,
  101.     getAmpCmd                    = 45,
  102.     volumeCmd                    = 46,                            /*sound manager 3.0 or later only*/
  103.     getVolumeCmd                = 47,                            /*sound manager 3.0 or later only*/
  104.     waveTableCmd                = 60,
  105.     phaseCmd                    = 61
  106. };
  107.  
  108. enum {
  109.     soundCmd                    = 80,
  110.     bufferCmd                    = 81,
  111.     rateCmd                        = 82,
  112.     continueCmd                    = 83,
  113.     doubleBufferCmd                = 84,
  114.     getRateCmd                    = 85,
  115.     rateMultiplierCmd            = 86,
  116.     getRateMultiplierCmd        = 87,
  117.     sizeCmd                        = 90,
  118.     convertCmd                    = 91,
  119.     stdQLength                    = 128,
  120.     dataOffsetFlag                = 0x8000
  121. };
  122.  
  123. /*channel initialization parameters*/
  124. #if OLDROUTINENAMES
  125. enum {
  126.     waveInitChannelMask            = 0x07,
  127.     waveInitChannel0            = 0x04,                            /*wave table only, Sound Manager 2.0 and earlier*/
  128.     waveInitChannel1            = 0x05,                            /*wave table only, Sound Manager 2.0 and earlier*/
  129.     waveInitChannel2            = 0x06,                            /*wave table only, Sound Manager 2.0 and earlier*/
  130.     waveInitChannel3            = 0x07,                            /*wave table only, Sound Manager 2.0 and earlier*/
  131.     initChan0                    = waveInitChannel0,                /*obsolete spelling*/
  132.     initChan1                    = waveInitChannel1,                /*obsolete spelling*/
  133.     initChan2                    = waveInitChannel2,                /*obsolete spelling*/
  134.     initChan3                    = waveInitChannel3                /*obsolete spelling*/
  135. };
  136.  
  137. #endif
  138. enum {
  139.     initChanLeft                = 0x0002,                        /*left stereo channel*/
  140.     initChanRight                = 0x0003,                        /*right stereo channel*/
  141.     initNoInterp                = 0x0004,                        /*no linear interpolation*/
  142.     initNoDrop                    = 0x0008,                        /*no drop-sample conversion*/
  143.     initMono                    = 0x0080,                        /*monophonic channel*/
  144.     initStereo                    = 0x00C0,                        /*stereo channel*/
  145.     initMACE3                    = 0x0300,                        /*MACE 3:1*/
  146.     initMACE6                    = 0x0400,                        /*MACE 6:1*/
  147.     initPanMask                    = 0x0003,                        /*mask for right/left pan values*/
  148.     initSRateMask                = 0x0030,                        /*mask for sample rate values*/
  149.     initStereoMask                = 0x00C0,                        /*mask for mono/stereo values*/
  150.     initCompMask                = 0xFF00,                        /*mask for compression IDs*/
  151.     kUseOptionalOutputDevice    = -1,                            /*only for Sound Manager 3.0 or later*/
  152.     notCompressed                = 0,                            /*compression ID's*/
  153.     fixedCompression            = -1,                            /*compression ID for fixed-sized compression*/
  154.     variableCompression            = -2,                            /*compression ID for variable-sized compression*/
  155.     twoToOne                    = 1,
  156.     eightToThree                = 2,
  157.     threeToOne                    = 3,
  158.     sixToOne                    = 4
  159. };
  160.  
  161. enum {
  162.     stdSH                        = 0x00,                            /*Standard sound header encode value*/
  163.     extSH                        = 0xFF,                            /*Extended sound header encode value*/
  164.     cmpSH                        = 0xFE                            /*Compressed sound header encode value*/
  165. };
  166.  
  167. enum {
  168.     outsideCmpSH                = 0,                            /*MACE constants*/
  169.     insideCmpSH                    = 1,
  170.     aceSuccess                    = 0,
  171.     aceMemFull                    = 1,
  172.     aceNilBlock                    = 2,
  173.     aceBadComp                    = 3,
  174.     aceBadEncode                = 4,
  175.     aceBadDest                    = 5,
  176.     aceBadCmd                    = 6,
  177.     sixToOnePacketSize            = 8,
  178.     threeToOnePacketSize        = 16,
  179.     stateBlockSize                = 64,
  180.     leftOverBlockSize            = 32,
  181.     firstSoundFormat            = 0x0001,                        /*general sound format*/
  182.     secondSoundFormat            = 0x0002,                        /*special sampled sound format (HyperCard)*/
  183.     dbBufferReady                = 0x00000001,                    /*double buffer is filled*/
  184.     dbLastBuffer                = 0x00000004,                    /*last double buffer to play*/
  185.     sysBeepDisable                = 0x0000,                        /*SysBeep() enable flags*/
  186.     sysBeepEnable                = 0x0001,
  187.     unitTypeNoSelection            = 0xFFFF,                        /*unitTypes for AudioSelection.unitType*/
  188.     unitTypeSeconds                = 0x0000
  189. };
  190.  
  191.  
  192.  
  193. /* unsigned fixed-point number */
  194. typedef unsigned long UnsignedFixed;
  195.  
  196. struct SndCommand {
  197.     unsigned short                    cmd;
  198.     short                            param1;
  199.     long                            param2;
  200. };
  201. typedef struct SndCommand SndCommand;
  202.  
  203. typedef struct SndChannel SndChannel;
  204.  
  205. typedef SndChannel *SndChannelPtr;
  206.  
  207. typedef pascal void (*SndCallBackProcPtr)(SndChannelPtr chan, SndCommand *cmd);
  208.  
  209. #if GENERATINGCFM
  210. typedef UniversalProcPtr SndCallBackUPP;
  211. #else
  212. typedef SndCallBackProcPtr SndCallBackUPP;
  213. #endif
  214.  
  215. struct SndChannel {
  216.     struct SndChannel                *nextChan;
  217.     Ptr                                firstMod;                    /* reserved for the Sound Manager */
  218.     SndCallBackUPP                    callBack;
  219.     long                            userInfo;
  220.     long                            wait;                        /* The following is for internal Sound Manager use only.*/
  221.     SndCommand                        cmdInProgress;
  222.     short                            flags;
  223.     short                            qLength;
  224.     short                            qHead;
  225.     short                            qTail;
  226.     SndCommand                        queue[stdQLength];
  227. };
  228.  
  229.  
  230. /*MACE structures*/
  231. struct StateBlock {
  232.     short                            stateVar[stateBlockSize];
  233. };
  234. typedef struct StateBlock StateBlock;
  235.  
  236. typedef StateBlock *StateBlockPtr;
  237.  
  238. struct LeftOverBlock {
  239.     unsigned long                    count;
  240.     char                            sampleArea[leftOverBlockSize];
  241. };
  242. typedef struct LeftOverBlock LeftOverBlock;
  243.  
  244. typedef LeftOverBlock *LeftOverBlockPtr;
  245.  
  246. struct ModRef {
  247.     unsigned short                    modNumber;
  248.     long                            modInit;
  249. };
  250. typedef struct ModRef ModRef;
  251.  
  252. struct SndListResource {
  253.     short                            format;
  254.     short                            numModifiers;
  255.     ModRef                            modifierPart[1];            /*This is a variable length array*/
  256.     short                            numCommands;
  257.     SndCommand                        commandPart[1];                /*This is a variable length array*/
  258.     char                            dataPart[1];                /*This is a variable length array*/
  259. };
  260. typedef struct SndListResource SndListResource;
  261.  
  262. typedef SndListResource *SndListPtr;
  263.  
  264. typedef SndListPtr *SndListHndl, *SndListHandle;
  265.  
  266. /*HyperCard sound resource format*/
  267. struct Snd2ListResource {
  268.     short                            format;
  269.     short                            refCount;
  270.     short                            numCommands;
  271.     SndCommand                        commandPart[1];                /*This is a variable length array*/
  272.     char                            dataPart[1];                /*This is a variable length array*/
  273. };
  274. typedef struct Snd2ListResource Snd2ListResource;
  275.  
  276. typedef Snd2ListResource *Snd2ListPtr;
  277.  
  278. typedef Snd2ListPtr *Snd2ListHndl, *Snd2ListHandle;
  279.  
  280. struct SoundHeader {
  281.     Ptr                                samplePtr;                    /*if NIL then samples are in sampleArea*/
  282.     unsigned long                    length;                        /*length of sound in bytes*/
  283.     UnsignedFixed                    sampleRate;                    /*sample rate for this sound*/
  284.     unsigned long                    loopStart;                    /*start of looping portion*/
  285.     unsigned long                    loopEnd;                    /*end of looping portion*/
  286.     unsigned char                    encode;                        /*header encoding*/
  287.     unsigned char                    baseFrequency;                /*baseFrequency value*/
  288.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  289. };
  290. typedef struct SoundHeader SoundHeader;
  291.  
  292. typedef SoundHeader *SoundHeaderPtr;
  293.  
  294. struct CmpSoundHeader {
  295.     Ptr                                samplePtr;                    /*if nil then samples are in sample area*/
  296.     unsigned long                    numChannels;                /*number of channels i.e. mono = 1*/
  297.     UnsignedFixed                    sampleRate;                    /*sample rate in Apples Fixed point representation*/
  298.     unsigned long                    loopStart;                    /*loopStart of sound before compression*/
  299.     unsigned long                    loopEnd;                    /*loopEnd of sound before compression*/
  300.     unsigned char                    encode;                        /*data structure used , stdSH, extSH, or cmpSH*/
  301.     unsigned char                    baseFrequency;                /*same meaning as regular SoundHeader*/
  302.     unsigned long                    numFrames;                    /*length in frames ( packetFrames or sampleFrames )*/
  303.     extended80                        AIFFSampleRate;                /*IEEE sample rate*/
  304.     Ptr                                markerChunk;                /*sync track*/
  305.     OSType                            format;                        /*data format type, was futureUse1*/
  306.     unsigned long                    futureUse2;                    /*reserved by Apple*/
  307.     StateBlockPtr                    stateVars;                    /*pointer to State Block*/
  308.     LeftOverBlockPtr                leftOverSamples;            /*used to save truncated samples between compression calls*/
  309.     short                            compressionID;                /*0 means no compression, non zero means compressionID*/
  310.     unsigned short                    packetSize;                    /*number of bits in compressed sample packet*/
  311.     unsigned short                    snthID;                        /*resource ID of Sound Manager snth that contains NRT C/E*/
  312.     unsigned short                    sampleSize;                    /*number of bits in non-compressed sample*/
  313.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  314. };
  315. typedef struct CmpSoundHeader CmpSoundHeader;
  316.  
  317. typedef CmpSoundHeader *CmpSoundHeaderPtr;
  318.  
  319. struct ExtSoundHeader {
  320.     Ptr                                samplePtr;                    /*if nil then samples are in sample area*/
  321.     unsigned long                    numChannels;                /*number of channels,  ie mono = 1*/
  322.     UnsignedFixed                    sampleRate;                    /*sample rate in Apples Fixed point representation*/
  323.     unsigned long                    loopStart;                    /*same meaning as regular SoundHeader*/
  324.     unsigned long                    loopEnd;                    /*same meaning as regular SoundHeader*/
  325.     unsigned char                    encode;                        /*data structure used , stdSH, extSH, or cmpSH*/
  326.     unsigned char                    baseFrequency;                /*same meaning as regular SoundHeader*/
  327.     unsigned long                    numFrames;                    /*length in total number of frames*/
  328.     extended80                        AIFFSampleRate;                /*IEEE sample rate*/
  329.     Ptr                                markerChunk;                /*sync track*/
  330.     Ptr                                instrumentChunks;            /*AIFF instrument chunks*/
  331.     Ptr                                AESRecording;
  332.     unsigned short                    sampleSize;                    /*number of bits in sample*/
  333.     unsigned short                    futureUse1;                    /*reserved by Apple*/
  334.     unsigned long                    futureUse2;                    /*reserved by Apple*/
  335.     unsigned long                    futureUse3;                    /*reserved by Apple*/
  336.     unsigned long                    futureUse4;                    /*reserved by Apple*/
  337.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  338. };
  339. typedef struct ExtSoundHeader ExtSoundHeader;
  340.  
  341. typedef ExtSoundHeader *ExtSoundHeaderPtr;
  342.  
  343. struct ConversionBlock {
  344.     short                            destination;
  345.     short                            unused;
  346.     CmpSoundHeaderPtr                inputPtr;
  347.     CmpSoundHeaderPtr                outputPtr;
  348. };
  349. typedef struct ConversionBlock ConversionBlock;
  350.  
  351. typedef ConversionBlock *ConversionBlockPtr;
  352.  
  353. struct SMStatus {
  354.     short                            smMaxCPULoad;
  355.     short                            smNumChannels;
  356.     short                            smCurCPULoad;
  357. };
  358. typedef struct SMStatus SMStatus;
  359.  
  360. typedef SMStatus *SMStatusPtr;
  361.  
  362. struct SCStatus {
  363.     UnsignedFixed                    scStartTime;
  364.     UnsignedFixed                    scEndTime;
  365.     UnsignedFixed                    scCurrentTime;
  366.     Boolean                            scChannelBusy;
  367.     Boolean                            scChannelDisposed;
  368.     Boolean                            scChannelPaused;
  369.     Boolean                            scUnused;
  370.     unsigned long                    scChannelAttributes;
  371.     long                            scCPULoad;
  372. };
  373. typedef struct SCStatus SCStatus;
  374.  
  375. typedef SCStatus *SCStatusPtr;
  376.  
  377. struct AudioSelection {
  378.     long                            unitType;
  379.     UnsignedFixed                    selStart;
  380.     UnsignedFixed                    selEnd;
  381. };
  382. typedef pascal void (*FilePlayCompletionProcPtr)(SndChannelPtr chan);
  383.  
  384. #if GENERATINGCFM
  385. typedef UniversalProcPtr FilePlayCompletionUPP;
  386. #else
  387. typedef FilePlayCompletionProcPtr FilePlayCompletionUPP;
  388. #endif
  389.  
  390. enum {
  391.     uppFilePlayCompletionProcInfo = kPascalStackBased
  392.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  393. };
  394.  
  395. #if GENERATINGCFM
  396. #define NewFilePlayCompletionProc(userRoutine)        \
  397.         (FilePlayCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFilePlayCompletionProcInfo, GetCurrentArchitecture())
  398. #else
  399. #define NewFilePlayCompletionProc(userRoutine)        \
  400.         ((FilePlayCompletionUPP) (userRoutine))
  401. #endif
  402.  
  403. #if GENERATINGCFM
  404. #define CallFilePlayCompletionProc(userRoutine, chan)        \
  405.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFilePlayCompletionProcInfo, (chan))
  406. #else
  407. #define CallFilePlayCompletionProc(userRoutine, chan)        \
  408.         (*(userRoutine))((chan))
  409. #endif
  410.  
  411. typedef struct AudioSelection AudioSelection;
  412.  
  413. typedef AudioSelection *AudioSelectionPtr;
  414.  
  415. struct SndDoubleBuffer {
  416.     long                            dbNumFrames;
  417.     long                            dbFlags;
  418.     long                            dbUserInfo[2];
  419.     char                            dbSoundData[1];
  420. };
  421. typedef struct SndDoubleBuffer SndDoubleBuffer;
  422.  
  423. typedef SndDoubleBuffer *SndDoubleBufferPtr;
  424.  
  425. typedef pascal void (*SndDoubleBackProcPtr)(SndChannelPtr channel, SndDoubleBufferPtr doubleBufferPtr);
  426.  
  427. #if GENERATINGCFM
  428. typedef UniversalProcPtr SndDoubleBackUPP;
  429. #else
  430. typedef SndDoubleBackProcPtr SndDoubleBackUPP;
  431. #endif
  432.  
  433. enum {
  434.     uppSndDoubleBackProcInfo = kPascalStackBased
  435.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  436.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(SndDoubleBufferPtr)))
  437. };
  438.  
  439. #if GENERATINGCFM
  440. #define NewSndDoubleBackProc(userRoutine)        \
  441.         (SndDoubleBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndDoubleBackProcInfo, GetCurrentArchitecture())
  442. #else
  443. #define NewSndDoubleBackProc(userRoutine)        \
  444.         ((SndDoubleBackUPP) (userRoutine))
  445. #endif
  446.  
  447. #if GENERATINGCFM
  448. #define CallSndDoubleBackProc(userRoutine, channel, doubleBufferPtr)        \
  449.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSndDoubleBackProcInfo, (channel), (doubleBufferPtr))
  450. #else
  451. #define CallSndDoubleBackProc(userRoutine, channel, doubleBufferPtr)        \
  452.         (*(userRoutine))((channel), (doubleBufferPtr))
  453. #endif
  454.  
  455. struct SndDoubleBufferHeader {
  456.     short                            dbhNumChannels;
  457.     short                            dbhSampleSize;
  458.     short                            dbhCompressionID;
  459.     short                            dbhPacketSize;
  460.     UnsignedFixed                    dbhSampleRate;
  461.     SndDoubleBufferPtr                dbhBufferPtr[2];
  462.     SndDoubleBackUPP                dbhDoubleBack;
  463. };
  464. typedef struct SndDoubleBufferHeader SndDoubleBufferHeader;
  465.  
  466. typedef SndDoubleBufferHeader *SndDoubleBufferHeaderPtr;
  467.  
  468. struct SndDoubleBufferHeader2 {
  469.     short                            dbhNumChannels;
  470.     short                            dbhSampleSize;
  471.     short                            dbhCompressionID;
  472.     short                            dbhPacketSize;
  473.     UnsignedFixed                    dbhSampleRate;
  474.     SndDoubleBufferPtr                dbhBufferPtr[2];
  475.     SndDoubleBackUPP                dbhDoubleBack;
  476.     OSType                            dbhFormat;
  477. };
  478. typedef struct SndDoubleBufferHeader2 SndDoubleBufferHeader2;
  479.  
  480. typedef SndDoubleBufferHeader2 *SndDoubleBufferHeader2Ptr;
  481.  
  482. struct SoundInfoList {
  483.     short                            count;
  484.     Handle                            infoHandle;
  485. };
  486. typedef struct SoundInfoList SoundInfoList;
  487.  
  488. typedef SoundInfoList *SoundInfoListPtr;
  489.  
  490. struct CompressionInfo {
  491.     long                            recordSize;
  492.     OSType                            format;
  493.     short                            compressionID;
  494.     short                            samplesPerPacket;
  495.     short                            bytesPerPacket;
  496.     short                            bytesPerFrame;
  497.     short                            bytesPerSample;
  498.     short                            futureUse1;
  499. };
  500. typedef struct CompressionInfo CompressionInfo;
  501.  
  502. typedef CompressionInfo *CompressionInfoPtr;
  503.  
  504. typedef CompressionInfoPtr *CompressionInfoHandle;
  505.  
  506. /* These two routines for Get/SetSoundVol should no longer be used.*/
  507. /* They were for old Apple Sound Chip machines, and do not support the DSP or PowerMacs.*/
  508. /* Use Get/SetDefaultOutputVolume instead, if you must change the user's machine.*/
  509. #if OLDROUTINENAMES && !GENERATINGCFM
  510. extern pascal void SetSoundVol(short level);
  511.  
  512. #if !GENERATINGCFM
  513. #pragma parameter GetSoundVol(__A0)
  514. #endif
  515. extern pascal void GetSoundVol(short *level)
  516.  THREEWORDINLINE(0x4218, 0x10B8, 0x0260);
  517. #endif
  518.  
  519.  
  520. extern pascal OSErr SndDoCommand(SndChannelPtr chan, const SndCommand *cmd, Boolean noWait)
  521.  ONEWORDINLINE(0xA803);
  522. extern pascal OSErr SndDoImmediate(SndChannelPtr chan, const SndCommand *cmd)
  523.  ONEWORDINLINE(0xA804);
  524. extern pascal OSErr SndNewChannel(SndChannelPtr *chan, short synth, long init, SndCallBackUPP userRoutine)
  525.  ONEWORDINLINE(0xA807);
  526. extern pascal OSErr SndDisposeChannel(SndChannelPtr chan, Boolean quietNow)
  527.  ONEWORDINLINE(0xA801);
  528. extern pascal OSErr SndPlay(SndChannelPtr chan, SndListHandle sndHdl, Boolean async)
  529.  ONEWORDINLINE(0xA805);
  530. extern pascal OSErr SndAddModifier(SndChannelPtr chan, Ptr modifier, short id, long init)
  531.  ONEWORDINLINE(0xA802);
  532. extern pascal OSErr SndControl(short id, SndCommand *cmd)
  533.  ONEWORDINLINE(0xA806);
  534.  
  535.  
  536. /* Sound Manager 2.0 and later, uses _SoundDispatch */
  537. extern pascal NumVersion SndSoundManagerVersion(void)
  538.  FOURWORDINLINE(0x203C, 0x000C, 0x0008, 0xA800);
  539. extern pascal OSErr SndStartFilePlay(SndChannelPtr chan, short fRefNum, short resNum, long bufferSize, void *theBuffer, AudioSelectionPtr theSelection, FilePlayCompletionUPP theCompletion, Boolean async)
  540.  FOURWORDINLINE(0x203C, 0x0D00, 0x0008, 0xA800);
  541. extern pascal OSErr SndPauseFilePlay(SndChannelPtr chan)
  542.  FOURWORDINLINE(0x203C, 0x0204, 0x0008, 0xA800);
  543. extern pascal OSErr SndStopFilePlay(SndChannelPtr chan, Boolean quietNow)
  544.  FOURWORDINLINE(0x203C, 0x0308, 0x0008, 0xA800);
  545. extern pascal OSErr SndChannelStatus(SndChannelPtr chan, short theLength, SCStatusPtr theStatus)
  546.  FOURWORDINLINE(0x203C, 0x0010, 0x0008, 0xA800);
  547. extern pascal OSErr SndManagerStatus(short theLength, SMStatusPtr theStatus)
  548.  FOURWORDINLINE(0x203C, 0x0014, 0x0008, 0xA800);
  549. extern pascal void SndGetSysBeepState(short *sysBeepState)
  550.  FOURWORDINLINE(0x203C, 0x0018, 0x0008, 0xA800);
  551. extern pascal OSErr SndSetSysBeepState(short sysBeepState)
  552.  FOURWORDINLINE(0x203C, 0x001C, 0x0008, 0xA800);
  553. extern pascal OSErr SndPlayDoubleBuffer(SndChannelPtr chan, SndDoubleBufferHeaderPtr theParams)
  554.  FOURWORDINLINE(0x203C, 0x0020, 0x0008, 0xA800);
  555.  
  556.  
  557. /* MACE compression routines */
  558. extern pascal NumVersion MACEVersion(void)
  559.  FOURWORDINLINE(0x203C, 0x0000, 0x0010, 0xA800);
  560. extern pascal void Comp3to1(const void *inBuffer, void *outBuffer, unsigned long cnt, const void *inState, void *outState, unsigned long numChannels, unsigned long whichChannel)
  561.  FOURWORDINLINE(0x203C, 0x0004, 0x0010, 0xA800);
  562. extern pascal void Exp1to3(const void *inBuffer, void *outBuffer, unsigned long cnt, const void *inState, void *outState, unsigned long numChannels, unsigned long whichChannel)
  563.  FOURWORDINLINE(0x203C, 0x0008, 0x0010, 0xA800);
  564. extern pascal void Comp6to1(const void *inBuffer, void *outBuffer, unsigned long cnt, const void *inState, void *outState, unsigned long numChannels, unsigned long whichChannel)
  565.  FOURWORDINLINE(0x203C, 0x000C, 0x0010, 0xA800);
  566. extern pascal void Exp1to6(const void *inBuffer, void *outBuffer, unsigned long cnt, const void *inState, void *outState, unsigned long numChannels, unsigned long whichChannel)
  567.  FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0xA800);
  568.  
  569.  
  570. /* Sound Manager 3.0 and later calls */
  571. extern pascal OSErr GetSysBeepVolume(long *level)
  572.  FOURWORDINLINE(0x203C, 0x0224, 0x0018, 0xA800);
  573. extern pascal OSErr SetSysBeepVolume(long level)
  574.  FOURWORDINLINE(0x203C, 0x0228, 0x0018, 0xA800);
  575. extern pascal OSErr GetDefaultOutputVolume(long *level)
  576.  FOURWORDINLINE(0x203C, 0x022C, 0x0018, 0xA800);
  577. extern pascal OSErr SetDefaultOutputVolume(long level)
  578.  FOURWORDINLINE(0x203C, 0x0230, 0x0018, 0xA800);
  579. extern pascal OSErr GetSoundHeaderOffset(SndListHandle sndHandle, long *offset)
  580.  FOURWORDINLINE(0x203C, 0x0404, 0x0018, 0xA800);
  581. extern pascal UnsignedFixed UnsignedFixedMulDiv(UnsignedFixed value, UnsignedFixed multiplier, UnsignedFixed divisor)
  582.  FOURWORDINLINE(0x203C, 0x060C, 0x0018, 0xA800);
  583. extern pascal OSErr GetCompressionInfo(short compressionID, OSType format, short numChannels, short sampleSize, CompressionInfoPtr cp)
  584.  FOURWORDINLINE(0x203C, 0x0710, 0x0018, 0xA800);
  585. extern pascal OSErr SetSoundPreference(OSType theType, Str255 name, Handle settings)
  586.  FOURWORDINLINE(0x203C, 0x0634, 0x0018, 0xA800);
  587. extern pascal OSErr GetSoundPreference(OSType theType, Str255 name, Handle settings)
  588.  FOURWORDINLINE(0x203C, 0x0638, 0x0018, 0xA800);
  589.  
  590.  
  591. enum {
  592.     uppSndCallBackProcInfo = kPascalStackBased
  593.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  594.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(SndCommand*)))
  595. };
  596.  
  597. #if GENERATINGCFM
  598. #define NewSndCallBackProc(userRoutine)        \
  599.         (SndCallBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndCallBackProcInfo, GetCurrentArchitecture())
  600. #else
  601. #define NewSndCallBackProc(userRoutine)        \
  602.         ((SndCallBackUPP) (userRoutine))
  603. #endif
  604.  
  605. #if GENERATINGCFM
  606. #define CallSndCallBackProc(userRoutine, chan, cmd)        \
  607.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSndCallBackProcInfo, (chan), (cmd))
  608. #else
  609. #define CallSndCallBackProc(userRoutine, chan, cmd)        \
  610.         (*(userRoutine))((chan), (cmd))
  611. #endif
  612.  
  613.  
  614. #ifdef __CFM68K__
  615. #pragma lib_export off
  616. #endif
  617.  
  618. #if GENERATINGPOWERPC
  619. #pragma options align=reset
  620. #endif
  621.  
  622. #ifdef __cplusplus
  623. }
  624. #endif
  625.  
  626. #endif /* __SOUND__ */
  627.