MusicKit
0.0.0
|
Holds the state associated with each sounding (or soon to be) Snd. More...
#import <SndPerformance.h>
Public Member Functions | |
(id) | - initWithSnd:playingAtTime: |
Initialise a performance with a sound and a time to begin playing. | |
(id) | - initWithSnd:playingAtTime:beginAtIndex:endAtIndex: |
Initialise a performance with a sound and a time to begin playing, and the index of the first and last samples of the sound to play. | |
(id) | - initWithSnd:playingAtTime:startPosition:duration:deltaTime: |
Initialise a performance with a sound and a time to begin playing, and the index of the last sample of the sound to play. | |
(Snd *) | - snd |
Returns the Snd instance being played in this performance. | |
(double) | - playTime |
Returns the time the sound is to begin playing. | |
(id) | - setPlayTime: |
Sets the time interval in seconds from the current time the sound is to begin playing. | |
(long) | - playIndex |
Returns the sample to start playing from. | |
(void) | - setPlayIndex: |
Sets the sample to start playing from. | |
(long) | - rewindPlayIndexBySamples: |
Rewinds the sample to start playing from by the supplied number of samples. | |
(long) | - endAtIndex |
Returns the sample to stop playing at. | |
(long) | - startAtIndex |
Returns the sample to start playing at. | |
(void) | - setEndAtIndex: |
Sets the sample to stop playing at. | |
(void) | - setLooping: |
Sets looping during performance on or off. | |
(BOOL) | - looping |
Returns whether this performance loops. | |
(void) | - setLoopStartIndex: |
Sets the sample to start looping from. | |
(long) | - loopStartIndex |
Returns the sample to start looping from. | |
(void) | - setLoopEndIndex: |
Sets the sample at which the performance loops back to the start index (set using setLoopStartIndex:). | |
(long) | - loopEndIndex |
Returns the sample index at the end of the loop. | |
(void) | - stopInFuture: |
Stop the currently playing performance at some time in the future. | |
(void) | - stopNow |
Stops the performance immediately. | |
(BOOL) | - isEqual: |
Compares two performances. | |
(NSString *) | - description |
Returns a string containing a brief description of the performance object. | |
(BOOL) | - isPaused |
Returns if the performance is paused. | |
(id) | - setPaused: |
Pauses the performance. | |
(id) | - pause |
Pauses a performance. | |
(id) | - resume |
Resumes a paused performance. | |
(BOOL) | - isPlaying |
Indicates whether the current performance is actually sounding. | |
(SndAudioProcessorChain *) | - audioProcessorChain |
Returns the SndAudioProcessorChain associated with this performance. | |
(void) | - setAudioProcessorChain: |
Assigns an new SndAudioProcessorChain to effect the performance of a Snd instance. | |
(long) | - retrievePerformBuffer:ofLength: |
Fills the given buffer with sound data, reading from the playIndex up until endAtIndex (which allows us to play a sub-section of a sound). | |
(BOOL) | - atEndOfPerformance |
Tests if the play index has reached the end index, indicating that the performance has completed. | |
(id) | - initWithSnd:playingAtTime: |
Initialise a performance with a sound and a time to begin playing. | |
(id) | - initWithSnd:playingAtTime:beginAtIndex:endAtIndex: |
Initialise a performance with a sound and a time to begin playing, and the index of the first and last samples of the sound to play. | |
(id) | - initWithSnd:playingAtTime:startPosition:duration:deltaTime: |
Initialise a performance with a sound and a time to begin playing, and the index of the last sample of the sound to play. | |
(Snd *) | - snd |
Returns the Snd instance being played in this performance. | |
(double) | - playTime |
Returns the time the sound is to begin playing. | |
(id) | - setPlayTime: |
Sets the time interval in seconds from the current time the sound is to begin playing. | |
(long) | - playIndex |
Returns the sample to start playing from. | |
(void) | - setPlayIndex: |
Sets the sample to start playing from. | |
(long) | - rewindPlayIndexBySamples: |
Rewinds the sample to start playing from by the supplied number of samples. | |
(long) | - endAtIndex |
Returns the sample to stop playing at. | |
(long) | - startAtIndex |
Returns the sample to start playing at. | |
(void) | - setEndAtIndex: |
Sets the sample to stop playing at. | |
(void) | - setLooping: |
Sets looping during performance on or off. | |
(BOOL) | - looping |
Returns whether this performance loops. | |
(void) | - setLoopStartIndex: |
Sets the sample to start looping from. | |
(long) | - loopStartIndex |
Returns the sample to start looping from. | |
(void) | - setLoopEndIndex: |
Sets the sample at which the performance loops back to the start index (set using setLoopStartIndex:). | |
(long) | - loopEndIndex |
Returns the sample index at the end of the loop. | |
(void) | - stopInFuture: |
Stop the currently playing performance at some time in the future. | |
(void) | - stopNow |
Stops the performance immediately. | |
(BOOL) | - isEqual: |
Compares two performances. | |
(NSString *) | - description |
Returns a string containing a brief description of the performance object. | |
(BOOL) | - isPaused |
Returns if the performance is paused. | |
(id) | - setPaused: |
Pauses the performance. | |
(id) | - pause |
Pauses a performance. | |
(id) | - resume |
Resumes a paused performance. | |
(BOOL) | - isPlaying |
Indicates whether the current performance is actually sounding. | |
(SndAudioProcessorChain *) | - audioProcessorChain |
Returns the SndAudioProcessorChain associated with this performance. | |
(void) | - setAudioProcessorChain: |
Assigns an new SndAudioProcessorChain to effect the performance of a Snd instance. | |
(long) | - retrievePerformBuffer:ofLength: |
Fills the given buffer with sound data, reading from the playIndex up until endAtIndex (which allows us to play a sub-section of a sound). | |
(BOOL) | - atEndOfPerformance |
Tests if the play index has reached the end index, indicating that the performance has completed. | |
Static Public Member Functions | |
(SndPerformance *) | + performanceOfSnd:playingAtTime: |
Create and return an autoreleased instance of SndPerformance with a sound and a time to begin playing. Convenience method to performanceOfSnd:playingAtTime:endAtIndex. | |
(SndPerformance *) | + performanceOfSnd:playingAtTime:beginAtIndex:endAtIndex: |
Create and return an autoreleased instance of SndPerformance with a sound and a time to begin playing. | |
(SndPerformance *) | + performanceOfSnd:playingAtTime: |
Create and return an autoreleased instance of SndPerformance with a sound and a time to begin playing. Convenience method to performanceOfSnd:playingAtTime:endAtIndex. | |
(SndPerformance *) | + performanceOfSnd:playingAtTime:beginAtIndex:endAtIndex: |
Create and return an autoreleased instance of SndPerformance with a sound and a time to begin playing. | |
Protected Attributes | |
Snd * | snd |
double | playTime |
long | startAtIndex |
long | playIndex |
long | endAtIndex |
BOOL | paused |
SndAudioProcessorChain * | audioProcessorChain |
BOOL | looping |
long | loopStartIndex |
long | loopEndIndex |
Holds the state associated with each sounding (or soon to be) Snd.
This differs from a Snd instance itself, since we can have multiple overlapping simultaneous performances of the same (potentially huge) Snd, some looping, others not. We need some way of indicating to the delegate exactly which performance has completed, hence this class. A SndPerformance also has an SndAudioProcessorChain enabling each performance of a sound to be signal processed, including volume fading, panning etc using the audio processor chain "postFader" SndAudioFader.
Returns the SndAudioProcessorChain associated with this performance.
Returns the SndAudioProcessorChain associated with this performance.
- (NSString *) description |
Returns a string containing a brief description of the performance object.
- (NSString *) description |
Returns a string containing a brief description of the performance object.
- (long) endAtIndex |
Returns the sample to stop playing at.
This sample is not played, that is it is typically initialised with the sound length.
- (long) endAtIndex |
Returns the sample to stop playing at.
This sample is not played, that is it is typically initialised with the sound length.
- (id) initWithSnd: | (Snd *) | s | |
playingAtTime: | (double) | seconds | |
Initialise a performance with a sound and a time to begin playing.
Convenience method to initWithSnd:playingAtTime:endAtIndex:
s | The sound to be played |
seconds | Time in seconds to start playing the sound |
- (id) initWithSnd: | (Snd *) | s | |
playingAtTime: | (double) | seconds | |
Initialise a performance with a sound and a time to begin playing.
Convenience method to initWithSnd:playingAtTime:endAtIndex:
s | The sound to be played |
seconds | Time in seconds to start playing the sound |
- (id) initWithSnd: | (Snd *) | s | |
playingAtTime: | (double) | seconds | |
beginAtIndex: | (long) | beginIndex | |
endAtIndex: | (long) | endIndex | |
Initialise a performance with a sound and a time to begin playing, and the index of the first and last samples of the sound to play.
s | The sound to be played |
seconds | Time in seconds to start playing the sound |
beginIndex | The sample index at which to start playback |
endIndex | The sample index at which to stop playback |
- (id) initWithSnd: | (Snd *) | s | |
playingAtTime: | (double) | seconds | |
beginAtIndex: | (long) | beginIndex | |
endAtIndex: | (long) | endIndex | |
Initialise a performance with a sound and a time to begin playing, and the index of the first and last samples of the sound to play.
s | The sound to be played |
seconds | Time in seconds to start playing the sound |
beginIndex | The sample index at which to start playback |
endIndex | The sample index at which to stop playback |
- (id) initWithSnd: | (Snd *) | s | |
playingAtTime: | (double) | playTime | |
startPosition: | (double) | startPosition | |
duration: | (double) | duration | |
deltaTime: | (double) | deltaTime | |
Initialise a performance with a sound and a time to begin playing, and the index of the last sample of the sound to play.
s | The Snd instance to begin playing. |
playTime | The time to begin playback. |
startPosition | The sample index at which to begin playback. |
duration | The duration in seconds of the Snd instance to play. |
deltaTime | TBD. |
- (id) initWithSnd: | (Snd *) | s | |
playingAtTime: | (double) | playTime | |
startPosition: | (double) | startPosition | |
duration: | (double) | duration | |
deltaTime: | (double) | deltaTime | |
Initialise a performance with a sound and a time to begin playing, and the index of the last sample of the sound to play.
s | The Snd instance to begin playing. |
playTime | The time to begin playback. |
startPosition | The sample index at which to begin playback. |
duration | The duration in seconds of the Snd instance to play. |
deltaTime | TBD. |
- (BOOL) isEqual: | (id) | anotherPerformance |
Compares two performances.
anotherPerformance |
- (BOOL) isEqual: | (id) | anotherPerformance |
Compares two performances.
anotherPerformance |
- (BOOL) isPaused |
Returns if the performance is paused.
- (BOOL) isPaused |
Returns if the performance is paused.
- (BOOL) isPlaying |
Indicates whether the current performance is actually sounding.
- (BOOL) isPlaying |
Indicates whether the current performance is actually sounding.
- (long) loopEndIndex |
Returns the sample index at the end of the loop.
- (long) loopEndIndex |
Returns the sample index at the end of the loop.
- (BOOL) looping |
Returns whether this performance loops.
- (BOOL) looping |
Returns whether this performance loops.
- (long) loopStartIndex |
Returns the sample to start looping from.
- (long) loopStartIndex |
Returns the sample to start looping from.
+ (SndPerformance *) performanceOfSnd: | (Snd *) | s | |
playingAtTime: | (double) | seconds | |
Create and return an autoreleased instance of SndPerformance with a sound and a time to begin playing. Convenience method to performanceOfSnd:playingAtTime:endAtIndex.
s | The sound to be played |
seconds | Time in seconds to start playing the sound |
+ (SndPerformance *) performanceOfSnd: | (Snd *) | s | |
playingAtTime: | (double) | seconds | |
Create and return an autoreleased instance of SndPerformance with a sound and a time to begin playing. Convenience method to performanceOfSnd:playingAtTime:endAtIndex.
s | The sound to be played |
seconds | Time in seconds to start playing the sound |
+ (SndPerformance *) performanceOfSnd: | (Snd *) | s | |
playingAtTime: | (double) | seconds | |
beginAtIndex: | (long) | beginIndex | |
endAtIndex: | (long) | endIndex | |
Create and return an autoreleased instance of SndPerformance with a sound and a time to begin playing.
s | The sound to be played |
seconds | Time in seconds to start playing the sound |
beginIndex | The sample index at which to start playback. This sample will be played. |
endIndex | The sample index at which to stop playback. This sample will not be played. |
+ (SndPerformance *) performanceOfSnd: | (Snd *) | s | |
playingAtTime: | (double) | seconds | |
beginAtIndex: | (long) | beginIndex | |
endAtIndex: | (long) | endIndex | |
Create and return an autoreleased instance of SndPerformance with a sound and a time to begin playing.
s | The sound to be played |
seconds | Time in seconds to start playing the sound |
beginIndex | The sample index at which to start playback. This sample will be played. |
endIndex | The sample index at which to stop playback. This sample will not be played. |
- (long) playIndex |
Returns the sample to start playing from.
- (long) playIndex |
Returns the sample to start playing from.
- (double) playTime |
Returns the time the sound is to begin playing.
- (double) playTime |
Returns the time the sound is to begin playing.
- (long) retrievePerformBuffer: | (SndAudioBuffer *) | bufferToFill | |
ofLength: | (long) | buffLength | |
Fills the given buffer with sound data, reading from the playIndex up until endAtIndex (which allows us to play a sub-section of a sound).
playIndex is updated, and looping is respected. In the case of the end of the sound being encountered, a smaller buffer will be filled, and the smaller size is returned.
bufferToFill | A SndAudioBuffer that will be filled with samples. |
buffLength | The intended number of samples TODO or bytes? to retrieve. |
- (long) retrievePerformBuffer: | (SndAudioBuffer *) | bufferToFill | |
ofLength: | (long) | buffLength | |
Fills the given buffer with sound data, reading from the playIndex up until endAtIndex (which allows us to play a sub-section of a sound).
playIndex is updated, and looping is respected. In the case of the end of the sound being encountered, a smaller buffer will be filled, and the smaller size is returned.
bufferToFill | A SndAudioBuffer that will be filled with samples. |
buffLength | The intended number of samples TODO or bytes? to retrieve. |
- (long) rewindPlayIndexBySamples: | (long) | numberOfSamplesToRewind |
Rewinds the sample to start playing from by the supplied number of samples.
The loop points are respected, such that rewinding a sound that is set to loop before it's loop start index will wrap to the end of the loop. If this isn't wanted, either temporarily disable looping or use setPlayIndex:.
numberOfSamplesToRewind | The number of samples to rewind to where playing should begin from. |
- (long) rewindPlayIndexBySamples: | (long) | numberOfSamplesToRewind |
Rewinds the sample to start playing from by the supplied number of samples.
The loop points are respected, such that rewinding a sound that is set to loop before it's loop start index will wrap to the end of the loop. If this isn't wanted, either temporarily disable looping or use setPlayIndex:.
numberOfSamplesToRewind | The number of samples to rewind to where playing should begin from. |
- (void) setAudioProcessorChain: | (SndAudioProcessorChain *) | anAudioProcessorChain |
Assigns an new SndAudioProcessorChain to effect the performance of a Snd instance.
anAudioProcessorChain |
- (void) setAudioProcessorChain: | (SndAudioProcessorChain *) | anAudioProcessorChain |
Assigns an new SndAudioProcessorChain to effect the performance of a Snd instance.
anAudioProcessorChain |
- (void) setEndAtIndex: | (long) | newEndAtIndex |
Sets the sample to stop playing at.
The end at index indicates the first sample at which the playback stops, that is, this sample is not played.
newEndAtIndex | The sample index that playing should stop before. |
- (void) setEndAtIndex: | (long) | newEndAtIndex |
Sets the sample to stop playing at.
The end at index indicates the first sample at which the playback stops, that is, this sample is not played.
newEndAtIndex | The sample index that playing should stop before. |
- (void) setLoopEndIndex: | (long) | newLoopEndIndex |
Sets the sample at which the performance loops back to the start index (set using setLoopStartIndex:).
newLoopEndIndex | The sample index at the end of the loop. |
This sample index is the last sample of the loop, i.e. it is the last sample heard before the performance loops, the next sample heard will be that returned by -loopStartIndex. The loop end index may be changed while the sound is being performed and regardless of whether the performance is looping.
- (void) setLoopEndIndex: | (long) | newLoopEndIndex |
Sets the sample at which the performance loops back to the start index (set using setLoopStartIndex:).
newLoopEndIndex | The sample index at the end of the loop. |
This sample index is the last sample of the loop, i.e. it is the last sample heard before the performance loops, the next sample heard will be that returned by -loopStartIndex. The loop end index may be changed while the sound is being performed and regardless of whether the performance is looping.
- (void) setLooping: | (BOOL) | yesOrNo |
Sets looping during performance on or off.
yesOrNo | Sets looping during performance on or off. |
- (void) setLooping: | (BOOL) | yesOrNo |
Sets looping during performance on or off.
yesOrNo | Sets looping during performance on or off. |
- (void) setLoopStartIndex: | (long) | loopStartIndex |
Sets the sample to start looping from.
loopStartIndex | The sample index to start looping from. |
The loop start index may be changed while the sound is being performed and regardless of whether the performance is looping. This sample index is the first sample of the loop, i.e it is the first sample heard when the performance loops.
- (void) setLoopStartIndex: | (long) | loopStartIndex |
Sets the sample to start looping from.
loopStartIndex | The sample index to start looping from. |
The loop start index may be changed while the sound is being performed and regardless of whether the performance is looping. This sample index is the first sample of the loop, i.e it is the first sample heard when the performance loops.
- (id) setPaused: | (BOOL) | isPaused |
Pauses the performance.
isPaused | a flag to signal whether or not the performance is paused. |
- (id) setPaused: | (BOOL) | isPaused |
Pauses the performance.
isPaused | a flag to signal whether or not the performance is paused. |
- (void) setPlayIndex: | (long) | newPlayIndex |
Sets the sample to start playing from.
newPlayIndex | The sample index that playing should begin from. |
- (void) setPlayIndex: | (long) | newPlayIndex |
Sets the sample to start playing from.
newPlayIndex | The sample index that playing should begin from. |
- (long) startAtIndex |
Returns the sample to start playing at.
- (long) startAtIndex |
Returns the sample to start playing at.
- (void) stopInFuture: | (double) | inSeconds |
Stop the currently playing performance at some time in the future.
inSeconds | The time interval when to stop the performance. |
- (void) stopInFuture: | (double) | inSeconds |
Stop the currently playing performance at some time in the future.
inSeconds | The time interval when to stop the performance. |
- (SndAudioProcessorChain *) audioProcessorChain [protected] |
Effects applied to this particular performance.
- (long) endAtIndex [protected] |
The index where the sound will stop before. This marks the sample after the last one to be played, the sample at endAtIndex is not played.
- (long) loopEndIndex [protected] |
The sample the loop ends at. This sample is included in the loop.
- (BOOL) looping [protected] |
Indicates whether to loop during performance.
- (long) loopStartIndex [protected] |
The sample the loop begins at. This sample is included in the loop.
- (long) playIndex [protected] |
The index where the sound will next play from (using retrievePerformBuffer:).
- (double) playTime [protected] |
The time when to initiate playing.
- (long) startAtIndex [protected] |
The index where the sound will begin playing from at the start of a sound performance.