home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Beta / Quicktime 2.0 Beta.iso / Programming Stuff / Interfaces / Universal Interfaces / SoundInput.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-30  |  8.3 KB  |  264 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        SoundInput.h
  3.  
  4.     Copyright:    © 1984-1993 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef __SOUNDINPUT__
  13. #define __SOUNDINPUT__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. /*    #include <ConditionalMacros.h>                                */
  18. /*    #include <MixedMode.h>                                        */
  19. /*        #include <Traps.h>                                        */
  20. #endif
  21.  
  22. #ifndef __DIALOGS__
  23. #include <Dialogs.h>
  24. /*    #include <Windows.h>                                        */
  25. /*        #include <Quickdraw.h>                                    */
  26. /*            #include <QuickdrawText.h>                            */
  27. /*                #include <IntlResources.h>                        */
  28. /*        #include <Events.h>                                        */
  29. /*            #include <OSUtils.h>                                */
  30. /*        #include <Controls.h>                                    */
  31. /*            #include <Menus.h>                                    */
  32. /*    #include <TextEdit.h>                                        */
  33. #endif
  34.  
  35. #ifndef __FILES__
  36. #include <Files.h>
  37. /*    #include <SegLoad.h>                                        */
  38. #endif
  39.  
  40. enum  {
  41.     siDeviceIsConnected            = 1,                            /* input device is connected and ready for input */
  42.     siDeviceNotConnected        = 0,                            /* input device is not connected */
  43.     siDontKnowIfConnected        = -1,                            /* can't tell if input device is connected */
  44.     siReadPermission            = 0,                            /* permission passed to SPBOpenDevice */
  45.     siWritePermission            = 1                                /* permission passed to SPBOpenDevice */
  46. };
  47.  
  48.  
  49. /* Info Selectors for Sound Input Drivers */
  50.  
  51. #define siDeviceConnected 'dcon'
  52.  
  53. #define siAGCOnOff 'agc '
  54.  
  55. #define siPlayThruOnOff 'plth'
  56.  
  57. #define siTwosComplementOnOff 'twos'
  58.  
  59. #define siLevelMeterOnOff 'lmet'
  60.  
  61. #define siRecordingQuality 'qual'
  62.  
  63. #define siVoxRecordInfo 'voxr'
  64.  
  65. #define siVoxStopInfo 'voxs'
  66.  
  67. #define siNumberChannels 'chan'
  68.  
  69. #define siSampleSize 'ssiz'
  70.  
  71. #define siSampleRate 'srat'
  72.  
  73. #define siCompressionType 'comp'
  74.  
  75. #define siCompressionFactor 'cmfa'
  76.  
  77. #define siCompressionHeader 'cmhd'
  78.  
  79. #define siDeviceName 'name'
  80.  
  81. #define siDeviceIcon 'icon'
  82.  
  83. #define siDeviceBufferInfo 'dbin'
  84.  
  85. #define siSampleSizeAvailable 'ssav'
  86.  
  87. #define siSampleRateAvailable 'srav'
  88.  
  89. #define siCompressionAvailable 'cmav'
  90.  
  91. #define siChannelAvailable 'chav'
  92.  
  93. #define siAsync 'asyn'
  94.  
  95. #define siOptionsDialog 'optd'
  96.  
  97. #define siContinuous 'cont'
  98.  
  99. #define siActiveChannels 'chac'
  100.  
  101. #define siActiveLevels 'lmac'
  102.  
  103. #define siInputSource 'sour'
  104.  
  105. #define siInitializeDriver 'init'
  106.  
  107. #define siCloseDriver 'clos'
  108.  
  109. #define siPauseRecording 'paus'
  110.  
  111. #define siUserInterruptProc 'user'
  112.  
  113.  
  114. /* Qualities */
  115.  
  116. #define siBestQuality 'best'
  117.  
  118. #define siBetterQuality 'betr'
  119.  
  120. #define siGoodQuality 'good'
  121.  
  122. typedef struct SPB SPB, *SPBPtr;
  123.  
  124.  
  125. /* user procedures called by sound input routines */
  126.  
  127.  
  128. /*
  129.     SIInterruptProcs cannot be written in or called from a high-level 
  130.     language without the help of mixed mode or assembly glue because they 
  131.     use the following parameter-passing convention:
  132.  
  133.         typedef pascal void (*SIInterruptProcPtr)(SPBPtr inParamPtr, Ptr dataBuffer,
  134.              short peakAmplitude, long sampleSize);
  135.  
  136.         In:
  137.             =>     inParamPtr                A0.L
  138.             =>     dataBuffer                A1.L
  139.             =>     peakAmplitude            D0.W
  140.             =>     sampleSize                D1.L
  141.         Out:
  142.             none
  143. */
  144.  
  145. enum  {
  146.     uppSIInterruptProcInfo        = kRegisterBased|REGISTER_ROUTINE_PARAMETER(1,kRegisterA0,kFourByteCode)|REGISTER_ROUTINE_PARAMETER(2,kRegisterA1,kFourByteCode)|REGISTER_ROUTINE_PARAMETER(3,kRegisterD0,kTwoByteCode)|REGISTER_ROUTINE_PARAMETER(4,kRegisterD1,kFourByteCode)
  147. };
  148.  
  149. #if USESROUTINEDESCRIPTORS
  150. typedef pascal void (*SIInterruptProcPtr)(SPBPtr inParamPtr, Ptr dataBuffer, short peakAmplitude, long sampleSize);
  151.  
  152. typedef UniversalProcPtr SIInterruptUPP;
  153.  
  154. #define CallSIInterruptProc(userRoutine, inParamPtr, dataBuffer, peakAmplitude, sampleSize)  \
  155.     CallUniversalProc((UniversalProcPtr)(userRoutine), uppSIInterruptProcInfo, (inParamPtr),  \
  156.     (dataBuffer), (peakAmplitude), (sampleSize))
  157.  
  158. #define NewSIInterruptProc(userRoutine)  \
  159.     (SIInterruptUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIInterruptProcInfo, GetCurrentISA())
  160.  
  161. #else
  162. typedef ProcPtr SIInterruptUPP;
  163.  
  164. #define NewSIInterruptProc(userRoutine)  \
  165.     (SIInterruptUPP)(userRoutine)
  166.  
  167. #endif
  168.  
  169. typedef pascal void (*SICompletionProcPtr)(SPBPtr inParamPtr);
  170.  
  171. enum {
  172.     uppSICompletionProcInfo = kPascalStackBased
  173.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SPBPtr)))
  174. };
  175.  
  176. #if USESROUTINEDESCRIPTORS
  177. typedef UniversalProcPtr SICompletionUPP;
  178.  
  179. #define CallSICompletionProc(userRoutine, inParamPtr)        \
  180.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSICompletionProcInfo, (inParamPtr))
  181. #define NewSICompletionProc(userRoutine)        \
  182.         (SICompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSICompletionProcInfo, GetCurrentISA())
  183. #else
  184. typedef SICompletionProcPtr SICompletionUPP;
  185.  
  186. #define CallSICompletionProc(userRoutine, inParamPtr)        \
  187.         (*(userRoutine))((inParamPtr))
  188. #define NewSICompletionProc(userRoutine)        \
  189.         (SICompletionUPP)(userRoutine)
  190. #endif
  191.  
  192.  
  193. /* Sound Input Parameter Block */
  194.  
  195. #if defined(powerc) || defined (__powerc)
  196. #pragma options align=mac68k
  197. #endif
  198. struct SPB {
  199.     long                        inRefNum;                        /* reference number of sound input device */
  200.     unsigned long                count;                            /* number of bytes to record */
  201.     unsigned long                milliseconds;                    /* number of milliseconds to record */
  202.     unsigned long                bufferLength;                    /* length of buffer in bytes */
  203.     Ptr                            bufferPtr;                        /* buffer to store sound data in */
  204.     SICompletionUPP                completionRoutine;                /* completion routine */
  205.     SIInterruptUPP                interruptRoutine;                /* interrupt routine */
  206.     long                        userLong;                        /* user-defined field */
  207.     OSErr                        error;                            /* error */
  208.     long                        unused1;                        /* reserved - must be zero */
  209. };
  210. #if defined(powerc) || defined(__powerc)
  211. #pragma options align=reset
  212. #endif
  213.  
  214. #ifdef __cplusplus
  215. extern "C" {
  216. #endif
  217.  
  218. extern pascal NumVersion SPBVersion(void)
  219.  FOURWORDINLINE(0x203C, 0x0000, 0x0014, 0xA800);
  220. extern pascal OSErr SndRecord(ModalFilterUPP filterProc, Point corner, OSType quality, Handle *sndHandle)
  221.  FOURWORDINLINE(0x203C, 0x0804, 0x0014, 0xA800);
  222. extern pascal OSErr SndRecordToFile(ModalFilterUPP filterProc, Point corner, OSType quality, short fRefNum)
  223.  FOURWORDINLINE(0x203C, 0x0708, 0x0014, 0xA800);
  224. extern pascal OSErr SPBSignInDevice(short deviceRefNum, ConstStr255Param deviceName)
  225.  FOURWORDINLINE(0x203C, 0x030C, 0x0014, 0xA800);
  226. extern pascal OSErr SPBSignOutDevice(short deviceRefNum)
  227.  FOURWORDINLINE(0x203C, 0x0110, 0x0014, 0xA800);
  228. extern pascal OSErr SPBGetIndexedDevice(short count, Str255 deviceName, Handle *deviceIconHandle)
  229.  FOURWORDINLINE(0x203C, 0x0514, 0x0014, 0xA800);
  230. extern pascal OSErr SPBOpenDevice(ConstStr255Param deviceName, short permission, long *inRefNum)
  231.  FOURWORDINLINE(0x203C, 0x0518, 0x0014, 0xA800);
  232. extern pascal OSErr SPBCloseDevice(long inRefNum)
  233.  FOURWORDINLINE(0x203C, 0x021C, 0x0014, 0xA800);
  234. extern pascal OSErr SPBRecord(SPBPtr inParamPtr, Boolean asynchFlag)
  235.  FOURWORDINLINE(0x203C, 0x0320, 0x0014, 0xA800);
  236. extern pascal OSErr SPBRecordToFile(short fRefNum, SPBPtr inParamPtr, Boolean asynchFlag)
  237.  FOURWORDINLINE(0x203C, 0x0424, 0x0014, 0xA800);
  238. extern pascal OSErr SPBPauseRecording(long inRefNum)
  239.  FOURWORDINLINE(0x203C, 0x0228, 0x0014, 0xA800);
  240. extern pascal OSErr SPBResumeRecording(long inRefNum)
  241.  FOURWORDINLINE(0x203C, 0x022C, 0x0014, 0xA800);
  242. extern pascal OSErr SPBStopRecording(long inRefNum)
  243.  FOURWORDINLINE(0x203C, 0x0230, 0x0014, 0xA800);
  244. extern pascal OSErr SPBGetRecordingStatus(long inRefNum, short *recordingStatus, short *meterLevel, unsigned long *totalSamplesToRecord, unsigned long *numberOfSamplesRecorded, unsigned long *totalMsecsToRecord, unsigned long *numberOfMsecsRecorded)
  245.  FOURWORDINLINE(0x203C, 0x0E34, 0x0014, 0xA800);
  246. extern pascal OSErr SPBGetDeviceInfo(long inRefNum, OSType infoType, char *infoData)
  247.  FOURWORDINLINE(0x203C, 0x0638, 0x0014, 0xA800);
  248. extern pascal OSErr SPBSetDeviceInfo(long inRefNum, OSType infoType, char *infoData)
  249.  FOURWORDINLINE(0x203C, 0x063C, 0x0014, 0xA800);
  250. extern pascal OSErr SPBMillisecondsToBytes(long inRefNum, long *milliseconds)
  251.  FOURWORDINLINE(0x203C, 0x0440, 0x0014, 0xA800);
  252. extern pascal OSErr SPBBytesToMilliseconds(long inRefNum, long *byteCount)
  253.  FOURWORDINLINE(0x203C, 0x0444, 0x0014, 0xA800);
  254. extern pascal OSErr SetupSndHeader(Handle sndHandle, short numChannels, Fixed sampleRate, short sampleSize, OSType compressionType, short baseNote, unsigned long numBytes, short *headerLen)
  255.  FOURWORDINLINE(0x203C, 0x0D48, 0x0014, 0xA800);
  256. extern pascal OSErr SetupAIFFHeader(short fRefNum, short numChannels, Fixed sampleRate, short sampleSize, OSType compressionType, unsigned long numBytes, unsigned long numFrames)
  257.  FOURWORDINLINE(0x203C, 0x0B4C, 0x0014, 0xA800);
  258. #ifdef __cplusplus
  259. }
  260. #endif
  261.  
  262. #endif
  263.  
  264.