home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks2 / SoundKit.framework / Headers / Sound.h < prev    next >
Text File  |  1994-11-15  |  5KB  |  178 lines

  1. /*
  2.     Sound.h
  3.     Sound Kit, Release 2.0
  4.     Copyright (c) 1988, 1989, 1990, NeXT, Inc.  All rights reserved. 
  5. */
  6.  
  7. #import <objc/Object.h>
  8. #import <objc/hashtable.h>
  9. #import <objc/NXBundle.h>
  10. #import <streams/streams.h>
  11. #import <sound/sound.h>
  12. @class NSString;
  13. @class NSBundle;
  14. @class NSPasteboard;
  15.  
  16. /* Define this for compatibility */
  17. #define NXSoundPboard NXSoundPboardType
  18.  
  19. extern NXAtom NXSoundPboardType;
  20. /*
  21.  * This is the sound pasteboard type.
  22.  */
  23.  
  24. @interface Sound : Object
  25. /*
  26.  * The Sound object encapsulates a SNDSoundStruct, which represents a sound.
  27.  * It supports reading and writing to a soundfile, playback of sound,
  28.  * recording of sampled sound, conversion among various sampled formats, 
  29.  * basic editing of the sound, and name and storage management for sounds.
  30.  */
  31.  {
  32.     SNDSoundStruct *soundStruct; /* the sound data structure */
  33.     int soundStructSize;     /* the length of the structure in bytes */
  34.     int priority;         /* the priority of the sound */
  35.     id delegate;         /* the target of notification messages */
  36.     int status;             /* what the object is currently doing */
  37.     char *name;             /* The name of the sound */
  38.     SNDSoundStruct *_scratchSound;
  39.     int _scratchSize;
  40. }
  41.  
  42. /*
  43.  * Status codes
  44.  */
  45. typedef enum {
  46.     NX_SoundStopped = 0,
  47.     NX_SoundRecording,
  48.     NX_SoundPlaying,
  49.     NX_SoundInitialized,
  50.     NX_SoundRecordingPaused,
  51.     NX_SoundPlayingPaused,
  52.     NX_SoundRecordingPending,
  53.     NX_SoundPlayingPending,
  54.     NX_SoundFreed = -1,
  55. } NXSoundStatus;
  56.  
  57. /*
  58.  * OBSOLETE status codes - use the NX ones above.
  59.  */
  60. typedef enum {
  61.     SK_STATUS_STOPPED = NX_SoundStopped,
  62.     SK_STATUS_RECORDING = NX_SoundRecording,
  63.     SK_STATUS_PLAYING = NX_SoundPlaying,
  64.     SK_STATUS_INITIALIZED = NX_SoundInitialized,
  65.     SK_STATUS_RECORDING_PAUSED = NX_SoundRecordingPaused,
  66.     SK_STATUS_PLAYING_PAUSED = NX_SoundPlayingPaused,
  67.     SK_STATUS_RECORDING_PENDING = NX_SoundRecordingPending,
  68.     SK_STATUS_PLAYING_PENDING = NX_SoundPlayingPending,
  69.     SK_STATUS_FREED = NX_SoundFreed,
  70. } SKStatus;
  71.  
  72. /*
  73.  * Macho segment name where sounds may be.
  74.  */
  75. #define NX_SOUND_SEGMENT_NAME "__SND"
  76.  
  77. /*
  78.  * OBSOLETE macho segment name - use the NX one above.
  79.  */
  80. #define SK_SEGMENT_NAME "__SND"
  81.  
  82.  
  83. /*
  84.  * --------------- Factory Methods
  85.  */
  86.  
  87. + findSoundFor:(NSString *)aName;
  88.  
  89. + addName:(NSString *)name sound:aSound;
  90. + addName:(NSString *)name fromSoundfile:(NSString *)filename;
  91. + addName:(NSString *)name fromSection:(NSString *)sectionName;
  92. + addName:(NSString *)aName fromBundle:(NSBundle *)aBundle;
  93.  
  94. + removeSoundForName:(const char *)name;
  95.  
  96. + getVolume:(float *)left :(float *)right;
  97. + setVolume:(float)left :(float)right;
  98. + (BOOL)isMuted;
  99. + setMute:(BOOL)aFlag;
  100.  
  101. - initFromSoundfile:(NSString *)filename;
  102. - initFromSection:(NSString *)sectionName;
  103. - initFromPasteboard: (NSPasteboard *)thePboard;
  104.  
  105. - free;
  106. - readSoundFromStream:(NXStream *)stream;
  107. - writeSoundToStream:(NXStream *)stream;
  108. - write:(NXTypedStream *) stream;
  109. - read:(NXTypedStream *) stream;
  110. - finishUnarchiving;
  111. - (const char *)name;
  112. - setName:(NSString *)theName;
  113. - delegate;
  114. - setDelegate:anObject;
  115. - (double)samplingRate;
  116. - (int)sampleCount;
  117. - (double)duration;
  118. - (int)channelCount;
  119. - (char *)info;
  120. - (int)infoSize;
  121. - play:sender;
  122. - (int)play;
  123. - record:sender;
  124. - (int)record;
  125. - (int)samplesProcessed;
  126. - (int)status;
  127. - (int)waitUntilStopped;
  128. - stop:sender;
  129. - (int)stop;
  130. - pause:sender;
  131. - (int)pause;
  132. - resume:sender;
  133. - (int)resume;
  134. - (int)readSoundfile:(NSString *)filename;
  135. - (int)writeSoundfile:(NSString *)filename;
  136. - (int)writeToPasteboard:(NSPasteboard *)thePboard;
  137. - (BOOL)isEmpty;
  138. - (BOOL)isEditable;
  139. - (BOOL)compatibleWith:aSound;
  140. - (BOOL)isPlayable;
  141. - (int)convertToFormat:(int)aFormat
  142.        samplingRate:(double)aRate
  143.        channelCount:(int)aChannelCount;
  144. - (int)convertToFormat:(int)aFormat;
  145. - (int)deleteSamples;
  146. - (int)deleteSamplesAt:(int)startSample count:(int)sampleCount;
  147. - (int)insertSamples:aSound at:(int)startSample;
  148. - (int)copySound:aSound;
  149. - (int)copySamples:aSound at:(int)startSample count:(int)sampleCount;
  150. - (int)compactSamples;
  151. - (BOOL)needsCompacting;
  152. - (unsigned char *)data;
  153. - (int)dataSize;
  154. - (int)dataFormat;
  155. - (int)setDataSize:(int)newDataSize
  156.      dataFormat:(int)newDataFormat
  157.      samplingRate:(double)newSamplingRate
  158.      channelCount:(int)newChannelCount
  159.      infoSize:(int)newInfoSize;
  160. - (SNDSoundStruct *)soundStruct;
  161. - (int)soundStructSize;
  162. - setSoundStruct:(SNDSoundStruct *)aStruct soundStructSize:(int)aSize;
  163. - (SNDSoundStruct *)soundStructBeingProcessed;
  164. - (int)processingError;
  165. - soundBeingProcessed;
  166. - tellDelegate:(SEL)theMessage;
  167.  
  168. @end
  169.  
  170. @interface SoundDelegate : Object
  171. - willRecord:sender;
  172. - didRecord:sender;
  173. - willPlay:sender;
  174. - didPlay:sender;
  175. - hadError:sender;
  176. @end
  177.  
  178.