home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.0
/
NeXTSTEP3.0.iso
/
NextDeveloper
/
Headers
/
soundkit
/
Sound.h
< prev
next >
Wrap
Text File
|
1992-02-09
|
5KB
|
177 lines
/*
Sound.h
Sound Kit, Release 2.0
Copyright (c) 1988, 1989, 1990, NeXT, Inc. All rights reserved.
*/
#import <objc/Object.h>
#import <objc/hashtable.h>
#import <objc/NXBundle.h>
#import <streams/streams.h>
#import <sound/sound.h>
@class Pasteboard;
/* Define this for compatibility */
#define NXSoundPboard NXSoundPboardType
extern NXAtom NXSoundPboardType;
/*
* This is the sound pasteboard type.
*/
@interface Sound : Object
/*
* The Sound object encapsulates a SNDSoundStruct, which represents a sound.
* It supports reading and writing to a soundfile, playback of sound,
* recording of sampled sound, conversion among various sampled formats,
* basic editing of the sound, and name and storage management for sounds.
*/
{
SNDSoundStruct *soundStruct; /* the sound data structure */
int soundStructSize; /* the length of the structure in bytes */
int priority; /* the priority of the sound */
id delegate; /* the target of notification messages */
int status; /* what the object is currently doing */
char *name; /* The name of the sound */
SNDSoundStruct *_scratchSound;
int _scratchSize;
}
/*
* Status codes
*/
typedef enum {
NX_SoundStopped = 0,
NX_SoundRecording,
NX_SoundPlaying,
NX_SoundInitialized,
NX_SoundRecordingPaused,
NX_SoundPlayingPaused,
NX_SoundRecordingPending,
NX_Sound4QingPending,
NX_SoundFreed = -1,
} NXSoundStatus;
/*
* OBSOLETE status codes - use the NX ones above.
*/
typedef enum {
SK_STATUS_STOPPED = NX_SoundStopped,
SK_STATUS_RECORDING = NX_SoundRecording,
SK_STATUS_PLAYING = NX_SoundPlaying,
SK_STATUS_INITIALIZED = NX_SoundInitialized,
SK_STATUS_RECORDING_PAUSED = NX_SoundRecordingPaused,
SK_STATUS_PLAYING_PAUSED = NX_SoundPlayingPaused,
SK_STATUS_RECORDING_PENDING = NX_SoundRecordingPending,
SK_STATUS_PLAYING_PENDING = NX_SoundPlayingPending,
SK_STATUS_FREED = NX_SoundFreed,
} SKStatus;
/*
* Macho segment name where sounds may be.
*/
#define NX_SOUND_SEGMENT_NAME "__SND"
/*
* OBSOLETE macho segment name - use the NX one above.
*/
#define SK_SEGMENT_NAME "__SND"
/*
* --------------- Factory Methods
*/
+ findSoundFor:(const char *)aName;
+ addName:(const char *)name sound:aSound;
+ addName:(const char *)name fromSoundfile:(const char *)filename;
+ addName:(const char *)name fromSection:(const char *)sectionName;
+ addName:(const char *)aName fromBundle:(NXBundle *)aBundle;
+ removeSoundForName:(const char *)name;
+ getVolume:(float *)left :(float *)right;
+ setVolume:(float)left :(float)right;
+ (BOOL)isMuted;
+ setMute:(BOOL)aFlag;
- initFromSoundfile:(const char *)filename;
- initFromSection:(const char *)sectionName;
- initFromPasteboard: (Pasteboard *)thePboard;
- free;
- readSoundFromStream:(NXStream *)stream;
- writeSoundToStream:(NXStream *)stream;
- write:(NXTypedStream *) stream;
- read:(NXTypedStream *) stream;
- finishUnarchiving;
- (const char *)name;
- setName:(const char *)theName;
- delegate;
- setDelegate:anObject;
- (double)samplingRate;
- (int)sampleCount;
- (double)duration;
- (int)channelCount;
- (char *)info;
- (int)infoSize;
- play:sender;
- (int)play;
- record:sender;
- (int)record;
- (int)samplesProcessed;
- (int)status;
- (int)waitUntilStopped;
- stop:sender;
- (int)stop;
- pause:sender;
- (int)pause;
- resume:sender;
- (int)resume;
- (int)readSoundfile:(const char *)filename;
- (int)writeSoundfile:(const char *)filename;
- (int)writeToPasteboard:(Pasteboard *)thePboard;
- (BOOL)isEmpty;
- (BOOL)isEditable;
- (BOOL)compatibleWith:aSound;
- (BOOL)isPlayable;
- (int)convertToFormat:(int)aFormat
samplingRate:(double)aRate
channelCount:(int)aChannelCount;
- (int)convertToFormat:(4QaFormat;
- (int)deleteSamples;
- (int)deleteSamplesAt:(int)startSample count:(int)sampleCount;
- (int)insertSamples:aSound at:(int)startSample;
- (int)copySound:aSound;
- (int)copySamples:aSound at:(int)startSample count:(int)sampleCount;
- (int)compactSamples;
- (BOOL)needsCompacting;
- (unsigned char *)data;
- (int)dataSize;
- (int)dataFormat;
- (int)setDataSize:(int)newDataSize
dataFormat:(int)newDataFormat
samplingRate:(double)newSamplingRate
channelCount:(int)newChannelCount
infoSize:(int)newInfoSize;
- (SNDSoundStruct *)soundStruct;
- (int)soundStructSize;
- setSoundStruct:(SNDSoundStruct *)aStruct soundStructSize:(int)aSize;
- (SNDSoundStruct *)soundStructBeingProcessed;
- (int)processingError;
- soundBeingProcessed;
- tellDelegate:(SEL)theMessage;
@end
@interface SoundDelegate : Object
- willRecord:sender;
- didRecord:sender;
- willPlay:sender;
- didPlay:sender;
- hadError:sender;
@end