Sound.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:106k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Sound.h
  3.  
  4.      Contains:   Sound Manager Interfaces.
  5.  
  6.      Version:    Technology: Sound Manager 3.6.7
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1986-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __SOUND__
  18. #define __SOUND__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __DIALOGS__
  23. #include "Dialogs.h"
  24. #endif
  25. #ifndef __COMPONENTS__
  26. #include "Components.h"
  27. #endif
  28. #ifndef __MIXEDMODE__
  29. #include "MixedMode.h"
  30. #endif
  31. /* For TimeRecord et al.  Once we're using the latest MacTypes.i, we should no longer need this.*/
  32. #ifndef __MOVIES__
  33. #include "Movies.h"
  34. #endif
  35. #if PRAGMA_ONCE
  36. #pragma once
  37. #endif
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=mac68k
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51. /*
  52.                         * * *  N O T E  * * *
  53.     This file has been updated to include Sound Manager 3.3 interfaces.
  54.     Some of the Sound Manager 3.0 interfaces were not put into the InterfaceLib
  55.     that originally shipped with the PowerMacs. These missing functions and the
  56.     new 3.3 interfaces have been released in the SoundLib library for PowerPC
  57.     developers to link with. The runtime library for these functions are
  58.     installed by the Sound Manager. The following functions are found in SoundLib.
  59.         GetCompressionInfo(), GetSoundPreference(), SetSoundPreference(),
  60.         UnsignedFixedMulDiv(), SndGetInfo(), SndSetInfo(), GetSoundOutputInfo(),
  61.         SetSoundOutputInfo(), GetCompressionName(), SoundConverterOpen(),
  62.         SoundConverterClose(), SoundConverterGetBufferSizes(), SoundConverterBeginConversion(),
  63.         SoundConverterConvertBuffer(), SoundConverterEndConversion(),
  64.         AudioGetBass(), AudioGetInfo(), AudioGetMute(), AudioGetOutputDevice(),
  65.         AudioGetTreble(), AudioGetVolume(), AudioMuteOnEvent(), AudioSetBass(),
  66.         AudioSetMute(), AudioSetToDefaults(), AudioSetTreble(), AudioSetVolume(),
  67.         OpenMixerSoundComponent(), CloseMixerSoundComponent(), SoundComponentAddSource(),
  68.         SoundComponentGetInfo(), SoundComponentGetSource(), SoundComponentGetSourceData(),
  69.         SoundComponentInitOutputDevice(), SoundComponentPauseSource(),
  70.         SoundComponentPlaySourceBuffer(), SoundComponentRemoveSource(),
  71.         SoundComponentSetInfo(), SoundComponentSetOutput(), SoundComponentSetSource(),
  72.         SoundComponentStartSource(), SoundComponentStopSource(),
  73.         ParseAIFFHeader(), ParseSndHeader(), SoundConverterGetInfo(), SoundConverterSetInfo()
  74. */
  75. /*
  76.     Interfaces for Sound Driver, !!! OBSOLETE and NOT SUPPORTED !!!
  77.     These items are no longer defined, but appear here so that someone
  78.     searching the interfaces might find them. If you are using one of these
  79.     items, you must change your code to support the Sound Manager.
  80.         swMode, ftMode, ffMode
  81.         FreeWave, FFSynthRec, Tone, SWSynthRec, Wave, FTSoundRec
  82.         SndCompletionProcPtr
  83.         StartSound, StopSound, SoundDone
  84.         SetSoundVol, GetSoundVol
  85. */
  86. /*
  87.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  88.    constants
  89.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  90. */
  91. #define twelfthRootTwo 1.05946309435
  92. enum {
  93.     soundListRsrc               = FOUR_CHAR_CODE('snd '),       /*Resource type used by Sound Manager*/
  94.     kSoundCodecInfoResourceType = FOUR_CHAR_CODE('snfo')        /*Resource type holding codec information (optional public component resource)*/
  95. };
  96. enum {
  97.     kSimpleBeepID               = 1                             /*reserved resource ID for Simple Beep*/
  98. };
  99. enum {
  100.     rate48khz                   = (long)0xBB800000,             /*48000.00000 in fixed-point*/
  101.     rate44khz                   = (long)0xAC440000,             /*44100.00000 in fixed-point*/
  102.     rate32khz                   = 0x7D000000,                   /*32000.00000 in fixed-point*/
  103.     rate22050hz                 = 0x56220000,                   /*22050.00000 in fixed-point*/
  104.     rate22khz                   = 0x56EE8BA3,                   /*22254.54545 in fixed-point*/
  105.     rate16khz                   = 0x3E800000,                   /*16000.00000 in fixed-point*/
  106.     rate11khz                   = 0x2B7745D1,                   /*11127.27273 in fixed-point*/
  107.     rate11025hz                 = 0x2B110000,                   /*11025.00000 in fixed-point*/
  108.     rate8khz                    = 0x1F400000                    /* 8000.00000 in fixed-point*/
  109. };
  110. /*synthesizer numbers for SndNewChannel*/
  111. enum {
  112.     sampledSynth                = 5                             /*sampled sound synthesizer*/
  113. };
  114. #if CALL_NOT_IN_CARBON
  115. enum {
  116.     squareWaveSynth             = 1,                            /*square wave synthesizer*/
  117.     waveTableSynth              = 3,                            /*wave table synthesizer*/
  118.                                                                 /*old Sound Manager MACE synthesizer numbers*/
  119.     MACE3snthID                 = 11,
  120.     MACE6snthID                 = 13
  121. };
  122. #endif  /* CALL_NOT_IN_CARBON */
  123. enum {
  124.     kMiddleC                    = 60                            /*MIDI note value for middle C*/
  125. };
  126. enum {
  127.     kNoVolume                   = 0,                            /*setting for no sound volume*/
  128.     kFullVolume                 = 0x0100                        /*1.0, setting for full hardware output volume*/
  129. };
  130. enum {
  131.     stdQLength                  = 128
  132. };
  133. enum {
  134.     dataOffsetFlag              = 0x8000
  135. };
  136. enum {
  137.     kUseOptionalOutputDevice    = -1                            /*only for Sound Manager 3.0 or later*/
  138. };
  139. enum {
  140.     notCompressed               = 0,                            /*compression ID's*/
  141.     fixedCompression            = -1,                           /*compression ID for fixed-sized compression*/
  142.     variableCompression         = -2                            /*compression ID for variable-sized compression*/
  143. };
  144. enum {
  145.     twoToOne                    = 1,
  146.     eightToThree                = 2,
  147.     threeToOne                  = 3,
  148.     sixToOne                    = 4,
  149.     sixToOnePacketSize          = 8,
  150.     threeToOnePacketSize        = 16
  151. };
  152. enum {
  153.     stateBlockSize              = 64,
  154.     leftOverBlockSize           = 32
  155. };
  156. enum {
  157.     firstSoundFormat            = 0x0001,                       /*general sound format*/
  158.     secondSoundFormat           = 0x0002                        /*special sampled sound format (HyperCard)*/
  159. };
  160. #if CALL_NOT_IN_CARBON
  161. enum {
  162.     dbBufferReady               = 0x00000001,                   /*double buffer is filled*/
  163.     dbLastBuffer                = 0x00000004                    /*last double buffer to play*/
  164. };
  165. #endif  /* CALL_NOT_IN_CARBON */
  166. enum {
  167.     sysBeepDisable              = 0x0000,                       /*SysBeep() enable flags*/
  168.     sysBeepEnable               = (1 << 0),
  169.     sysBeepSynchronous          = (1 << 1)                      /*if bit set, make alert sounds synchronous*/
  170. };
  171. enum {
  172.     unitTypeNoSelection         = 0xFFFF,                       /*unitTypes for AudioSelection.unitType*/
  173.     unitTypeSeconds             = 0x0000
  174. };
  175. enum {
  176.     stdSH                       = 0x00,                         /*Standard sound header encode value*/
  177.     extSH                       = 0xFF,                         /*Extended sound header encode value*/
  178.     cmpSH                       = 0xFE                          /*Compressed sound header encode value*/
  179. };
  180. /*command numbers for SndDoCommand and SndDoImmediate*/
  181. enum {
  182.     nullCmd                     = 0,
  183.     quietCmd                    = 3,
  184.     flushCmd                    = 4,
  185.     reInitCmd                   = 5,
  186.     waitCmd                     = 10,
  187.     pauseCmd                    = 11,
  188.     resumeCmd                   = 12,
  189.     callBackCmd                 = 13,
  190.     syncCmd                     = 14,
  191.     availableCmd                = 24,
  192.     versionCmd                  = 25,
  193.     volumeCmd                   = 46,                           /*sound manager 3.0 or later only*/
  194.     getVolumeCmd                = 47,                           /*sound manager 3.0 or later only*/
  195.     clockComponentCmd           = 50,                           /*sound manager 3.2.1 or later only*/
  196.     getClockComponentCmd        = 51,                           /*sound manager 3.2.1 or later only*/
  197.     scheduledSoundCmd           = 52,                           /*sound manager 3.3 or later only*/
  198.     linkSoundComponentsCmd      = 53,                           /*sound manager 3.3 or later only*/
  199.     soundCmd                    = 80,
  200.     bufferCmd                   = 81,
  201.     rateMultiplierCmd           = 86,
  202.     getRateMultiplierCmd        = 87
  203. };
  204. #if CALL_NOT_IN_CARBON
  205. /*command numbers for SndDoCommand and SndDoImmediate that are not available for use in Carbon */
  206. enum {
  207.     initCmd                     = 1,
  208.     freeCmd                     = 2,
  209.     totalLoadCmd                = 26,
  210.     loadCmd                     = 27,
  211.     freqDurationCmd             = 40,
  212.     restCmd                     = 41,
  213.     freqCmd                     = 42,
  214.     ampCmd                      = 43,
  215.     timbreCmd                   = 44,
  216.     getAmpCmd                   = 45,
  217.     waveTableCmd                = 60,
  218.     phaseCmd                    = 61,
  219.     rateCmd                     = 82,
  220.     continueCmd                 = 83,
  221.     doubleBufferCmd             = 84,
  222.     getRateCmd                  = 85,
  223.     sizeCmd                     = 90,                           /*obsolete command*/
  224.     convertCmd                  = 91                            /*obsolete MACE command*/
  225. };
  226. #endif  /* CALL_NOT_IN_CARBON */
  227. #if OLDROUTINENAMES
  228. /*channel initialization parameters*/
  229. enum {
  230.     waveInitChannelMask         = 0x07,
  231.     waveInitChannel0            = 0x04,                         /*wave table only, Sound Manager 2.0 and earlier*/
  232.     waveInitChannel1            = 0x05,                         /*wave table only, Sound Manager 2.0 and earlier*/
  233.     waveInitChannel2            = 0x06,                         /*wave table only, Sound Manager 2.0 and earlier*/
  234.     waveInitChannel3            = 0x07,                         /*wave table only, Sound Manager 2.0 and earlier*/
  235.     initChan0                   = waveInitChannel0,             /*obsolete spelling*/
  236.     initChan1                   = waveInitChannel1,             /*obsolete spelling*/
  237.     initChan2                   = waveInitChannel2,             /*obsolete spelling*/
  238.     initChan3                   = waveInitChannel3              /*obsolete spelling*/
  239. };
  240. enum {
  241.     outsideCmpSH                = 0,                            /*obsolete MACE constant*/
  242.     insideCmpSH                 = 1,                            /*obsolete MACE constant*/
  243.     aceSuccess                  = 0,                            /*obsolete MACE constant*/
  244.     aceMemFull                  = 1,                            /*obsolete MACE constant*/
  245.     aceNilBlock                 = 2,                            /*obsolete MACE constant*/
  246.     aceBadComp                  = 3,                            /*obsolete MACE constant*/
  247.     aceBadEncode                = 4,                            /*obsolete MACE constant*/
  248.     aceBadDest                  = 5,                            /*obsolete MACE constant*/
  249.     aceBadCmd                   = 6                             /*obsolete MACE constant*/
  250. };
  251. #endif  /* OLDROUTINENAMES */
  252. enum {
  253.     initChanLeft                = 0x0002,                       /*left stereo channel*/
  254.     initChanRight               = 0x0003,                       /*right stereo channel*/
  255.     initNoInterp                = 0x0004,                       /*no linear interpolation*/
  256.     initNoDrop                  = 0x0008,                       /*no drop-sample conversion*/
  257.     initMono                    = 0x0080,                       /*monophonic channel*/
  258.     initStereo                  = 0x00C0,                       /*stereo channel*/
  259.     initMACE3                   = 0x0300,                       /*MACE 3:1*/
  260.     initMACE6                   = 0x0400,                       /*MACE 6:1*/
  261.     initPanMask                 = 0x0003,                       /*mask for right/left pan values*/
  262.     initSRateMask               = 0x0030,                       /*mask for sample rate values*/
  263.     initStereoMask              = 0x00C0,                       /*mask for mono/stereo values*/
  264.     initCompMask                = 0xFF00                        /*mask for compression IDs*/
  265. };
  266. /*Get&Set Sound Information Selectors*/
  267. enum {
  268.     siActiveChannels            = FOUR_CHAR_CODE('chac'),       /*active channels*/
  269.     siActiveLevels              = FOUR_CHAR_CODE('lmac'),       /*active meter levels*/
  270.     siAGCOnOff                  = FOUR_CHAR_CODE('agc '),       /*automatic gain control state*/
  271.     siAsync                     = FOUR_CHAR_CODE('asyn'),       /*asynchronous capability*/
  272.     siAVDisplayBehavior         = FOUR_CHAR_CODE('avdb'),
  273.     siChannelAvailable          = FOUR_CHAR_CODE('chav'),       /*number of channels available*/
  274.     siCompressionAvailable      = FOUR_CHAR_CODE('cmav'),       /*compression types available*/
  275.     siCompressionFactor         = FOUR_CHAR_CODE('cmfa'),       /*current compression factor*/
  276.     siCompressionHeader         = FOUR_CHAR_CODE('cmhd'),       /*return compression header*/
  277.     siCompressionNames          = FOUR_CHAR_CODE('cnam'),       /*compression type names available*/
  278.     siCompressionParams         = FOUR_CHAR_CODE('evaw'),       /*compression parameters*/
  279.     siCompressionSampleRate     = FOUR_CHAR_CODE('cprt'),       /* SetInfo only: compressor's sample rate*/
  280.     siCompressionChannels       = FOUR_CHAR_CODE('cpct'),       /* SetInfo only: compressor's number of channels*/
  281.     siCompressionOutputSampleRate = FOUR_CHAR_CODE('cort'),     /* GetInfo only: only implemented by compressors that have differing in and out rates */
  282.     siCompressionInputRateList  = FOUR_CHAR_CODE('crtl'),       /* GetInfo only: only implemented by compressors that only take certain input rates */
  283.     siCompressionType           = FOUR_CHAR_CODE('comp'),       /*current compression type*/
  284.     siCompressionConfiguration  = FOUR_CHAR_CODE('ccfg'),       /*compression extensions*/
  285.     siContinuous                = FOUR_CHAR_CODE('cont'),       /*continous recording*/
  286.     siDecompressionParams       = FOUR_CHAR_CODE('wave'),       /*decompression parameters*/
  287.     siDecompressionConfiguration = FOUR_CHAR_CODE('dcfg'),      /*decompression extensions*/
  288.     siDeviceBufferInfo          = FOUR_CHAR_CODE('dbin'),       /*size of interrupt buffer*/
  289.     siDeviceConnected           = FOUR_CHAR_CODE('dcon'),       /*input device connection status*/
  290.     siDeviceIcon                = FOUR_CHAR_CODE('icon'),       /*input device icon*/
  291.     siDeviceName                = FOUR_CHAR_CODE('name'),       /*input device name*/
  292.     siEQSpectrumBands           = FOUR_CHAR_CODE('eqsb'),       /* number of spectrum bands*/
  293.     siEQSpectrumLevels          = FOUR_CHAR_CODE('eqlv'),       /* gets spectum meter levels*/
  294.     siEQSpectrumOnOff           = FOUR_CHAR_CODE('eqlo'),       /* turn on/off spectum meter levels*/
  295.     siEQSpectrumResolution      = FOUR_CHAR_CODE('eqrs'),       /* set the resolution of the FFT, 0 = low res (<=16 bands), 1 = high res (16-64 bands)*/
  296.     siEQToneControlGain         = FOUR_CHAR_CODE('eqtg'),       /* set the bass and treble gain*/
  297.     siEQToneControlOnOff        = FOUR_CHAR_CODE('eqtc'),       /* turn on equalizer attenuation*/
  298.     siHardwareBalance           = FOUR_CHAR_CODE('hbal'),
  299.     siHardwareBalanceSteps      = FOUR_CHAR_CODE('hbls'),
  300.     siHardwareBass              = FOUR_CHAR_CODE('hbas'),
  301.     siHardwareBassSteps         = FOUR_CHAR_CODE('hbst'),
  302.     siHardwareBusy              = FOUR_CHAR_CODE('hwbs'),       /*sound hardware is in use*/
  303.     siHardwareFormat            = FOUR_CHAR_CODE('hwfm'),       /*get hardware format*/
  304.     siHardwareMute              = FOUR_CHAR_CODE('hmut'),       /*mute state of all hardware*/
  305.     siHardwareMuteNoPrefs       = FOUR_CHAR_CODE('hmnp'),       /*mute state of all hardware, but don't store in prefs */
  306.     siHardwareTreble            = FOUR_CHAR_CODE('htrb'),
  307.     siHardwareTrebleSteps       = FOUR_CHAR_CODE('hwts'),
  308.     siHardwareVolume            = FOUR_CHAR_CODE('hvol'),       /*volume level of all hardware*/
  309.     siHardwareVolumeSteps       = FOUR_CHAR_CODE('hstp'),       /*number of volume steps for hardware*/
  310.     siHeadphoneMute             = FOUR_CHAR_CODE('pmut'),       /*mute state of headphones*/
  311.     siHeadphoneVolume           = FOUR_CHAR_CODE('pvol'),       /*volume level of headphones*/
  312.     siHeadphoneVolumeSteps      = FOUR_CHAR_CODE('hdst'),       /*number of volume steps for headphones*/
  313.     siInputAvailable            = FOUR_CHAR_CODE('inav'),       /*input sources available*/
  314.     siInputGain                 = FOUR_CHAR_CODE('gain'),       /*input gain*/
  315.     siInputSource               = FOUR_CHAR_CODE('sour'),       /*input source selector*/
  316.     siInputSourceNames          = FOUR_CHAR_CODE('snam'),       /*input source names*/
  317.     siLevelMeterOnOff           = FOUR_CHAR_CODE('lmet'),       /*level meter state*/
  318.     siModemGain                 = FOUR_CHAR_CODE('mgai'),       /*modem input gain*/
  319.     siMonitorAvailable          = FOUR_CHAR_CODE('mnav'),
  320.     siMonitorSource             = FOUR_CHAR_CODE('mons'),
  321.     siNumberChannels            = FOUR_CHAR_CODE('chan'),       /*current number of channels*/
  322.     siOptionsDialog             = FOUR_CHAR_CODE('optd'),       /*display options dialog*/
  323.     siOSTypeInputSource         = FOUR_CHAR_CODE('inpt'),       /*input source by OSType*/
  324.     siOSTypeInputAvailable      = FOUR_CHAR_CODE('inav'),       /*list of available input source OSTypes*/
  325.     siOutputDeviceName          = FOUR_CHAR_CODE('onam'),       /*output device name*/
  326.     siPlayThruOnOff             = FOUR_CHAR_CODE('plth'),       /*playthrough state*/
  327.     siPostMixerSoundComponent   = FOUR_CHAR_CODE('psmx'),       /*install post-mixer effect*/
  328.     siPreMixerSoundComponent    = FOUR_CHAR_CODE('prmx'),       /*install pre-mixer effect*/
  329.     siQuality                   = FOUR_CHAR_CODE('qual'),       /*quality setting*/
  330.     siRateMultiplier            = FOUR_CHAR_CODE('rmul'),       /*throttle rate setting*/
  331.     siRecordingQuality          = FOUR_CHAR_CODE('qual'),       /*recording quality*/
  332.     siSampleRate                = FOUR_CHAR_CODE('srat'),       /*current sample rate*/
  333.     siSampleRateAvailable       = FOUR_CHAR_CODE('srav'),       /*sample rates available*/
  334.     siSampleSize                = FOUR_CHAR_CODE('ssiz'),       /*current sample size*/
  335.     siSampleSizeAvailable       = FOUR_CHAR_CODE('ssav'),       /*sample sizes available*/
  336.     siSetupCDAudio              = FOUR_CHAR_CODE('sucd'),       /*setup sound hardware for CD audio*/
  337.     siSetupModemAudio           = FOUR_CHAR_CODE('sumd'),       /*setup sound hardware for modem audio*/
  338.     siSlopeAndIntercept         = FOUR_CHAR_CODE('flap'),       /*floating point variables for conversion*/
  339.     siSoundClock                = FOUR_CHAR_CODE('sclk'),
  340.     siUseThisSoundClock         = FOUR_CHAR_CODE('sclc'),       /*sdev uses this to tell the mixer to use his sound clock*/
  341.     siSpeakerMute               = FOUR_CHAR_CODE('smut'),       /*mute state of all built-in speaker*/
  342.     siSpeakerVolume             = FOUR_CHAR_CODE('svol'),       /*volume level of built-in speaker*/
  343.     siSSpCPULoadLimit           = FOUR_CHAR_CODE('3dll'),
  344.     siSSpLocalization           = FOUR_CHAR_CODE('3dif'),
  345.     siSSpSpeakerSetup           = FOUR_CHAR_CODE('3dst'),
  346.     siStereoInputGain           = FOUR_CHAR_CODE('sgai'),       /*stereo input gain*/
  347.     siSubwooferMute             = FOUR_CHAR_CODE('bmut'),       /*mute state of sub-woofer*/
  348.     siTerminalType              = FOUR_CHAR_CODE('ttyp'),       /* usb terminal type */
  349.     siTwosComplementOnOff       = FOUR_CHAR_CODE('twos'),       /*two's complement state*/
  350.     siVendorProduct             = FOUR_CHAR_CODE('vpro'),       /* vendor and product ID */
  351.     siVolume                    = FOUR_CHAR_CODE('volu'),       /*volume level of source*/
  352.     siVoxRecordInfo             = FOUR_CHAR_CODE('voxr'),       /*VOX record parameters*/
  353.     siVoxStopInfo               = FOUR_CHAR_CODE('voxs'),       /*VOX stop parameters*/
  354.     siWideStereo                = FOUR_CHAR_CODE('wide'),       /*wide stereo setting*/
  355.     siSupportedExtendedFlags    = FOUR_CHAR_CODE('exfl'),       /*which flags are supported in Extended sound data structures*/
  356.     siRateConverterRollOffSlope = FOUR_CHAR_CODE('rcdb'),       /*the roll-off slope for the rate converter's filter, in whole dB as a long this value is a long whose range is from 20 (worst quality/fastest performance) to 90 (best quality/slowest performance)*/
  357.     siOutputLatency             = FOUR_CHAR_CODE('olte'),       /*latency of sound output component*/
  358.     siHALAudioDeviceID          = FOUR_CHAR_CODE('hlid'),       /*audio device id*/
  359.     siClientAcceptsVBR          = FOUR_CHAR_CODE('cvbr'),       /*client handles VBR*/
  360.     siSourceIsExhausted         = FOUR_CHAR_CODE('srcx'),       /*the ultimate source of data has run out (keep asking, but when you get nothing, that's it)*/
  361.     siMediaContextID            = FOUR_CHAR_CODE('uuid'),       /*media context id -- UUID */
  362.     siCompressionMaxPacketSize  = FOUR_CHAR_CODE('cmxp')        /*maximum compressed packet size for current configuration -- unsigned long */
  363. };
  364. enum {
  365.     siCloseDriver               = FOUR_CHAR_CODE('clos'),       /*reserved for internal use only*/
  366.     siInitializeDriver          = FOUR_CHAR_CODE('init'),       /*reserved for internal use only*/
  367.     siPauseRecording            = FOUR_CHAR_CODE('paus'),       /*reserved for internal use only*/
  368.     siUserInterruptProc         = FOUR_CHAR_CODE('user')        /*reserved for internal use only*/
  369. };
  370. /* input source Types*/
  371. enum {
  372.     kInvalidSource              = (long)0xFFFFFFFF,             /*this source may be returned from GetInfo if no other source is the monitored source*/
  373.     kNoSource                   = FOUR_CHAR_CODE('none'),       /*no source selection*/
  374.     kCDSource                   = FOUR_CHAR_CODE('cd  '),       /*internal CD player input*/
  375.     kExtMicSource               = FOUR_CHAR_CODE('emic'),       /*external mic input*/
  376.     kSoundInSource              = FOUR_CHAR_CODE('sinj'),       /*sound input jack*/
  377.     kRCAInSource                = FOUR_CHAR_CODE('irca'),       /*RCA jack input*/
  378.     kTVFMTunerSource            = FOUR_CHAR_CODE('tvfm'),
  379.     kDAVInSource                = FOUR_CHAR_CODE('idav'),       /*DAV analog input*/
  380.     kIntMicSource               = FOUR_CHAR_CODE('imic'),       /*internal mic input*/
  381.     kMediaBaySource             = FOUR_CHAR_CODE('mbay'),       /*media bay input*/
  382.     kModemSource                = FOUR_CHAR_CODE('modm'),       /*modem input (internal modem on desktops, PCI input on PowerBooks)*/
  383.     kPCCardSource               = FOUR_CHAR_CODE('pcm '),       /*PC Card pwm input*/
  384.     kZoomVideoSource            = FOUR_CHAR_CODE('zvpc'),       /*zoom video input*/
  385.     kDVDSource                  = FOUR_CHAR_CODE('dvda'),       /* DVD audio input*/
  386.     kMicrophoneArray            = FOUR_CHAR_CODE('mica')        /* microphone array*/
  387. };
  388. /*Sound Component Types and Subtypes*/
  389. enum {
  390.     kNoSoundComponentType       = FOUR_CHAR_CODE('****'),
  391.     kSoundComponentType         = FOUR_CHAR_CODE('sift'),       /*component type*/
  392.     kSoundComponentPPCType      = FOUR_CHAR_CODE('nift'),       /*component type for PowerPC code*/
  393.     kRate8SubType               = FOUR_CHAR_CODE('ratb'),       /*8-bit rate converter*/
  394.     kRate16SubType              = FOUR_CHAR_CODE('ratw'),       /*16-bit rate converter*/
  395.     kConverterSubType           = FOUR_CHAR_CODE('conv'),       /*sample format converter*/
  396.     kSndSourceSubType           = FOUR_CHAR_CODE('sour'),       /*generic source component*/
  397.     kMixerType                  = FOUR_CHAR_CODE('mixr'),
  398.     kMixer8SubType              = FOUR_CHAR_CODE('mixb'),       /*8-bit mixer*/
  399.     kMixer16SubType             = FOUR_CHAR_CODE('mixw'),       /*16-bit mixer*/
  400.     kSoundInputDeviceType       = FOUR_CHAR_CODE('sinp'),       /*sound input component*/
  401.     kWaveInSubType              = FOUR_CHAR_CODE('wavi'),       /*Windows waveIn*/
  402.     kWaveInSnifferSubType       = FOUR_CHAR_CODE('wisn'),       /*Windows waveIn sniffer*/
  403.     kSoundOutputDeviceType      = FOUR_CHAR_CODE('sdev'),       /*sound output component*/
  404.     kClassicSubType             = FOUR_CHAR_CODE('clas'),       /*classic hardware, i.e. Mac Plus*/
  405.     kASCSubType                 = FOUR_CHAR_CODE('asc '),       /*Apple Sound Chip device*/
  406.     kDSPSubType                 = FOUR_CHAR_CODE('dsp '),       /*DSP device*/
  407.     kAwacsSubType               = FOUR_CHAR_CODE('awac'),       /*Another of Will's Audio Chips device*/
  408.     kGCAwacsSubType             = FOUR_CHAR_CODE('awgc'),       /*Awacs audio with Grand Central DMA*/
  409.     kSingerSubType              = FOUR_CHAR_CODE('sing'),       /*Singer (via Whitney) based sound*/
  410.     kSinger2SubType             = FOUR_CHAR_CODE('sng2'),       /*Singer 2 (via Whitney) for Acme*/
  411.     kWhitSubType                = FOUR_CHAR_CODE('whit'),       /*Whit sound component for PrimeTime 3*/
  412.     kSoundBlasterSubType        = FOUR_CHAR_CODE('sbls'),       /*Sound Blaster for CHRP*/
  413.     kWaveOutSubType             = FOUR_CHAR_CODE('wavo'),       /*Windows waveOut*/
  414.     kWaveOutSnifferSubType      = FOUR_CHAR_CODE('wosn'),       /*Windows waveOut sniffer*/
  415.     kDirectSoundSubType         = FOUR_CHAR_CODE('dsnd'),       /*Windows DirectSound*/
  416.     kDirectSoundSnifferSubType  = FOUR_CHAR_CODE('dssn'),       /*Windows DirectSound sniffer*/
  417.     kUNIXsdevSubType            = FOUR_CHAR_CODE('un1x'),       /*UNIX base sdev*/
  418.     kUSBSubType                 = FOUR_CHAR_CODE('usb '),       /*USB device*/
  419.     kBlueBoxSubType             = FOUR_CHAR_CODE('bsnd'),       /*Blue Box sound component*/
  420.     kSoundCompressor            = FOUR_CHAR_CODE('scom'),
  421.     kSoundDecompressor          = FOUR_CHAR_CODE('sdec'),
  422.     kAudioComponentType         = FOUR_CHAR_CODE('adio'),       /*Audio components and sub-types*/
  423.     kAwacsPhoneSubType          = FOUR_CHAR_CODE('hphn'),
  424.     kAudioVisionSpeakerSubType  = FOUR_CHAR_CODE('telc'),
  425.     kAudioVisionHeadphoneSubType = FOUR_CHAR_CODE('telh'),
  426.     kPhilipsFaderSubType        = FOUR_CHAR_CODE('tvav'),
  427.     kSGSToneSubType             = FOUR_CHAR_CODE('sgs0'),
  428.     kSoundEffectsType           = FOUR_CHAR_CODE('snfx'),       /*sound effects type*/
  429.     kEqualizerSubType           = FOUR_CHAR_CODE('eqal'),       /*frequency equalizer*/
  430.     kSSpLocalizationSubType     = FOUR_CHAR_CODE('snd3')
  431. };
  432. /*Format Types*/
  433. enum {
  434.     kSoundNotCompressed         = FOUR_CHAR_CODE('NONE'),       /*sound is not compressed*/
  435.     k8BitOffsetBinaryFormat     = FOUR_CHAR_CODE('raw '),       /*8-bit offset binary*/
  436.     k16BitBigEndianFormat       = FOUR_CHAR_CODE('twos'),       /*16-bit big endian*/
  437.     k16BitLittleEndianFormat    = FOUR_CHAR_CODE('sowt'),       /*16-bit little endian*/
  438.     kFloat32Format              = FOUR_CHAR_CODE('fl32'),       /*32-bit floating point*/
  439.     kFloat64Format              = FOUR_CHAR_CODE('fl64'),       /*64-bit floating point*/
  440.     k24BitFormat                = FOUR_CHAR_CODE('in24'),       /*24-bit integer*/
  441.     k32BitFormat                = FOUR_CHAR_CODE('in32'),       /*32-bit integer*/
  442.     k32BitLittleEndianFormat    = FOUR_CHAR_CODE('23ni'),       /*32-bit little endian integer */
  443.     kMACE3Compression           = FOUR_CHAR_CODE('MAC3'),       /*MACE 3:1*/
  444.     kMACE6Compression           = FOUR_CHAR_CODE('MAC6'),       /*MACE 6:1*/
  445.     kCDXA4Compression           = FOUR_CHAR_CODE('cdx4'),       /*CD/XA 4:1*/
  446.     kCDXA2Compression           = FOUR_CHAR_CODE('cdx2'),       /*CD/XA 2:1*/
  447.     kIMACompression             = FOUR_CHAR_CODE('ima4'),       /*IMA 4:1*/
  448.     kULawCompression            = FOUR_CHAR_CODE('ulaw'),       /*.Law 2:1*/
  449.     kALawCompression            = FOUR_CHAR_CODE('alaw'),       /*aLaw 2:1*/
  450.     kMicrosoftADPCMFormat       = 0x6D730002,                   /*Microsoft ADPCM - ACM code 2*/
  451.     kDVIIntelIMAFormat          = 0x6D730011,                   /*DVI/Intel IMA ADPCM - ACM code 17*/
  452.     kDVAudioFormat              = FOUR_CHAR_CODE('dvca'),       /*DV Audio*/
  453.     kQDesignCompression         = FOUR_CHAR_CODE('QDMC'),       /*QDesign music*/
  454.     kQDesign2Compression        = FOUR_CHAR_CODE('QDM2'),       /*QDesign2 music*/
  455.     kQUALCOMMCompression        = FOUR_CHAR_CODE('Qclp'),       /*QUALCOMM PureVoice*/
  456.     kOffsetBinary               = k8BitOffsetBinaryFormat,      /*for compatibility*/
  457.     kTwosComplement             = k16BitBigEndianFormat,        /*for compatibility*/
  458.     kLittleEndianFormat         = k16BitLittleEndianFormat,     /*for compatibility*/
  459.     kMPEGLayer3Format           = 0x6D730055,                   /*MPEG Layer 3, CBR only (pre QT4.1)*/
  460.     kFullMPEGLay3Format         = FOUR_CHAR_CODE('.mp3')        /*MPEG Layer 3, CBR & VBR (QT4.1 and later)*/
  461. };
  462. #if TARGET_RT_LITTLE_ENDIAN
  463. enum {
  464.     k16BitNativeEndianFormat    = k16BitLittleEndianFormat,
  465.     k16BitNonNativeEndianFormat = k16BitBigEndianFormat
  466. };
  467. #else
  468. enum {
  469.     k16BitNativeEndianFormat    = k16BitBigEndianFormat,
  470.     k16BitNonNativeEndianFormat = k16BitLittleEndianFormat
  471. };
  472. #endif  /* TARGET_RT_LITTLE_ENDIAN */
  473. /*Features Flags*/
  474. enum {
  475.     k8BitRawIn                  = (1 << 0),                     /*data description*/
  476.     k8BitTwosIn                 = (1 << 1),
  477.     k16BitIn                    = (1 << 2),
  478.     kStereoIn                   = (1 << 3),
  479.     k8BitRawOut                 = (1 << 8),
  480.     k8BitTwosOut                = (1 << 9),
  481.     k16BitOut                   = (1 << 10),
  482.     kStereoOut                  = (1 << 11),
  483.     kReverse                    = (1L << 16),                   /*  function description*/
  484.     kRateConvert                = (1L << 17),
  485.     kCreateSoundSource          = (1L << 18),
  486.     kVMAwareness                = (1L << 21),                   /* component will hold its memory*/
  487.     kHighQuality                = (1L << 22),                   /*  performance description*/
  488.     kNonRealTime                = (1L << 23)
  489. };
  490. /*'snfo' Resource Feature Flags*/
  491. enum {
  492.     kSoundCodecInfoFixedCompression = (1L << 0),                /* has fixed compression format*/
  493.     kSoundCodecInfoVariableCompression = (1L << 1),             /* has variable compression format*/
  494.     kSoundCodecInfoHasRestrictedInputRates = (1L << 2),         /* compressor has restricted set of input sample rates*/
  495.     kSoundCodecInfoCanChangeOutputRate = (1L << 3),             /* compressor may output a different sample rate than it receives*/
  496.     kSoundCodecInfoRequiresExternalFraming = (1L << 4)          /* format requires external framing information during decode/encode*/
  497. };
  498. /*SoundComponentPlaySourceBuffer action flags*/
  499. enum {
  500.     kSourcePaused               = (1 << 0),
  501.     kPassThrough                = (1L << 16),
  502.     kNoSoundComponentChain      = (1L << 17)
  503. };
  504. /*SoundParamBlock flags, usefull for OpenMixerSoundComponent*/
  505. enum {
  506.     kNoMixing                   = (1 << 0),                     /*don't mix source*/
  507.     kNoSampleRateConversion     = (1 << 1),                     /*don't convert sample rate (i.e. 11 kHz -> 22 kHz)*/
  508.     kNoSampleSizeConversion     = (1 << 2),                     /*don't convert sample size (i.e. 16 -> 8)*/
  509.     kNoSampleFormatConversion   = (1 << 3),                     /*don't convert sample format (i.e. 'twos' -> 'raw ')*/
  510.     kNoChannelConversion        = (1 << 4),                     /*don't convert stereo/mono*/
  511.     kNoDecompression            = (1 << 5),                     /*don't decompress (i.e. 'MAC3' -> 'raw ')*/
  512.     kNoVolumeConversion         = (1 << 6),                     /*don't apply volume*/
  513.     kNoRealtimeProcessing       = (1 << 7),                     /*won't run at interrupt time*/
  514.     kScheduledSource            = (1 << 8),                     /*source is scheduled*/
  515.     kNonInterleavedBuffer       = (1 << 9),                     /*buffer is not interleaved samples*/
  516.     kNonPagingMixer             = (1 << 10),                    /*if VM is on, use the non-paging mixer*/
  517.     kSoundConverterMixer        = (1 << 11),                    /*the mixer is to be used by the SoundConverter*/
  518.     kPagingMixer                = (1 << 12),                    /*the mixer is to be used as a paging mixer when VM is on*/
  519.     kVMAwareMixer               = (1 << 13),                    /*passed to the output device when the SM is going to deal with VM safety*/
  520.     kExtendedSoundData          = (1 << 14)                     /*SoundComponentData record is actually an ExtendedSoundComponentData*/
  521. };
  522. /*SoundParamBlock quality settings*/
  523. enum {
  524.     kBestQuality                = (1 << 0)                      /*use interpolation in rate conversion*/
  525. };
  526. /*useful bit masks*/
  527. enum {
  528.     kInputMask                  = 0x000000FF,                   /*masks off input bits*/
  529.     kOutputMask                 = 0x0000FF00,                   /*masks off output bits*/
  530.     kOutputShift                = 8,                            /*amount output bits are shifted*/
  531.     kActionMask                 = 0x00FF0000,                   /*masks off action bits*/
  532.     kSoundComponentBits         = 0x00FFFFFF
  533. };
  534. /*audio atom types*/
  535. enum {
  536.     kAudioFormatAtomType        = FOUR_CHAR_CODE('frma'),
  537.     kAudioEndianAtomType        = FOUR_CHAR_CODE('enda'),
  538.     kAudioVBRAtomType           = FOUR_CHAR_CODE('vbra'),
  539.     kAudioTerminatorAtomType    = 0
  540. };
  541. /*siAVDisplayBehavior types*/
  542. enum {
  543.     kAVDisplayHeadphoneRemove   = 0,                            /* monitor does not have a headphone attached*/
  544.     kAVDisplayHeadphoneInsert   = 1,                            /* monitor has a headphone attached*/
  545.     kAVDisplayPlainTalkRemove   = 2,                            /* monitor either sending no input through CPU input port or unable to tell if input is coming in*/
  546.     kAVDisplayPlainTalkInsert   = 3                             /* monitor sending PlainTalk level microphone source input through sound input port*/
  547. };
  548. /*Audio Component constants*/
  549. enum {
  550.                                                                 /*Values for whichChannel parameter*/
  551.     audioAllChannels            = 0,                            /*All channels (usually interpreted as both left and right)*/
  552.     audioLeftChannel            = 1,                            /*Left channel*/
  553.     audioRightChannel           = 2,                            /*Right channel*/
  554.                                                                 /*Values for mute parameter*/
  555.     audioUnmuted                = 0,                            /*Device is unmuted*/
  556.     audioMuted                  = 1,                            /*Device is muted*/
  557.                                                                 /*Capabilities flags definitions*/
  558.     audioDoesMono               = (1L << 0),                    /*Device supports mono output*/
  559.     audioDoesStereo             = (1L << 1),                    /*Device supports stereo output*/
  560.     audioDoesIndependentChannels = (1L << 2)                    /*Device supports independent software control of each channel*/
  561. };
  562. /*Sound Input Qualities*/
  563. enum {
  564.     siCDQuality                 = FOUR_CHAR_CODE('cd  '),       /*44.1kHz, stereo, 16 bit*/
  565.     siBestQuality               = FOUR_CHAR_CODE('best'),       /*22kHz, mono, 8 bit*/
  566.     siBetterQuality             = FOUR_CHAR_CODE('betr'),       /*22kHz, mono, MACE 3:1*/
  567.     siGoodQuality               = FOUR_CHAR_CODE('good'),       /*22kHz, mono, MACE 6:1*/
  568.     siNoneQuality               = FOUR_CHAR_CODE('none')        /*settings don't match any quality for a get call*/
  569. };
  570. enum {
  571.     siDeviceIsConnected         = 1,                            /*input device is connected and ready for input*/
  572.     siDeviceNotConnected        = 0,                            /*input device is not connected*/
  573.     siDontKnowIfConnected       = -1,                           /*can't tell if input device is connected*/
  574.     siReadPermission            = 0,                            /*permission passed to SPBOpenDevice*/
  575.     siWritePermission           = 1                             /*permission passed to SPBOpenDevice*/
  576. };
  577. /*flags that SoundConverterFillBuffer will return*/
  578. enum {
  579.     kSoundConverterDidntFillBuffer = (1 << 0),                  /*set if the converter couldn't completely satisfy a SoundConverterFillBuffer request*/
  580.     kSoundConverterHasLeftOverData = (1 << 1)                   /*set if the converter had left over data after completely satisfying a SoundConverterFillBuffer call*/
  581. };
  582. /* flags for extendedFlags fields of ExtendedSoundComponentData, ExtendedSoundParamBlock, and ExtendedScheduledSoundHeader*/
  583. enum {
  584.     kExtendedSoundSampleCountNotValid = 1L << 0,                /* set if sampleCount of SoundComponentData isn't meaningful; use buffer size instead*/
  585.     kExtendedSoundBufferSizeValid = 1L << 1,                    /* set if bufferSize field is valid*/
  586.     kExtendedSoundFrameSizesValid = 1L << 2,                    /* set if frameSizesArray is valid (will be nil if all sizes are common and kExtendedSoundCommonFrameSizeValid is set*/
  587.     kExtendedSoundCommonFrameSizeValid = 1L << 3,               /* set if all audio frames have the same size and the commonFrameSize field is valid*/
  588.     kExtendedSoundExtensionsValid = 1L << 4,                    /* set if pointer to extensions array is valid*/
  589.     kExtendedSoundBufferFlagsValid = 1L << 5                    /* set if buffer flags field is valid*/
  590. };
  591. /* flags passed in bufferFlags/bufferFlagsMask extended fields if kExtendedSoundBufferFlagsValid extended flag is set*/
  592. enum {
  593.     kExtendedSoundBufferIsDiscontinuous = 1L << 0,              /* buffer is discontinuous with previous buffer*/
  594.     kExtendedSoundBufferIsFirstBuffer = 1L << 1                 /* buffer is first buffer*/
  595. };
  596. /*
  597.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  598.    typedefs
  599.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  600. */
  601. struct SndCommand {
  602.     unsigned short                  cmd;
  603.     short                           param1;
  604.     long                            param2;
  605. };
  606. typedef struct SndCommand               SndCommand;
  607. typedef struct SndChannel               SndChannel;
  608. typedef SndChannel *                    SndChannelPtr;
  609. typedef CALLBACK_API( void , SndCallBackProcPtr )(SndChannelPtr chan, SndCommand *cmd);
  610. typedef STACK_UPP_TYPE(SndCallBackProcPtr)                      SndCallBackUPP;
  611. struct SndChannel {
  612.     SndChannelPtr                   nextChan;
  613.     Ptr                             firstMod;                   /* reserved for the Sound Manager */
  614.     SndCallBackUPP                  callBack;
  615.     long                            userInfo;
  616.     long                            wait;                       /* The following is for internal Sound Manager use only.*/
  617.     SndCommand                      cmdInProgress;
  618.     short                           flags;
  619.     short                           qLength;
  620.     short                           qHead;
  621.     short                           qTail;
  622.     SndCommand                      queue[128];
  623. };
  624. #if OPAQUE_UPP_TYPES
  625.     EXTERN_API(SndCallBackUPP)
  626.     NewSndCallBackUPP              (SndCallBackProcPtr      userRoutine);
  627.     EXTERN_API(void)
  628.     DisposeSndCallBackUPP          (SndCallBackUPP          userUPP);
  629.     EXTERN_API(void)
  630.     InvokeSndCallBackUPP           (SndChannelPtr           chan,
  631.                                     SndCommand *            cmd,
  632.                                     SndCallBackUPP          userUPP);
  633. #else
  634.     enum { uppSndCallBackProcInfo = 0x000003C0 };                   /* pascal no_return_value Func(4_bytes, 4_bytes) */
  635.     #define NewSndCallBackUPP(userRoutine)                          (SndCallBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndCallBackProcInfo, GetCurrentArchitecture())
  636.     #define DisposeSndCallBackUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  637.     #define InvokeSndCallBackUPP(chan, cmd, userUPP)                CALL_TWO_PARAMETER_UPP((userUPP), uppSndCallBackProcInfo, (chan), (cmd))
  638. #endif
  639. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  640. #define NewSndCallBackProc(userRoutine)                         NewSndCallBackUPP(userRoutine)
  641. #define CallSndCallBackProc(userRoutine, chan, cmd)             InvokeSndCallBackUPP(chan, cmd, userRoutine)
  642. /*MACE structures*/
  643. struct StateBlock {
  644.     short                           stateVar[64];
  645. };
  646. typedef struct StateBlock               StateBlock;
  647. typedef StateBlock *                    StateBlockPtr;
  648. struct LeftOverBlock {
  649.     unsigned long                   count;
  650.     SInt8                           sampleArea[32];
  651. };
  652. typedef struct LeftOverBlock            LeftOverBlock;
  653. typedef LeftOverBlock *                 LeftOverBlockPtr;
  654. struct ModRef {
  655.     unsigned short                  modNumber;
  656.     long                            modInit;
  657. };
  658. typedef struct ModRef                   ModRef;
  659. struct SndListResource {
  660.     short                           format;
  661.     short                           numModifiers;
  662.     ModRef                          modifierPart[1];
  663.     short                           numCommands;
  664.     SndCommand                      commandPart[1];
  665.     UInt8                           dataPart[1];
  666. };
  667. typedef struct SndListResource          SndListResource;
  668. typedef SndListResource *               SndListPtr;
  669. typedef SndListPtr *                    SndListHandle;
  670. typedef SndListHandle                   SndListHndl;
  671. /*HyperCard sound resource format*/
  672. struct Snd2ListResource {
  673.     short                           format;
  674.     short                           refCount;
  675.     short                           numCommands;
  676.     SndCommand                      commandPart[1];
  677.     UInt8                           dataPart[1];
  678. };
  679. typedef struct Snd2ListResource         Snd2ListResource;
  680. typedef Snd2ListResource *              Snd2ListPtr;
  681. typedef Snd2ListPtr *                   Snd2ListHandle;
  682. typedef Snd2ListHandle                  Snd2ListHndl;
  683. struct SoundHeader {
  684.     Ptr                             samplePtr;                  /*if NIL then samples are in sampleArea*/
  685.     unsigned long                   length;                     /*length of sound in bytes*/
  686.     UnsignedFixed                   sampleRate;                 /*sample rate for this sound*/
  687.     unsigned long                   loopStart;                  /*start of looping portion*/
  688.     unsigned long                   loopEnd;                    /*end of looping portion*/
  689.     UInt8                           encode;                     /*header encoding*/
  690.     UInt8                           baseFrequency;              /*baseFrequency value*/
  691.     UInt8                           sampleArea[1];              /*space for when samples follow directly*/
  692. };
  693. typedef struct SoundHeader              SoundHeader;
  694. typedef SoundHeader *                   SoundHeaderPtr;
  695. struct CmpSoundHeader {
  696.     Ptr                             samplePtr;                  /*if nil then samples are in sample area*/
  697.     unsigned long                   numChannels;                /*number of channels i.e. mono = 1*/
  698.     UnsignedFixed                   sampleRate;                 /*sample rate in Apples Fixed point representation*/
  699.     unsigned long                   loopStart;                  /*loopStart of sound before compression*/
  700.     unsigned long                   loopEnd;                    /*loopEnd of sound before compression*/
  701.     UInt8                           encode;                     /*data structure used , stdSH, extSH, or cmpSH*/
  702.     UInt8                           baseFrequency;              /*same meaning as regular SoundHeader*/
  703.     unsigned long                   numFrames;                  /*length in frames ( packetFrames or sampleFrames )*/
  704.     extended80                      AIFFSampleRate;             /*IEEE sample rate*/
  705.     Ptr                             markerChunk;                /*sync track*/
  706.     OSType                          format;                     /*data format type, was futureUse1*/
  707.     unsigned long                   futureUse2;                 /*reserved by Apple*/
  708.     StateBlockPtr                   stateVars;                  /*pointer to State Block*/
  709.     LeftOverBlockPtr                leftOverSamples;            /*used to save truncated samples between compression calls*/
  710.     short                           compressionID;              /*0 means no compression, non zero means compressionID*/
  711.     unsigned short                  packetSize;                 /*number of bits in compressed sample packet*/
  712.     unsigned short                  snthID;                     /*resource ID of Sound Manager snth that contains NRT C/E*/
  713.     unsigned short                  sampleSize;                 /*number of bits in non-compressed sample*/
  714.     UInt8                           sampleArea[1];              /*space for when samples follow directly*/
  715. };
  716. typedef struct CmpSoundHeader           CmpSoundHeader;
  717. typedef CmpSoundHeader *                CmpSoundHeaderPtr;
  718. struct ExtSoundHeader {
  719.     Ptr                             samplePtr;                  /*if nil then samples are in sample area*/
  720.     unsigned long                   numChannels;                /*number of channels,  ie mono = 1*/
  721.     UnsignedFixed                   sampleRate;                 /*sample rate in Apples Fixed point representation*/
  722.     unsigned long                   loopStart;                  /*same meaning as regular SoundHeader*/
  723.     unsigned long                   loopEnd;                    /*same meaning as regular SoundHeader*/
  724.     UInt8                           encode;                     /*data structure used , stdSH, extSH, or cmpSH*/
  725.     UInt8                           baseFrequency;              /*same meaning as regular SoundHeader*/
  726.     unsigned long                   numFrames;                  /*length in total number of frames*/
  727.     extended80                      AIFFSampleRate;             /*IEEE sample rate*/
  728.     Ptr                             markerChunk;                /*sync track*/
  729.     Ptr                             instrumentChunks;           /*AIFF instrument chunks*/
  730.     Ptr                             AESRecording;
  731.     unsigned short                  sampleSize;                 /*number of bits in sample*/
  732.     unsigned short                  futureUse1;                 /*reserved by Apple*/
  733.     unsigned long                   futureUse2;                 /*reserved by Apple*/
  734.     unsigned long                   futureUse3;                 /*reserved by Apple*/
  735.     unsigned long                   futureUse4;                 /*reserved by Apple*/
  736.     UInt8                           sampleArea[1];              /*space for when samples follow directly*/
  737. };
  738. typedef struct ExtSoundHeader           ExtSoundHeader;
  739. typedef ExtSoundHeader *                ExtSoundHeaderPtr;
  740. union SoundHeaderUnion {
  741.     SoundHeader                     stdHeader;
  742.     CmpSoundHeader                  cmpHeader;
  743.     ExtSoundHeader                  extHeader;
  744. };
  745. typedef union SoundHeaderUnion          SoundHeaderUnion;
  746. struct ConversionBlock {
  747.     short                           destination;
  748.     short                           unused;
  749.     CmpSoundHeaderPtr               inputPtr;
  750.     CmpSoundHeaderPtr               outputPtr;
  751. };
  752. typedef struct ConversionBlock          ConversionBlock;
  753. typedef ConversionBlock *               ConversionBlockPtr;
  754. /* ScheduledSoundHeader flags*/
  755. enum {
  756.     kScheduledSoundDoScheduled  = 1 << 0,
  757.     kScheduledSoundDoCallBack   = 1 << 1,
  758.     kScheduledSoundExtendedHdr  = 1 << 2
  759. };
  760. struct ScheduledSoundHeader {
  761.     SoundHeaderUnion                u;
  762.     long                            flags;
  763.     short                           reserved;
  764.     short                           callBackParam1;
  765.     long                            callBackParam2;
  766.     TimeRecord                      startTime;
  767. };
  768. typedef struct ScheduledSoundHeader     ScheduledSoundHeader;
  769. typedef ScheduledSoundHeader *          ScheduledSoundHeaderPtr;
  770. struct ExtendedScheduledSoundHeader {
  771.     SoundHeaderUnion                u;
  772.     long                            flags;
  773.     short                           reserved;
  774.     short                           callBackParam1;
  775.     long                            callBackParam2;
  776.     TimeRecord                      startTime;
  777.     long                            recordSize;
  778.     long                            extendedFlags;
  779.     long                            bufferSize;
  780.     long                            frameCount;                 /* number of audio frames*/
  781.     long *                          frameSizesArray;            /* pointer to array of longs with frame sizes in bytes*/
  782.     long                            commonFrameSize;            /* size of each frame if common*/
  783.     void *                          extensionsPtr;              /*pointer to set of classic atoms (size,type,data,...)*/
  784.     long                            extensionsSize;             /*size of extensions data (extensionsPtr)*/
  785.     unsigned long                   bufferFlags;                /*set or cleared flags*/
  786.     unsigned long                   bufferFlagsMask;            /*which flags are valid*/
  787. };
  788. typedef struct ExtendedScheduledSoundHeader ExtendedScheduledSoundHeader;
  789. typedef ExtendedScheduledSoundHeader *  ExtendedScheduledSoundHeaderPtr;
  790. struct SMStatus {
  791.     short                           smMaxCPULoad;
  792.     short                           smNumChannels;
  793.     short                           smCurCPULoad;
  794. };
  795. typedef struct SMStatus                 SMStatus;
  796. typedef SMStatus *                      SMStatusPtr;
  797. struct SCStatus {
  798.     UnsignedFixed                   scStartTime;
  799.     UnsignedFixed                   scEndTime;
  800.     UnsignedFixed                   scCurrentTime;
  801.     Boolean                         scChannelBusy;
  802.     Boolean                         scChannelDisposed;
  803.     Boolean                         scChannelPaused;
  804.     Boolean                         scUnused;
  805.     unsigned long                   scChannelAttributes;
  806.     long                            scCPULoad;
  807. };
  808. typedef struct SCStatus                 SCStatus;
  809. typedef SCStatus *                      SCStatusPtr;
  810. struct AudioSelection {
  811.     long                            unitType;
  812.     UnsignedFixed                   selStart;
  813.     UnsignedFixed                   selEnd;
  814. };
  815. typedef struct AudioSelection           AudioSelection;
  816. typedef AudioSelection *                AudioSelectionPtr;
  817. #if CALL_NOT_IN_CARBON
  818. struct SndDoubleBuffer {
  819.     long                            dbNumFrames;
  820.     long                            dbFlags;
  821.     long                            dbUserInfo[2];
  822.     SInt8                           dbSoundData[1];
  823. };
  824. typedef struct SndDoubleBuffer          SndDoubleBuffer;
  825. typedef SndDoubleBuffer *               SndDoubleBufferPtr;
  826. typedef CALLBACK_API( void , SndDoubleBackProcPtr )(SndChannelPtr channel, SndDoubleBufferPtr doubleBufferPtr);
  827. typedef STACK_UPP_TYPE(SndDoubleBackProcPtr)                    SndDoubleBackUPP;
  828. #if OPAQUE_UPP_TYPES
  829.     EXTERN_API(SndDoubleBackUPP)
  830.     NewSndDoubleBackUPP            (SndDoubleBackProcPtr    userRoutine);
  831.     EXTERN_API(void)
  832.     DisposeSndDoubleBackUPP        (SndDoubleBackUPP        userUPP);
  833.     EXTERN_API(void)
  834.     InvokeSndDoubleBackUPP         (SndChannelPtr           channel,
  835.                                     SndDoubleBufferPtr      doubleBufferPtr,
  836.                                     SndDoubleBackUPP        userUPP);
  837. #else
  838.     enum { uppSndDoubleBackProcInfo = 0x000003C0 };                 /* pascal no_return_value Func(4_bytes, 4_bytes) */
  839.     #define NewSndDoubleBackUPP(userRoutine)                        (SndDoubleBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndDoubleBackProcInfo, GetCurrentArchitecture())
  840.     #define DisposeSndDoubleBackUPP(userUPP)                        DisposeRoutineDescriptor(userUPP)
  841.     #define InvokeSndDoubleBackUPP(channel, doubleBufferPtr, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppSndDoubleBackProcInfo, (channel), (doubleBufferPtr))
  842. #endif
  843. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  844. #define NewSndDoubleBackProc(userRoutine)                       NewSndDoubleBackUPP(userRoutine)
  845. #define CallSndDoubleBackProc(userRoutine, channel, doubleBufferPtr) InvokeSndDoubleBackUPP(channel, doubleBufferPtr, userRoutine)
  846. struct SndDoubleBufferHeader {
  847.     short                           dbhNumChannels;
  848.     short                           dbhSampleSize;
  849.     short                           dbhCompressionID;
  850.     short                           dbhPacketSize;
  851.     UnsignedFixed                   dbhSampleRate;
  852.     SndDoubleBufferPtr              dbhBufferPtr[2];
  853.     SndDoubleBackUPP                dbhDoubleBack;
  854. };
  855. typedef struct SndDoubleBufferHeader    SndDoubleBufferHeader;
  856. typedef SndDoubleBufferHeader *         SndDoubleBufferHeaderPtr;
  857. struct SndDoubleBufferHeader2 {
  858.     short                           dbhNumChannels;
  859.     short                           dbhSampleSize;
  860.     short                           dbhCompressionID;
  861.     short                           dbhPacketSize;
  862.     UnsignedFixed                   dbhSampleRate;
  863.     SndDoubleBufferPtr              dbhBufferPtr[2];
  864.     SndDoubleBackUPP                dbhDoubleBack;
  865.     OSType                          dbhFormat;
  866. };
  867. typedef struct SndDoubleBufferHeader2   SndDoubleBufferHeader2;
  868. typedef SndDoubleBufferHeader2 *        SndDoubleBufferHeader2Ptr;
  869. #endif  /* CALL_NOT_IN_CARBON */
  870. struct SoundInfoList {
  871.     short                           count;
  872.     Handle                          infoHandle;
  873. };
  874. typedef struct SoundInfoList            SoundInfoList;
  875. typedef SoundInfoList *                 SoundInfoListPtr;
  876. struct SoundComponentData {
  877.     long                            flags;
  878.     OSType                          format;
  879.     short                           numChannels;
  880.     short                           sampleSize;
  881.     UnsignedFixed                   sampleRate;
  882.     long                            sampleCount;
  883.     Byte *                          buffer;
  884.     long                            reserved;
  885. };
  886. typedef struct SoundComponentData       SoundComponentData;
  887. typedef SoundComponentData *            SoundComponentDataPtr;
  888. struct ExtendedSoundComponentData {
  889.     SoundComponentData              desc;                       /*description of sound buffer*/
  890.     long                            recordSize;                 /*size of this record in bytes*/
  891.     long                            extendedFlags;              /*flags for extended record*/
  892.     long                            bufferSize;                 /*size of buffer in bytes*/
  893.     long                            frameCount;                 /*number of audio frames*/
  894.     long *                          frameSizesArray;            /*pointer to array of longs with frame sizes in bytes*/
  895.     long                            commonFrameSize;            /*size of each frame if common*/
  896.     void *                          extensionsPtr;              /*pointer to set of classic atoms (size,type,data,...)*/
  897.     long                            extensionsSize;             /*size of extensions data (extensionsPtr)*/
  898.     unsigned long                   bufferFlags;                /*set or cleared flags*/
  899.     unsigned long                   bufferFlagsMask;            /*which flags are valid*/
  900. };
  901. typedef struct ExtendedSoundComponentData ExtendedSoundComponentData;
  902. typedef ExtendedSoundComponentData *    ExtendedSoundComponentDataPtr;
  903. typedef struct SoundParamBlock          SoundParamBlock;
  904. typedef SoundParamBlock *               SoundParamBlockPtr;
  905. typedef CALLBACK_API( Boolean , SoundParamProcPtr )(SoundParamBlockPtr *pb);
  906. typedef STACK_UPP_TYPE(SoundParamProcPtr)                       SoundParamUPP;
  907. struct SoundParamBlock {
  908.     long                            recordSize;                 /*size of this record in bytes*/
  909.     SoundComponentData              desc;                       /*description of sound buffer*/
  910.     UnsignedFixed                   rateMultiplier;             /*rate multiplier to apply to sound*/
  911.     short                           leftVolume;                 /*volumes to apply to sound*/
  912.     short                           rightVolume;
  913.     long                            quality;                    /*quality to apply to sound*/
  914.     ComponentInstance               filter;                     /*filter to apply to sound*/
  915.     SoundParamUPP                   moreRtn;                    /*routine to call to get more data*/
  916.     SoundParamUPP                   completionRtn;              /*routine to call when buffer is complete*/
  917.     long                            refCon;                     /*user refcon*/
  918.     short                           result;                     /*result*/
  919. };
  920. struct ExtendedSoundParamBlock {
  921.     SoundParamBlock                 pb;                         /*classic SoundParamBlock except recordSize == sizeof(ExtendedSoundParamBlock)*/
  922.     short                           reserved;
  923.     long                            extendedFlags;              /*flags*/
  924.     long                            bufferSize;                 /*size of buffer in bytes*/
  925.     long                            frameCount;                 /*number of audio frames*/
  926.     long *                          frameSizesArray;            /*pointer to array of longs with frame sizes in bytes*/
  927.     long                            commonFrameSize;            /*size of each frame if common*/
  928.     void *                          extensionsPtr;              /*pointer to set of classic atoms (size,type,data,...)*/
  929.     long                            extensionsSize;             /*size of extensions data (extensionsPtr)*/
  930.     unsigned long                   bufferFlags;                /*set or cleared flags*/
  931.     unsigned long                   bufferFlagsMask;            /*which flags are valid*/
  932. };
  933. typedef struct ExtendedSoundParamBlock  ExtendedSoundParamBlock;
  934. typedef ExtendedSoundParamBlock *       ExtendedSoundParamBlockPtr;
  935. struct CompressionInfo {
  936.     long                            recordSize;
  937.     OSType                          format;
  938.     short                           compressionID;
  939.     unsigned short                  samplesPerPacket;
  940.     unsigned short                  bytesPerPacket;
  941.     unsigned short                  bytesPerFrame;
  942.     unsigned short                  bytesPerSample;
  943.     unsigned short                  futureUse1;
  944. };
  945. typedef struct CompressionInfo          CompressionInfo;
  946. typedef CompressionInfo *               CompressionInfoPtr;
  947. typedef CompressionInfoPtr *            CompressionInfoHandle;
  948. /*variables for floating point conversion*/
  949. struct SoundSlopeAndInterceptRecord {
  950.     Float64                         slope;
  951.     Float64                         intercept;
  952.     Float64                         minClip;
  953.     Float64                         maxClip;
  954. };
  955. typedef struct SoundSlopeAndInterceptRecord SoundSlopeAndInterceptRecord;
  956. typedef SoundSlopeAndInterceptRecord *  SoundSlopeAndInterceptPtr;
  957. /*private thing to use as a reference to a Sound Converter*/
  958. typedef struct OpaqueSoundConverter*    SoundConverter;
  959. /*callback routine to provide data to the Sound Converter*/
  960. typedef CALLBACK_API( Boolean , SoundConverterFillBufferDataProcPtr )(SoundComponentDataPtr *data, void *refCon);
  961. typedef STACK_UPP_TYPE(SoundConverterFillBufferDataProcPtr)     SoundConverterFillBufferDataUPP;
  962. /*private thing to use as a reference to a Sound Source*/
  963. typedef struct OpaqueSoundSource*       SoundSource;
  964. typedef SoundSource *                   SoundSourcePtr;
  965. struct SoundComponentLink {
  966.     ComponentDescription            description;                /*Describes the sound component*/
  967.     SoundSource                     mixerID;                    /*Reserved by Apple*/
  968.     SoundSource *                   linkID;                     /*Reserved by Apple*/
  969. };
  970. typedef struct SoundComponentLink       SoundComponentLink;
  971. typedef SoundComponentLink *            SoundComponentLinkPtr;
  972. struct AudioInfo {
  973.     long                            capabilitiesFlags;          /*Describes device capabilities*/
  974.     long                            reserved;                   /*Reserved by Apple*/
  975.     unsigned short                  numVolumeSteps;             /*Number of significant increments between min and max volume*/
  976. };
  977. typedef struct AudioInfo                AudioInfo;
  978. typedef AudioInfo *                     AudioInfoPtr;
  979. struct AudioFormatAtom {
  980.     long                            size;                       /* = sizeof(AudioFormatAtom)*/
  981.     OSType                          atomType;                   /* = kAudioFormatAtomType*/
  982.     OSType                          format;
  983. };
  984. typedef struct AudioFormatAtom          AudioFormatAtom;
  985. typedef AudioFormatAtom *               AudioFormatAtomPtr;
  986. struct AudioEndianAtom {
  987.     long                            size;                       /* = sizeof(AudioEndianAtom)*/
  988.     OSType                          atomType;                   /* = kAudioEndianAtomType*/
  989.     short                           littleEndian;
  990. };
  991. typedef struct AudioEndianAtom          AudioEndianAtom;
  992. typedef AudioEndianAtom *               AudioEndianAtomPtr;
  993. struct AudioTerminatorAtom {
  994.     long                            size;                       /* = sizeof(AudioTerminatorAtom)*/
  995.     OSType                          atomType;                   /* = kAudioTerminatorAtomType*/
  996. };
  997. typedef struct AudioTerminatorAtom      AudioTerminatorAtom;
  998. typedef AudioTerminatorAtom *           AudioTerminatorAtomPtr;
  999. struct LevelMeterInfo {
  1000.     short                           numChannels;                /* mono or stereo source*/
  1001.     UInt8                           leftMeter;                  /* 0-255 range*/
  1002.     UInt8                           rightMeter;                 /* 0-255 range*/
  1003. };
  1004. typedef struct LevelMeterInfo           LevelMeterInfo;
  1005. typedef LevelMeterInfo *                LevelMeterInfoPtr;
  1006. struct EQSpectrumBandsRecord {
  1007.     short                           count;
  1008.     UnsignedFixedPtr                frequency;                  /* pointer to array of frequencies*/
  1009. };
  1010. typedef struct EQSpectrumBandsRecord    EQSpectrumBandsRecord;
  1011. typedef EQSpectrumBandsRecord *         EQSpectrumBandsRecordPtr;
  1012. /* Sound Input Structures*/
  1013. typedef struct SPB                      SPB;
  1014. typedef SPB *                           SPBPtr;
  1015. /*user procedures called by sound input routines*/
  1016. typedef CALLBACK_API( void , SIInterruptProcPtr )(SPBPtr inParamPtr, Ptr dataBuffer, short peakAmplitude, long sampleSize);
  1017. /*
  1018.     WARNING: SIInterruptProcPtr uses register based parameters under classic 68k
  1019.              and cannot be written in a high-level language without 
  1020.              the help of mixed mode or assembly glue.
  1021. */
  1022. typedef CALLBACK_API( void , SICompletionProcPtr )(SPBPtr inParamPtr);
  1023. typedef REGISTER_UPP_TYPE(SIInterruptProcPtr)                   SIInterruptUPP;
  1024. typedef STACK_UPP_TYPE(SICompletionProcPtr)                     SICompletionUPP;
  1025. /*Sound Input Parameter Block*/
  1026. struct SPB {
  1027.     long                            inRefNum;                   /*reference number of sound input device*/
  1028.     unsigned long                   count;                      /*number of bytes to record*/
  1029.     unsigned long                   milliseconds;               /*number of milliseconds to record*/
  1030.     unsigned long                   bufferLength;               /*length of buffer in bytes*/
  1031.     Ptr                             bufferPtr;                  /*buffer to store sound data in*/
  1032.     SICompletionUPP                 completionRoutine;          /*completion routine*/
  1033.     SIInterruptUPP                  interruptRoutine;           /*interrupt routine*/
  1034.     long                            userLong;                   /*user-defined field*/
  1035.     OSErr                           error;                      /*error*/
  1036.     long                            unused1;                    /*reserved - must be zero*/
  1037. };
  1038. #if OPAQUE_UPP_TYPES
  1039.     EXTERN_API(SoundParamUPP)
  1040.     NewSoundParamUPP               (SoundParamProcPtr       userRoutine);
  1041.     EXTERN_API(SoundConverterFillBufferDataUPP)
  1042.     NewSoundConverterFillBufferDataUPP    (SoundConverterFillBufferDataProcPtr userRoutine);
  1043.     EXTERN_API(SIInterruptUPP)
  1044.     NewSIInterruptUPP              (SIInterruptProcPtr      userRoutine);
  1045.     EXTERN_API(SICompletionUPP)
  1046.     NewSICompletionUPP             (SICompletionProcPtr     userRoutine);
  1047.     EXTERN_API(void)
  1048.     DisposeSoundParamUPP           (SoundParamUPP           userUPP);
  1049.     EXTERN_API(void)
  1050.     DisposeSoundConverterFillBufferDataUPP    (SoundConverterFillBufferDataUPP userUPP);
  1051.     EXTERN_API(void)
  1052.     DisposeSIInterruptUPP          (SIInterruptUPP          userUPP);
  1053.     EXTERN_API(void)
  1054.     DisposeSICompletionUPP         (SICompletionUPP         userUPP);
  1055.     EXTERN_API(Boolean)
  1056.     InvokeSoundParamUPP            (SoundParamBlockPtr *    pb,
  1057.                                     SoundParamUPP           userUPP);
  1058.     EXTERN_API(Boolean)
  1059.     InvokeSoundConverterFillBufferDataUPP    (SoundComponentDataPtr * data,
  1060.                                     void *                  refCon,
  1061.                                     SoundConverterFillBufferDataUPP userUPP);
  1062.     EXTERN_API(void)
  1063.     InvokeSIInterruptUPP           (SPBPtr                  inParamPtr,
  1064.                                     Ptr                     dataBuffer,
  1065.                                     short                   peakAmplitude,
  1066.                                     long                    sampleSize,
  1067.                                     SIInterruptUPP          userUPP);
  1068.     EXTERN_API(void)
  1069.     InvokeSICompletionUPP          (SPBPtr                  inParamPtr,
  1070.                                     SICompletionUPP         userUPP);
  1071. #else
  1072.     enum { uppSoundParamProcInfo = 0x000000D0 };                    /* pascal 1_byte Func(4_bytes) */
  1073.     enum { uppSoundConverterFillBufferDataProcInfo = 0x000003D0 };  /* pascal 1_byte Func(4_bytes, 4_bytes) */
  1074.     enum { uppSIInterruptProcInfo = 0x1C579802 };                   /* register no_return_value Func(4_bytes:A0, 4_bytes:A1, 2_bytes:D0, 4_bytes:D1) */
  1075.     enum { uppSICompletionProcInfo = 0x000000C0 };                  /* pascal no_return_value Func(4_bytes) */
  1076.     #define NewSoundParamUPP(userRoutine)                           (SoundParamUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSoundParamProcInfo, GetCurrentArchitecture())
  1077.     #define NewSoundConverterFillBufferDataUPP(userRoutine)         (SoundConverterFillBufferDataUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSoundConverterFillBufferDataProcInfo, GetCurrentArchitecture())
  1078.     #define NewSIInterruptUPP(userRoutine)                          (SIInterruptUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIInterruptProcInfo, GetCurrentArchitecture())
  1079.     #define NewSICompletionUPP(userRoutine)                         (SICompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSICompletionProcInfo, GetCurrentArchitecture())
  1080.     #define DisposeSoundParamUPP(userUPP)                           DisposeRoutineDescriptor(userUPP)
  1081.     #define DisposeSoundConverterFillBufferDataUPP(userUPP)         DisposeRoutineDescriptor(userUPP)
  1082.     #define DisposeSIInterruptUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  1083.     #define DisposeSICompletionUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  1084.     #define InvokeSoundParamUPP(pb, userUPP)                        (Boolean)CALL_ONE_PARAMETER_UPP((userUPP), uppSoundParamProcInfo, (pb))
  1085.     #define InvokeSoundConverterFillBufferDataUPP(data, refCon, userUPP)  (Boolean)CALL_TWO_PARAMETER_UPP((userUPP), uppSoundConverterFillBufferDataProcInfo, (data), (refCon))
  1086.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1087.     /* InvokeSIInterruptUPP can't be called from classic 68k without glue code */
  1088.     #else
  1089.         #define InvokeSIInterruptUPP(inParamPtr, dataBuffer, peakAmplitude, sampleSize, userUPP)  CALL_FOUR_PARAMETER_UPP((userUPP), uppSIInterruptProcInfo, (inParamPtr), (dataBuffer), (peakAmplitude), (sampleSize))
  1090.     #endif
  1091.     #define InvokeSICompletionUPP(inParamPtr, userUPP)              CALL_ONE_PARAMETER_UPP((userUPP), uppSICompletionProcInfo, (inParamPtr))
  1092. #endif
  1093. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  1094. #define NewSoundParamProc(userRoutine)                          NewSoundParamUPP(userRoutine)
  1095. #define NewSoundConverterFillBufferDataProc(userRoutine)        NewSoundConverterFillBufferDataUPP(userRoutine)
  1096. #define NewSIInterruptProc(userRoutine)                         NewSIInterruptUPP(userRoutine)
  1097. #define NewSICompletionProc(userRoutine)                        NewSICompletionUPP(userRoutine)
  1098. #define CallSoundParamProc(userRoutine, pb)                     InvokeSoundParamUPP(pb, userRoutine)
  1099. #define CallSoundConverterFillBufferDataProc(userRoutine, data, refCon) InvokeSoundConverterFillBufferDataUPP(data, refCon, userRoutine)
  1100. #define CallSIInterruptProc(userRoutine, inParamPtr, dataBuffer, peakAmplitude, sampleSize) InvokeSIInterruptUPP(inParamPtr, dataBuffer, peakAmplitude, sampleSize, userRoutine)
  1101. #define CallSICompletionProc(userRoutine, inParamPtr)           InvokeSICompletionUPP(inParamPtr, userRoutine)
  1102. typedef CALLBACK_API( void , FilePlayCompletionProcPtr )(SndChannelPtr chan);
  1103. typedef STACK_UPP_TYPE(FilePlayCompletionProcPtr)               FilePlayCompletionUPP;
  1104. #if OPAQUE_UPP_TYPES
  1105.     EXTERN_API(FilePlayCompletionUPP)
  1106.     NewFilePlayCompletionUPP       (FilePlayCompletionProcPtr userRoutine);
  1107.     EXTERN_API(void)
  1108.     DisposeFilePlayCompletionUPP    (FilePlayCompletionUPP  userUPP);
  1109.     EXTERN_API(void)
  1110.     InvokeFilePlayCompletionUPP    (SndChannelPtr           chan,
  1111.                                     FilePlayCompletionUPP   userUPP);
  1112. #else
  1113.     enum { uppFilePlayCompletionProcInfo = 0x000000C0 };            /* pascal no_return_value Func(4_bytes) */
  1114.     #define NewFilePlayCompletionUPP(userRoutine)                   (FilePlayCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFilePlayCompletionProcInfo, GetCurrentArchitecture())
  1115.     #define DisposeFilePlayCompletionUPP(userUPP)                   DisposeRoutineDescriptor(userUPP)
  1116.     #define InvokeFilePlayCompletionUPP(chan, userUPP)              CALL_ONE_PARAMETER_UPP((userUPP), uppFilePlayCompletionProcInfo, (chan))
  1117. #endif
  1118. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  1119. #define NewFilePlayCompletionProc(userRoutine)                  NewFilePlayCompletionUPP(userRoutine)
  1120. #define CallFilePlayCompletionProc(userRoutine, chan)           InvokeFilePlayCompletionUPP(chan, userRoutine)
  1121. /*
  1122.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1123.    prototypes
  1124.   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1125. */
  1126. /* Sound Manager routines */
  1127. EXTERN_API( void )
  1128. SysBeep                         (short                  duration)                           ONEWORDINLINE(0xA9C8);
  1129. EXTERN_API( OSErr )
  1130. SndDoCommand                    (SndChannelPtr          chan,
  1131.                                  const SndCommand *     cmd,
  1132.                                  Boolean                noWait)                             ONEWORDINLINE(0xA803);
  1133. EXTERN_API( OSErr )
  1134. SndDoImmediate                  (SndChannelPtr          chan,
  1135.                                  const SndCommand *     cmd)                                ONEWORDINLINE(0xA804);
  1136. EXTERN_API( OSErr )
  1137. SndNewChannel                   (SndChannelPtr *        chan,
  1138.                                  short                  synth,
  1139.                                  long                   init,
  1140.                                  SndCallBackUPP         userRoutine)                        ONEWORDINLINE(0xA807);
  1141. EXTERN_API( OSErr )
  1142. SndDisposeChannel               (SndChannelPtr          chan,
  1143.                                  Boolean                quietNow)                           ONEWORDINLINE(0xA801);
  1144. EXTERN_API( OSErr )
  1145. SndPlay                         (SndChannelPtr          chan,
  1146.                                  SndListHandle          sndHandle,
  1147.                                  Boolean                async)                              ONEWORDINLINE(0xA805);
  1148. #if OLDROUTINENAMES
  1149. EXTERN_API( OSErr )
  1150. SndAddModifier                  (SndChannelPtr          chan,
  1151.                                  Ptr                    modifier,
  1152.                                  short                  id,
  1153.                                  long                   init)                               ONEWORDINLINE(0xA802);
  1154. #endif  /* OLDROUTINENAMES */
  1155. EXTERN_API( OSErr )
  1156. SndControl                      (short                  id,
  1157.                                  SndCommand *           cmd)                                ONEWORDINLINE(0xA806);
  1158. /* Sound Manager 2.0 and later, uses _SoundDispatch */
  1159. EXTERN_API( NumVersion )
  1160. SndSoundManagerVersion          (void)                                                      FOURWORDINLINE(0x203C, 0x000C, 0x0008, 0xA800);
  1161. EXTERN_API( OSErr )
  1162. SndStartFilePlay                (SndChannelPtr          chan,
  1163.                                  short                  fRefNum,
  1164.                                  short                  resNum,
  1165.                                  long                   bufferSize,
  1166.                                  void *                 theBuffer,
  1167.                                  AudioSelectionPtr      theSelection,
  1168.                                  FilePlayCompletionUPP  theCompletion,
  1169.                                  Boolean                async)                              FOURWORDINLINE(0x203C, 0x0D00, 0x0008, 0xA800);
  1170. EXTERN_API( OSErr )
  1171. SndPauseFilePlay                (SndChannelPtr          chan)                               FOURWORDINLINE(0x203C, 0x0204, 0x0008, 0xA800);
  1172. EXTERN_API( OSErr )
  1173. SndStopFilePlay                 (SndChannelPtr          chan,
  1174.                                  Boolean                quietNow)                           FOURWORDINLINE(0x203C, 0x0308, 0x0008, 0xA800);
  1175. EXTERN_API( OSErr )
  1176. SndChannelStatus                (SndChannelPtr          chan,
  1177.                                  short                  theLength,
  1178.                                  SCStatusPtr            theStatus)                          FOURWORDINLINE(0x203C, 0x0510, 0x0008, 0xA800);
  1179. EXTERN_API( OSErr )
  1180. SndManagerStatus                (short                  theLength,
  1181.                                  SMStatusPtr            theStatus)                          FOURWORDINLINE(0x203C, 0x0314, 0x0008, 0xA800);
  1182. EXTERN_API( void )
  1183. SndGetSysBeepState              (short *                sysBeepState)                       FOURWORDINLINE(0x203C, 0x0218, 0x0008, 0xA800);
  1184. EXTERN_API( OSErr )
  1185. SndSetSysBeepState              (short                  sysBeepState)                       FOURWORDINLINE(0x203C, 0x011C, 0x0008, 0xA800);
  1186. EXTERN_API( OSErr )
  1187. SndPlayDoubleBuffer             (SndChannelPtr          chan,
  1188.                                  SndDoubleBufferHeaderPtr  theParams)                       FOURWORDINLINE(0x203C, 0x0420, 0x0008, 0xA800);
  1189. /* MACE compression routines, uses _SoundDispatch */
  1190. EXTERN_API( NumVersion )
  1191. MACEVersion                     (void)                                                      FOURWORDINLINE(0x203C, 0x0000, 0x0010, 0xA800);
  1192. EXTERN_API( void )
  1193. Comp3to1                        (const void *           inBuffer,
  1194.                                  void *                 outBuffer,
  1195.                                  unsigned long          cnt,
  1196.                                  StateBlockPtr          inState,
  1197.                                  StateBlockPtr          outState,
  1198.                                  unsigned long          numChannels,
  1199.                                  unsigned long          whichChannel)                       FOURWORDINLINE(0x203C, 0x0004, 0x0010, 0xA800);
  1200. EXTERN_API( void )
  1201. Exp1to3                         (const void *           inBuffer,
  1202.                                  void *                 outBuffer,
  1203.                                  unsigned long          cnt,
  1204.                                  StateBlockPtr          inState,
  1205.                                  StateBlockPtr          outState,
  1206.                                  unsigned long          numChannels,
  1207.                                  unsigned long          whichChannel)                       FOURWORDINLINE(0x203C, 0x0008, 0x0010, 0xA800);
  1208. EXTERN_API( void )
  1209. Comp6to1                        (const void *           inBuffer,
  1210.                                  void *                 outBuffer,
  1211.                                  unsigned long          cnt,
  1212.                                  StateBlockPtr          inState,
  1213.                                  StateBlockPtr          outState,
  1214.                                  unsigned long          numChannels,
  1215.                                  unsigned long          whichChannel)                       FOURWORDINLINE(0x203C, 0x000C, 0x0010, 0xA800);
  1216. EXTERN_API( void )
  1217. Exp1to6                         (const void *           inBuffer,
  1218.                                  void *                 outBuffer,
  1219.                                  unsigned long          cnt,
  1220.                                  StateBlockPtr          inState,
  1221.                                  StateBlockPtr          outState,
  1222.                                  unsigned long          numChannels,
  1223.                                  unsigned long          whichChannel)                       FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0xA800);
  1224. /* Sound Manager 3.0 and later calls, uses _SoundDispatch */
  1225. EXTERN_API( OSErr )
  1226. GetSysBeepVolume                (long *                 level)                              FOURWORDINLINE(0x203C, 0x0224, 0x0018, 0xA800);
  1227. EXTERN_API( OSErr )
  1228. SetSysBeepVolume                (long                   level)                              FOURWORDINLINE(0x203C, 0x0228, 0x0018, 0xA800);
  1229. EXTERN_API( OSErr )
  1230. GetDefaultOutputVolume          (long *                 level)                              FOURWORDINLINE(0x203C, 0x022C, 0x0018, 0xA800);
  1231. EXTERN_API( OSErr )
  1232. SetDefaultOutputVolume          (long                   level)                              FOURWORDINLINE(0x203C, 0x0230, 0x0018, 0xA800);
  1233. EXTERN_API( OSErr )
  1234. GetSoundHeaderOffset            (SndListHandle          sndHandle,
  1235.                                  long *                 offset)                             FOURWORDINLINE(0x203C, 0x0404, 0x0018, 0xA800);
  1236. EXTERN_API( UnsignedFixed )
  1237. UnsignedFixedMulDiv             (UnsignedFixed          value,
  1238.                                  UnsignedFixed          multiplier,
  1239.                                  UnsignedFixed          divisor)                            FOURWORDINLINE(0x203C, 0x060C, 0x0018, 0xA800);
  1240. EXTERN_API( OSErr )
  1241. GetCompressionInfo              (short                  compressionID,
  1242.                                  OSType                 format,
  1243.                                  short                  numChannels,
  1244.                                  short                  sampleSize,
  1245.                                  CompressionInfoPtr     cp)                                 FOURWORDINLINE(0x203C, 0x0710, 0x0018, 0xA800);
  1246. EXTERN_API( OSErr )
  1247. SetSoundPreference              (OSType                 theType,
  1248.                                  Str255                 name,
  1249.                                  Handle                 settings)                           FOURWORDINLINE(0x203C, 0x0634, 0x0018, 0xA800);
  1250. EXTERN_API( OSErr )
  1251. GetSoundPreference              (OSType                 theType,
  1252.                                  Str255                 name,
  1253.                                  Handle                 settings)                           FOURWORDINLINE(0x203C, 0x0638, 0x0018, 0xA800);
  1254. EXTERN_API( OSErr )
  1255. OpenMixerSoundComponent         (SoundComponentDataPtr  outputDescription,
  1256.                                  long                   outputFlags,
  1257.                                  ComponentInstance *    mixerComponent)                     FOURWORDINLINE(0x203C, 0x0614, 0x0018, 0xA800);
  1258. EXTERN_API( OSErr )
  1259. CloseMixerSoundComponent        (ComponentInstance      ci)                                 FOURWORDINLINE(0x203C, 0x0218, 0x0018, 0xA800);
  1260. /* Sound Manager 3.1 and later calls, uses _SoundDispatch */
  1261. EXTERN_API( OSErr )
  1262. SndGetInfo                      (SndChannelPtr          chan,
  1263.                                  OSType                 selector,
  1264.                                  void *                 infoPtr)                            FOURWORDINLINE(0x203C, 0x063C, 0x0018, 0xA800);
  1265. EXTERN_API( OSErr )
  1266. SndSetInfo                      (SndChannelPtr          chan,
  1267.                                  OSType                 selector,
  1268.                                  const void *           infoPtr)                            FOURWORDINLINE(0x203C, 0x0640, 0x0018, 0xA800);
  1269. EXTERN_API( OSErr )
  1270. GetSoundOutputInfo              (Component              outputDevice,
  1271.                                  OSType                 selector,
  1272.                                  void *                 infoPtr)                            FOURWORDINLINE(0x203C, 0x0644, 0x0018, 0xA800);
  1273. EXTERN_API( OSErr )
  1274. SetSoundOutputInfo              (Component              outputDevice,
  1275.                                  OSType                 selector,
  1276.                                  const void *           infoPtr)                            FOURWORDINLINE(0x203C, 0x0648, 0x0018, 0xA800);
  1277. /* Sound Manager 3.2 and later calls, uses _SoundDispatch */
  1278. EXTERN_API( OSErr )
  1279. GetCompressionName              (OSType                 compressionType,
  1280.                                  Str255                 compressionName)                    FOURWORDINLINE(0x203C, 0x044C, 0x0018, 0xA800);
  1281. EXTERN_API( OSErr )
  1282. SoundConverterOpen              (const SoundComponentData * inputFormat,
  1283.                                  const SoundComponentData * outputFormat,
  1284.                                  SoundConverter *       sc)                                 FOURWORDINLINE(0x203C, 0x0650, 0x0018, 0xA800);
  1285. EXTERN_API( OSErr )
  1286. SoundConverterClose             (SoundConverter         sc)                                 FOURWORDINLINE(0x203C, 0x0254, 0x0018, 0xA800);
  1287. EXTERN_API( OSErr )
  1288. SoundConverterGetBufferSizes    (SoundConverter         sc,
  1289.                                  unsigned long          inputBytesTarget,
  1290.                                  unsigned long *        inputFrames,
  1291.                                  unsigned long *        inputBytes,
  1292.                                  unsigned long *        outputBytes)                        FOURWORDINLINE(0x203C, 0x0A58, 0x0018, 0xA800);
  1293. EXTERN_API( OSErr )
  1294. SoundConverterBeginConversion   (SoundConverter         sc)                                 FOURWORDINLINE(0x203C, 0x025C, 0x0018, 0xA800);
  1295. EXTERN_API( OSErr )
  1296. SoundConverterConvertBuffer     (SoundConverter         sc,
  1297.                                  const void *           inputPtr,
  1298.                                  unsigned long          inputFrames,
  1299.                                  void *                 outputPtr,
  1300.                                  unsigned long *        outputFrames,
  1301.                                  unsigned long *        outputBytes)                        FOURWORDINLINE(0x203C, 0x0C60, 0x0018, 0xA800);
  1302. EXTERN_API( OSErr )
  1303. SoundConverterEndConversion     (SoundConverter         sc,
  1304.                                  void *                 outputPtr,
  1305.                                  unsigned long *        outputFrames,
  1306.                                  unsigned long *        outputBytes)                        FOURWORDINLINE(0x203C, 0x0864, 0x0018, 0xA800);
  1307. /* Sound Manager 3.3 and later calls, uses _SoundDispatch */
  1308. EXTERN_API( OSErr )
  1309. SoundConverterGetInfo           (SoundConverter         sc,
  1310.                                  OSType                 selector,
  1311.                                  void *                 infoPtr)                            FOURWORDINLINE(0x203C, 0x0668, 0x0018, 0xA800);
  1312. EXTERN_API( OSErr )
  1313. SoundConverterSetInfo           (SoundConverter         sc,
  1314.                                  OSType                 selector,
  1315.                                  void *                 infoPtr)                            FOURWORDINLINE(0x203C, 0x066C, 0x0018, 0xA800);
  1316. /* Sound Manager 3.6 and later calls, uses _SoundDispatch */
  1317. EXTERN_API( OSErr )
  1318. SoundConverterFillBuffer        (SoundConverter         sc,
  1319.                                  SoundConverterFillBufferDataUPP  fillBufferDataUPP,
  1320.                                  void *                 fillBufferDataRefCon,
  1321.                                  void *                 outputBuffer,
  1322.                                  unsigned long          outputBufferByteSize,
  1323.                                  unsigned long *        bytesWritten,
  1324.                                  unsigned long *        framesWritten,
  1325.                                  unsigned long *        outputFlags)                        FOURWORDINLINE(0x203C, 0x1078, 0x0018, 0xA800);
  1326. EXTERN_API( OSErr )
  1327. SoundManagerGetInfo             (OSType                 selector,
  1328.                                  void *                 infoPtr)                            FOURWORDINLINE(0x203C, 0x047C, 0x0018, 0xA800);
  1329. EXTERN_API( OSErr )
  1330. SoundManagerSetInfo             (OSType                 selector,
  1331.                                  const void *           infoPtr)                            FOURWORDINLINE(0x203C, 0x0480, 0x0018, 0xA800);
  1332. /*
  1333.   Sound Component Functions
  1334.    basic sound component functions
  1335. */
  1336. EXTERN_API( ComponentResult )
  1337. SoundComponentInitOutputDevice  (ComponentInstance      ti,
  1338.                                  long                   actions)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  1339. EXTERN_API( ComponentResult )
  1340. SoundComponentSetSource         (ComponentInstance      ti,
  1341.                                  SoundSource            sourceID,
  1342.                                  ComponentInstance      source)                             FIVEWORDINLINE(0x2F3C, 0x0008, 0x0002, 0x7000, 0xA82A);
  1343. EXTERN_API( ComponentResult )
  1344. SoundComponentGetSource         (ComponentInstance      ti,
  1345.                                  SoundSource            sourceID,
  1346.                                  ComponentInstance *    source)                             FIVEWORDINLINE(0x2F3C, 0x0008, 0x0003, 0x7000, 0xA82A);
  1347. EXTERN_API( ComponentResult )
  1348. SoundComponentGetSourceData     (ComponentInstance      ti,
  1349.                                  SoundComponentDataPtr * sourceData)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0004, 0x7000, 0xA82A);
  1350. EXTERN_API( ComponentResult )
  1351. SoundComponentSetOutput         (ComponentInstance      ti,
  1352.                                  SoundComponentDataPtr  requested,
  1353.                                  SoundComponentDataPtr * actual)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0005, 0x7000, 0xA82A);
  1354. /* junction methods for the mixer, must be called at non-interrupt level*/
  1355. EXTERN_API( ComponentResult )
  1356. SoundComponentAddSource         (ComponentInstance      ti,
  1357.                                  SoundSource *          sourceID)                           FIVEWORDINLINE(0x2F3C, 0x0004, 0x0101, 0x7000, 0xA82A);
  1358. EXTERN_API( ComponentResult )
  1359. SoundComponentRemoveSource      (ComponentInstance      ti,
  1360.                                  SoundSource            sourceID)                           FIVEWORDINLINE(0x2F3C, 0x0004, 0x0102, 0x7000, 0xA82A);
  1361. /* info methods*/
  1362. EXTERN_API( ComponentResult )
  1363. SoundComponentGetInfo           (ComponentInstance      ti,
  1364.                                  SoundSource            sourceID,
  1365.                                  OSType                 selector,
  1366.                                  void *                 infoPtr)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0103, 0x7000, 0xA82A);
  1367. EXTERN_API( ComponentResult )
  1368. SoundComponentSetInfo           (ComponentInstance      ti,
  1369.                                  SoundSource            sourceID,
  1370.                                  OSType                 selector,
  1371.                                  void *                 infoPtr)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0104, 0x7000, 0xA82A);
  1372. /* control methods*/
  1373. EXTERN_API( ComponentResult )
  1374. SoundComponentStartSource       (ComponentInstance      ti,
  1375.                                  short                  count,
  1376.                                  SoundSource *          sources)                            FIVEWORDINLINE(0x2F3C, 0x0006, 0x0105, 0x7000, 0xA82A);
  1377. EXTERN_API( ComponentResult )
  1378. SoundComponentStopSource        (ComponentInstance      ti,
  1379.                                  short                  count,
  1380.                                  SoundSource *          sources)                            FIVEWORDINLINE(0x2F3C, 0x0006, 0x0106, 0x7000, 0xA82A);
  1381. EXTERN_API( ComponentResult )
  1382. SoundComponentPauseSource       (ComponentInstance      ti,
  1383.                                  short                  count,
  1384.                                  SoundSource *          sources)                            FIVEWORDINLINE(0x2F3C, 0x0006, 0x0107, 0x7000, 0xA82A);
  1385. EXTERN_API( ComponentResult )
  1386. SoundComponentPlaySourceBuffer  (ComponentInstance      ti,
  1387.                                  SoundSource            sourceID,
  1388.                                  SoundParamBlockPtr     pb,
  1389.                                  long                   actions)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0108, 0x7000, 0xA82A);
  1390. /* selectors for component calls */
  1391. enum {
  1392.     kSoundComponentInitOutputDeviceSelect      = 0x0001,
  1393.     kSoundComponentSetSourceSelect             = 0x0002,
  1394.     kSoundComponentGetSourceSelect             = 0x0003,
  1395.     kSoundComponentGetSourceDataSelect         = 0x0004,
  1396.     kSoundComponentSetOutputSelect             = 0x0005,
  1397.     kSoundComponentAddSourceSelect             = 0x0101,
  1398.     kSoundComponentRemoveSourceSelect          = 0x0102,
  1399.     kSoundComponentGetInfoSelect               = 0x0103,
  1400.     kSoundComponentSetInfoSelect               = 0x0104,
  1401.     kSoundComponentStartSourceSelect           = 0x0105,
  1402.     kSoundComponentStopSourceSelect            = 0x0106,
  1403.     kSoundComponentPauseSourceSelect           = 0x0107,
  1404.     kSoundComponentPlaySourceBufferSelect      = 0x0108
  1405. };
  1406. /*Audio Components*/
  1407. /*Volume is described as a value between 0 and 1, with 0 indicating minimum
  1408.   volume and 1 indicating maximum volume; if the device doesn't support
  1409.   software control of volume, then a value of unimpErr is returned, indicating
  1410.   that these functions are not supported by the device
  1411. */
  1412. EXTERN_API( ComponentResult )
  1413. AudioGetVolume                  (ComponentInstance      ac,
  1414.                                  short                  whichChannel,
  1415.                                  ShortFixed *           volume)                             FIVEWORDINLINE(0x2F3C, 0x0006, 0x0000, 0x7000, 0xA82A);
  1416. EXTERN_API( ComponentResult )
  1417. AudioSetVolume                  (ComponentInstance      ac,
  1418.                                  short                  whichChannel,
  1419.                                  ShortFixed             volume)                             FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  1420. /*If the device doesn't support software control of mute, then a value of unimpErr is
  1421. returned, indicating that these functions are not supported by the device.*/
  1422. EXTERN_API( ComponentResult )
  1423. AudioGetMute                    (ComponentInstance      ac,
  1424.                                  short                  whichChannel,
  1425.                                  short *                mute)                               FIVEWORDINLINE(0x2F3C, 0x0006, 0x0002, 0x7000, 0xA82A);
  1426. EXTERN_API( ComponentResult )
  1427. AudioSetMute                    (ComponentInstance      ac,
  1428.                                  short                  whichChannel,
  1429.                                  short                  mute)                               FIVEWORDINLINE(0x2F3C, 0x0004, 0x0003, 0x7000, 0xA82A);
  1430. /*AudioSetToDefaults causes the associated device to reset its volume and mute values
  1431. (and perhaps other characteristics, e.g. attenuation) to "factory default" settings*/
  1432. EXTERN_API( ComponentResult )
  1433. AudioSetToDefaults              (ComponentInstance      ac)                                 FIVEWORDINLINE(0x2F3C, 0x0000, 0x0004, 0x7000, 0xA82A);
  1434. /*This routine is required; it must be implemented by all audio components*/
  1435. EXTERN_API( ComponentResult )
  1436. AudioGetInfo                    (ComponentInstance      ac,
  1437.                                  AudioInfoPtr           info)                               FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  1438. EXTERN_API( ComponentResult )
  1439. AudioGetBass                    (ComponentInstance      ac,
  1440.                                  short                  whichChannel,
  1441.                                  short *                bass)                               FIVEWORDINLINE(0x2F3C, 0x0006, 0x0006, 0x7000, 0xA82A);
  1442. EXTERN_API( ComponentResult )
  1443. AudioSetBass                    (ComponentInstance      ac,
  1444.                                  short                  whichChannel,
  1445.                                  short                  bass)                               FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  1446. EXTERN_API( ComponentResult )
  1447. AudioGetTreble                  (ComponentInstance      ac,
  1448.                                  short                  whichChannel,
  1449.                                  short *                Treble)                             FIVEWORDINLINE(0x2F3C, 0x0006, 0x0008, 0x7000, 0xA82A);
  1450. EXTERN_API( ComponentResult )
  1451. AudioSetTreble                  (ComponentInstance      ac,
  1452.                                  short                  whichChannel,
  1453.                                  short                  Treble)                             FIVEWORDINLINE(0x2F3C, 0x0004, 0x0009, 0x7000, 0xA82A);
  1454. EXTERN_API( ComponentResult )
  1455. AudioGetOutputDevice            (ComponentInstance      ac,
  1456.                                  Component *            outputDevice)                       FIVEWORDINLINE(0x2F3C, 0x0004, 0x000A, 0x7000, 0xA82A);
  1457. /*This is routine is private to the AudioVision component.  It enables the watching of the mute key.*/
  1458. EXTERN_API( ComponentResult )
  1459. AudioMuteOnEvent                (ComponentInstance      ac,
  1460.                                  short                  muteOnEvent)                        FIVEWORDINLINE(0x2F3C, 0x0002, 0x0081, 0x7000, 0xA82A);
  1461. /* selectors for component calls */
  1462. enum {
  1463.     kAudioGetVolumeSelect                      = 0x0000,
  1464.     kAudioSetVolumeSelect                      = 0x0001,
  1465.     kAudioGetMuteSelect                        = 0x0002,
  1466.     kAudioSetMuteSelect                        = 0x0003,
  1467.     kAudioSetToDefaultsSelect                  = 0x0004,
  1468.     kAudioGetInfoSelect                        = 0x0005,
  1469.     kAudioGetBassSelect                        = 0x0006,
  1470.     kAudioSetBassSelect                        = 0x0007,
  1471.     kAudioGetTrebleSelect                      = 0x0008,
  1472.     kAudioSetTrebleSelect                      = 0x0009,
  1473.     kAudioGetOutputDeviceSelect                = 0x000A,
  1474.     kAudioMuteOnEventSelect                    = 0x0081
  1475. };
  1476. enum {
  1477.     kDelegatedSoundComponentSelectors = 0x0100
  1478. };
  1479. /* Sound Input Manager routines, uses _SoundDispatch */
  1480. EXTERN_API( NumVersion )
  1481. SPBVersion                      (void)                                                      FOURWORDINLINE(0x203C, 0x0000, 0x0014, 0xA800);
  1482. EXTERN_API( OSErr )
  1483. SndRecord                       (ModalFilterUPP         filterProc,
  1484.                                  Point                  corner,
  1485.                                  OSType                 quality,
  1486.                                  SndListHandle *        sndHandle)                          FOURWORDINLINE(0x203C, 0x0804, 0x0014, 0xA800);
  1487. EXTERN_API( OSErr )
  1488. SndRecordToFile                 (ModalFilterUPP         filterProc,
  1489.                                  Point                  corner,
  1490.                                  OSType                 quality,
  1491.                                  short                  fRefNum)                            FOURWORDINLINE(0x203C, 0x0708, 0x0014, 0xA800);
  1492. EXTERN_API( OSErr )
  1493. SPBSignInDevice                 (short                  deviceRefNum,
  1494.                                  ConstStr255Param       deviceName)                         FOURWORDINLINE(0x203C, 0x030C, 0x0014, 0xA800);
  1495. EXTERN_API( OSErr )
  1496. SPBSignOutDevice                (short                  deviceRefNum)                       FOURWORDINLINE(0x203C, 0x0110, 0x0014, 0xA800);
  1497. EXTERN_API( OSErr )
  1498. SPBGetIndexedDevice             (short                  count,
  1499.                                  Str255                 deviceName,
  1500.                                  Handle *               deviceIconHandle)                   FOURWORDINLINE(0x203C, 0x0514, 0x0014, 0xA800);
  1501. EXTERN_API( OSErr )
  1502. SPBOpenDevice                   (ConstStr255Param       deviceName,
  1503.                                  short                  permission,
  1504.                                  long *                 inRefNum)                           FOURWORDINLINE(0x203C, 0x0518, 0x0014, 0xA800);
  1505. EXTERN_API( OSErr )
  1506. SPBCloseDevice                  (long                   inRefNum)                           FOURWORDINLINE(0x203C, 0x021C, 0x0014, 0xA800);
  1507. EXTERN_API( OSErr )
  1508. SPBRecord                       (SPBPtr                 inParamPtr,
  1509.                                  Boolean                asynchFlag)                         FOURWORDINLINE(0x203C, 0x0320, 0x0014, 0xA800);
  1510. EXTERN_API( OSErr )
  1511. SPBRecordToFile                 (short                  fRefNum,
  1512.                                  SPBPtr                 inParamPtr,
  1513.                                  Boolean                asynchFlag)                         FOURWORDINLINE(0x203C, 0x0424, 0x0014, 0xA800);
  1514. EXTERN_API( OSErr )
  1515. SPBPauseRecording               (long                   inRefNum)                           FOURWORDINLINE(0x203C, 0x0228, 0x0014, 0xA800);
  1516. EXTERN_API( OSErr )
  1517. SPBResumeRecording              (long                   inRefNum)                           FOURWORDINLINE(0x203C, 0x022C, 0x0014, 0xA800);
  1518. EXTERN_API( OSErr )
  1519. SPBStopRecording                (long                   inRefNum)                           FOURWORDINLINE(0x203C, 0x0230, 0x0014, 0xA800);
  1520. EXTERN_API( OSErr )
  1521. SPBGetRecordingStatus           (long                   inRefNum,
  1522.                                  short *                recordingStatus,
  1523.                                  short *                meterLevel,
  1524.                                  unsigned long *        totalSamplesToRecord,
  1525.                                  unsigned long *        numberOfSamplesRecorded,
  1526.                                  unsigned long *        totalMsecsToRecord,
  1527.                                  unsigned long *        numberOfMsecsRecorded)              FOURWORDINLINE(0x203C, 0x0E34, 0x0014, 0xA800);
  1528. EXTERN_API( OSErr )
  1529. SPBGetDeviceInfo                (long                   inRefNum,
  1530.                                  OSType                 infoType,
  1531.                                  void *                 infoData)                           FOURWORDINLINE(0x203C, 0x0638, 0x0014, 0xA800);
  1532. EXTERN_API( OSErr )
  1533. SPBSetDeviceInfo                (long                   inRefNum,
  1534.                                  OSType                 infoType,
  1535.                                  void *                 infoData)                           FOURWORDINLINE(0x203C, 0x063C, 0x0014, 0xA800);
  1536. EXTERN_API( OSErr )
  1537. SPBMillisecondsToBytes          (long                   inRefNum,
  1538.                                  long *                 milliseconds)                       FOURWORDINLINE(0x203C, 0x0440, 0x0014, 0xA800);
  1539. EXTERN_API( OSErr )
  1540. SPBBytesToMilliseconds          (long                   inRefNum,
  1541.                                  long *                 byteCount)                          FOURWORDINLINE(0x203C, 0x0444, 0x0014, 0xA800);
  1542. EXTERN_API( OSErr )
  1543. SetupSndHeader                  (SndListHandle          sndHandle,
  1544.                                  short                  numChannels,
  1545.                                  UnsignedFixed          sampleRate,
  1546.                                  short                  sampleSize,
  1547.                                  OSType                 compressionType,
  1548.                                  short                  baseNote,
  1549.                                  unsigned long          numBytes,
  1550.                                  short *                headerLen)                          FOURWORDINLINE(0x203C, 0x0D48, 0x0014, 0xA800);
  1551. EXTERN_API( OSErr )
  1552. SetupAIFFHeader                 (short                  fRefNum,
  1553.                                  short                  numChannels,
  1554.                                  UnsignedFixed          sampleRate,
  1555.                                  short                  sampleSize,
  1556.                                  OSType                 compressionType,
  1557.                                  unsigned long          numBytes,
  1558.                                  unsigned long          numFrames)                          FOURWORDINLINE(0x203C, 0x0B4C, 0x0014, 0xA800);
  1559. /* Sound Input Manager 1.1 and later calls, uses _SoundDispatch */
  1560. EXTERN_API( OSErr )
  1561. ParseAIFFHeader                 (short                  fRefNum,
  1562.                                  SoundComponentData *   sndInfo,
  1563.                                  unsigned long *        numFrames,
  1564.                                  unsigned long *        dataOffset)                         FOURWORDINLINE(0x203C, 0x0758, 0x0014, 0xA800);
  1565. EXTERN_API( OSErr )
  1566. ParseSndHeader                  (SndListHandle          sndHandle,
  1567.                                  SoundComponentData *   sndInfo,
  1568.                                  unsigned long *        numFrames,
  1569.                                  unsigned long *        dataOffset)                         FOURWORDINLINE(0x203C, 0x085C, 0x0014, 0xA800);
  1570. #if !TARGET_OS_MAC || TARGET_API_MAC_CARBON
  1571. /*  Only to be used if you are writing a sound input component; this */
  1572. /*  is the param block for a read request from the SoundMgr to the   */
  1573. /*  sound input component.  Not to be confused with the SPB struct   */
  1574. /*  above, which is the param block for a read request from an app   */
  1575. /*  to the SoundMgr.                                                 */
  1576. typedef struct SndInputCmpParam         SndInputCmpParam;
  1577. typedef SndInputCmpParam *              SndInputCmpParamPtr;
  1578. typedef CALLBACK_API( void , SICCompletionProcPtr )(SndInputCmpParamPtr SICParmPtr);
  1579. struct SndInputCmpParam {
  1580.     SICCompletionProcPtr            ioCompletion;               /* completion routine [pointer]*/
  1581.     SIInterruptProcPtr              ioInterrupt;                /* interrupt routine [pointer]*/
  1582.     OSErr                           ioResult;                   /* I/O result code [word]*/
  1583.     short                           pad;
  1584.     unsigned long                   ioReqCount;
  1585.     unsigned long                   ioActCount;
  1586.     Ptr                             ioBuffer;
  1587.     Ptr                             ioMisc;
  1588. };
  1589. EXTERN_API( ComponentResult )
  1590. SndInputReadAsync               (ComponentInstance      self,
  1591.                                  SndInputCmpParamPtr    SICParmPtr)                         FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  1592. EXTERN_API( ComponentResult )
  1593. SndInputReadSync                (ComponentInstance      self,
  1594.                                  SndInputCmpParamPtr    SICParmPtr)                         FIVEWORDINLINE(0x2F3C, 0x0004, 0x0002, 0x7000, 0xA82A);
  1595. EXTERN_API( ComponentResult )
  1596. SndInputPauseRecording          (ComponentInstance      self)                               FIVEWORDINLINE(0x2F3C, 0x0000, 0x0003, 0x7000, 0xA82A);
  1597. EXTERN_API( ComponentResult )
  1598. SndInputResumeRecording         (ComponentInstance      self)                               FIVEWORDINLINE(0x2F3C, 0x0000, 0x0004, 0x7000, 0xA82A);
  1599. EXTERN_API( ComponentResult )
  1600. SndInputStopRecording           (ComponentInstance      self)                               FIVEWORDINLINE(0x2F3C, 0x0000, 0x0005, 0x7000, 0xA82A);
  1601. EXTERN_API( ComponentResult )
  1602. SndInputGetStatus               (ComponentInstance      self,
  1603.                                  short *                recordingStatus,
  1604.                                  unsigned long *        totalSamplesToRecord,
  1605.                                  unsigned long *        numberOfSamplesRecorded)            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0006, 0x7000, 0xA82A);
  1606. EXTERN_API( ComponentResult )
  1607. SndInputGetDeviceInfo           (ComponentInstance      self,
  1608.                                  OSType                 infoType,
  1609.                                  void *                 infoData)                           FIVEWORDINLINE(0x2F3C, 0x0008, 0x0007, 0x7000, 0xA82A);
  1610. EXTERN_API( ComponentResult )
  1611. SndInputSetDeviceInfo           (ComponentInstance      self,
  1612.                                  OSType                 infoType,
  1613.                                  void *                 infoData)                           FIVEWORDINLINE(0x2F3C, 0x0008, 0x0008, 0x7000, 0xA82A);
  1614. EXTERN_API( ComponentResult )
  1615. SndInputInitHardware            (ComponentInstance      self)                               FIVEWORDINLINE(0x2F3C, 0x0000, 0x0009, 0x7000, 0xA82A);
  1616. /* selectors for component calls */
  1617. enum {
  1618.     kSndInputReadAsyncSelect                   = 0x0001,
  1619.     kSndInputReadSyncSelect                    = 0x0002,
  1620.     kSndInputPauseRecordingSelect              = 0x0003,
  1621.     kSndInputResumeRecordingSelect             = 0x0004,
  1622.     kSndInputStopRecordingSelect               = 0x0005,
  1623.     kSndInputGetStatusSelect                   = 0x0006,
  1624.     kSndInputGetDeviceInfoSelect               = 0x0007,
  1625.     kSndInputSetDeviceInfoSelect               = 0x0008,
  1626.     kSndInputInitHardwareSelect                = 0x0009
  1627. };
  1628. #endif  /* !TARGET_OS_MAC || TARGET_API_MAC_CARBON */
  1629. #if PRAGMA_STRUCT_ALIGN
  1630.     #pragma options align=reset
  1631. #elif PRAGMA_STRUCT_PACKPUSH
  1632.     #pragma pack(pop)
  1633. #elif PRAGMA_STRUCT_PACK
  1634.     #pragma pack()
  1635. #endif
  1636. #ifdef PRAGMA_IMPORT_OFF
  1637. #pragma import off
  1638. #elif PRAGMA_IMPORT
  1639. #pragma import reset
  1640. #endif
  1641. #ifdef __cplusplus
  1642. }
  1643. #endif
  1644. #endif /* __SOUND__ */