home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextLibrary / Frameworks / SoundKit.framework / Versions / A / Headers / NXSoundDevice.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-13  |  2.9 KB  |  97 lines

  1. /*
  2.  * NXSoundDevice.h
  3.  *
  4.  * Copyright (c) 1992, NeXT Computer, Inc.  All rights reserved. 
  5.  */
  6.  
  7. #import <Foundation/Foundation.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 : NSObject <NXSoundParameters>
  34. {
  35.     NSString *_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. + (NSString *)textForError:(NXSoundDeviceError)errorCode;
  47. + (unsigned int)timeout;
  48. + setTimeout:(unsigned int)milliseconds;
  49. + (port_t)replyPort;
  50. + (BOOL)isUsingSeparateThread;
  51. + setUseSeparateThread:(BOOL)flag;
  52. + (cthread_t)replyThread;
  53. + (int)threadThreshold;
  54. + setThreadThreshold:(int)threshold;
  55.  
  56. // New in 3.1.
  57. - (id <NXSoundParameters>)parameters;
  58. - (NXSoundDeviceError)setParameters:(id <NXSoundParameters>)params;
  59. - (BOOL)acceptsContinuousStreamSamplingRates;
  60. - (NXSoundDeviceError)getStreamSamplingRatesLow:(float *)lowRate
  61.     high:(float *)highRate;
  62. - (NXSoundDeviceError)getStreamSamplingRates:(const float **)rates
  63.     count:(unsigned int *)numRates;
  64. - (NXSoundDeviceError)getStreamDataEncodings:
  65.     (const NXSoundParameterTag **)encodings
  66.     count:(unsigned int *)numEncodings;
  67. - (unsigned int)streamChannelCountLimit;
  68. - (unsigned int)clipCount;
  69. - (NSString *)name;
  70.  
  71. - (id)init;
  72. - (id)initOnHost:(NSString *)hostName;
  73. - (NSString *)host;
  74. - (port_t)devicePort;
  75. - (port_t)streamOwnerPort;
  76. - (BOOL)isReserved;
  77. - (NXSoundDeviceError)setReserved:(BOOL)flag;
  78. - (void)pauseStreams:sender;
  79. - (void)resumeStreams:sender;
  80. - (void)abortStreams:sender;
  81. - (NXSoundDeviceError)getPeakLeft:(float *)leftAmp
  82.                             right:(float *)rightAmp;
  83. - (NXSoundDeviceError)lastError;
  84. - (void)dealloc;
  85.  
  86. // Obsolete - use generic parameter api.
  87. - (unsigned int)bufferSize;
  88. - (NXSoundDeviceError)setBufferSize:(unsigned int)bytes;
  89. - (unsigned int)bufferCount;
  90. - (NXSoundDeviceError)setBufferCount:(unsigned int)count;
  91. - (unsigned int)peakHistory;
  92. - (NXSoundDeviceError)setPeakHistory:(unsigned int)bufferCount;
  93. - (BOOL)isDetectingPeaks;
  94. - (NXSoundDeviceError)setDetectPeaks:(BOOL)flag;
  95.  
  96. @end
  97.