home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / soundkit / NXSoundDevice.h < prev    next >
Text File  |  1993-02-26  |  3KB  |  98 lines

  1. /*
  2.  * NXSoundDevice.h
  3.  *
  4.  * Copyright (c) 1992, NeXT Computer, Inc.  All rights reserved. 
  5.  */
  6.  
  7. #import <objc/Object.h>
  8. #import <mach/cthreads.h>
  9. #import <mach/mach.h>
  10. #import <limits.h>
  11. #import "NXSoundParameters.h"
  12.  
  13. #define NX_SOUNDDEVICE_TIMEOUT_MAX    UINT_MAX
  14. #define NX_SOUNDDEVICE_ERROR_MIN    300
  15. #define NX_SOUNDDEVICE_ERROR_MAX    399
  16.  
  17. typedef enum _NXSoundDeviceError {
  18.     NX_SoundDeviceErrorNone = 0,
  19.     NX_SoundDeviceErrorKernel = NX_SOUNDDEVICE_ERROR_MIN,
  20.     NX_SoundDeviceErrorTimeout,
  21.     NX_SoundDeviceErrorLookUp,
  22.     NX_SoundDeviceErrorHost,
  23.     NX_SoundDeviceErrorNoDevice,
  24.     NX_SoundDeviceErrorNotActive,
  25.     NX_SoundDeviceErrorTag,
  26.     NX_SoundDeviceErrorParameter,
  27.     NX_SoundDeviceErrorMax = NX_SOUNDDEVICE_ERROR_MAX
  28. } NXSoundDeviceError;
  29.  
  30. extern float SNDConvertDecibelsToLinear(float dB);
  31. extern float SNDConvertLinearToDecibels(float linear);
  32.  
  33. @interface NXSoundDevice:Object <NXSoundParameters>
  34. {
  35.     const char        *_host;
  36.     port_t        _devicePort;
  37.     port_t        _streamOwnerPort;
  38.     unsigned int    _bufferSize;
  39.     unsigned int    _bufferCount;
  40.     unsigned int    _isDetectingPeaks;
  41.     unsigned int    _peakHistory;
  42.     kern_return_t    _kernelError;
  43.     NXSoundDeviceError    _lastError;
  44.     int            _reserved;
  45. }
  46.  
  47. + (const char *)textForError:(NXSoundDeviceError)errorCode;
  48. + (unsigned int)timeout;
  49. + setTimeout:(unsigned int)milliseconds;
  50. + (port_t)replyPort;
  51. + (BOOL)isUsingSeparateThread;
  52. + setUseSeparateThread:(BOOL)flag;
  53. + (cthread_t)replyThread;
  54. + (int)threadThreshold;
  55. + setThreadThreshold:(int)threshold;
  56.  
  57. // New in 3.1.
  58. - (id <NXSoundParameters>)parameters;
  59. - (NXSoundDeviceError)setParameters:(id <NXSoundParameters>)params;
  60. - (BOOL)acceptsContinuousStreamSamplingRates;
  61. - (NXSoundDeviceError)getStreamSamplingRatesLow:(float *)lowRate
  62.     high:(float *)highRate;
  63. - (NXSoundDeviceError)getStreamSamplingRates:(const float **)rates
  64.     count:(unsigned int *)numRates;
  65. - (NXSoundDeviceError)getStreamDataEncodings:
  66.     (const NXSoundParameterTag **)encodings
  67.     count:(unsigned int *)numEncodings;
  68. - (unsigned int)streamChannelCountLimit;
  69. - (unsigned int)clipCount;
  70. - (const char *)name;
  71.  
  72. - init;
  73. - initOnHost:(const char *)hostName;
  74. - (const char *)host;
  75. - (port_t)devicePort;
  76. - (port_t)streamOwnerPort;
  77. - (BOOL)isReserved;
  78. - (NXSoundDeviceError)setReserved:(BOOL)flag;
  79. - pauseStreams:sender;
  80. - resumeStreams:sender;
  81. - abortStreams:sender;
  82. - (NXSoundDeviceError)getPeakLeft:(float *)leftAmp
  83.                             right:(float *)rightAmp;
  84. - (NXSoundDeviceError)lastError;
  85. - free;
  86.  
  87. // Obsolete - use generic parameter api.
  88. - (unsigned int)bufferSize;
  89. - (NXSoundDeviceError)setBufferSize:(unsigned int)bytes;
  90. - (unsigned int)bufferCount;
  91. - (NXSoundDeviceError)setBufferCount:(unsigned int)count;
  92. - (unsigned int)peakHistory;
  93. - (NXSoundDeviceError)setPeakHistory:(unsigned int)bufferCount;
  94. - (BOOL)isDetectingPeaks;
  95. - (NXSoundDeviceError)setDetectPeaks:(BOOL)flag;
  96.  
  97. @end
  98.