home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.0
/
NeXTSTEP3.0.iso
/
NextDeveloper
/
Headers
/
soundkit
/
NXSoundDevice.h
< prev
next >
Wrap
Text File
|
1992-04-27
|
3KB
|
131 lines
/*
* NXSoundDevice.h
*
* Abstract superclass for sound devices.
*
* Copyright (c) 1991, NeXT Computer, Inc. All rights reserved.
*/
#import <objc/Object.h>
#import <mach/cthreads.h>
#import <mach/mach.h>
#import <limits.h>
/*
* Default message timeout.
*/
#define NX_SOUNDDEVICE_TIMEOUT_MAX UINT_MAX;
/*
* Error codes for devices.
*/
#define NX_SOUNDDEVICE_ERROR_MIN 300
#define NX_SOUNDDEVICE_ERROR_MAX 399
typedef enum _NXSoundDeviceError {
NX_SoundDeviceErrorNone = 0,
NX_SoundDeviceErrorKernel = NX_SOUNDDEVICE_ERROR_MIN,
NX_SoundDeviceErrorTimeout,
NX_SoundDeviceErrorLookUp,
NX_SoundDeviceErrorHost,
NX_SoundDeviceErrorNoDevice,
NX_SoundDeviceErrorNotActive,
NX_SoundDeviceErrorTag,
NX_SoundDeviceErrorMax = NX_SOUNDDEVICE_ERROR_MAX
} NXSoundDeviceError;
/*
* Convert dB to linear, and linear to dB.
4Q extern float SNDConvertDecibelsToLinear(float dB);
extern float SNDConvertLinearToDecibels(float linear);
@interface NXSoundDevice:Object
{
const char *_host;
port_t _devicePort;
port_t _streamOwnerPort;
unsigned int _bufferSize;
unsigned int _bufferCount;
unsigned int _isDetectingPeaks;
unsigned int _peakHistory;
kern_return_t _kernelError;
NXSoundDeviceError _lastError;
int _reserved;
}
/*
* Factory methods.
*/
+ (const char *)textForError:(NXSoundDeviceError)errorCode;
+ (unsigned int)timeout;
+ setTimeout:(unsigned int)milliseconds;
+ (port_t)replyPort;
+ (BOOL)isUsingSeparateThread;
+ setUseSeparateThread:(BOOL)flag;
+ (cthread_t)replyThread;
+ (int)threadThreshold;
+ setThreadThreshold:(int)threshold;
/*
* Initialize on local or remote host.
* Returns nil if sound resources cannot be accessed.
*/
- init;
- initOnHost:(const char *)hostName;
/*
* Get host name.
*/
- (const char *)host;
/*
* Get ports.
*/
- (port_t)devicePort;
- (port_t)streamOwnerPort;
/*
* Reserve for exclusive use.
* Default is NO.
*/
- (BOOL)isReserved;
- (NXSoundDeviceError)setReserved:(BOOL)flag;
/*
* Get and set buffer options.
*/
- (unsigned int)bufferSize;
- (NXSoundDeviceError)setBufferSize:(unsigned int)bytes;
- (unsigned int)bufferCount;
- (NXSoundDeviceError)setBufferCount:(unsigned int)count;
/*
* Synchronized stream control.
*/
- pauseStreams:sender;
- resumeStreams:sender;
- abortStreams:sender;
/*
* Peak detection.
* Default is NO peak detection.
*/
- (BOOL)isDetectingPeaks;
- (NXSoundDeviceError)setDetectPeaks:(BOOL)flag;
- (unsigned int)peakHistory;
- (NXSoundDeviceError)setPeakHistory:(unsigned int)bufferCount;
- (NXSoundDeviceError)getPeakLeft:(float *)leftAmp
right:(float *)rightAmp;
/*
* Error handling.
*/
- (NXSoundDeviceError)lastError;
/*
* Release resources and free object.
*/
- free;
@end