MusicKit  0.0.0
Public Member Functions | Static Public Member Functions | Protected Attributes
SndStreamMixer Class Reference

Stream mixer and effects processor. More...

#import <SndStreamMixer.h>

List of all members.

Public Member Functions

(id) - init
 Initializer method.
(id) - processInBuffer:outBuffer:nowTime:
 Mixes together all clients currently exposed output buffers.
(BOOL) - removeClient:
 Removes the given SndStreamClient from mixing.
(int) - addClient:
 Add a SndStreamClient to the mix.
(NSArray *) - clients
 Returns an NSArray of clients of the SndStreamMixer instance.
(void) - finishMixing
 Informs the receiver that all mixing is to be completed, that mixing clients and buffers are to be updated.
(int) - clientCount
 Returns the number of stream clients currently connected to the mixer.
(SndAudioProcessorChain *) - audioProcessorChain
 Returns the SndAudioProcessorChain applied after mixing SndStreamClients.
(void) - resetTime:
 Resets the mixer's sense of time, and pro.
(SndStreamClient *) - clientAtIndex:
 Returns a given SndStreamClient being mixed, indexed by a numeric identifier.
(id) - init
 Initializer method.
(id) - processInBuffer:outBuffer:nowTime:
 Mixes together all clients currently exposed output buffers.
(BOOL) - removeClient:
 Removes the given SndStreamClient from mixing.
(int) - addClient:
 Add a SndStreamClient to the mix.
(NSArray *) - clients
 Returns an NSArray of clients of the SndStreamMixer instance.
(void) - finishMixing
 Informs the receiver that all mixing is to be completed, that mixing clients and buffers are to be updated.
(int) - clientCount
 Returns the number of stream clients currently connected to the mixer.
(SndAudioProcessorChain *) - audioProcessorChain
 Returns the SndAudioProcessorChain applied after mixing SndStreamClients.
(void) - resetTime:
 Resets the mixer's sense of time, and pro.
(SndStreamClient *) - clientAtIndex:
 Returns a given SndStreamClient being mixed, indexed by a numeric identifier.

Static Public Member Functions

(id) + mixer
 Factory method returning an initialized and autoreleased SndStreamMixer instance.
(id) + mixer
 Factory method returning an initialized and autoreleased SndStreamMixer instance.

Protected Attributes

NSMutableArray * streamClients
NSLock * streamClientsLock
SndAudioProcessorChainprocessorChain
double nowTime
double lastNowTime

Detailed Description

Stream mixer and effects processor.

The SndStreamMixer class is responsible for managing the mixing of SndAudioBuffers from all current SndStreamClients. After mixing all buffers, it can apply any signal processing to the mixed result by modifying it's SndAudioProcessorChain retrieved using audioProcessorChain.


Member Function Documentation

- (int) addClient: (SndStreamClient *)  client

Add a SndStreamClient to the mix.

If the client is already being mixed, it will not be added again.

Parameters:
clientA SndStreamClient instance.
Returns:
Returns the new number of clients.
- (int) addClient: (SndStreamClient *)  client

Add a SndStreamClient to the mix.

If the client is already being mixed, it will not be added again.

Parameters:
clientA SndStreamClient instance.
Returns:
Returns the new number of clients.

Returns the SndAudioProcessorChain applied after mixing SndStreamClients.

Returns:
Returns a reference to the audio processor chain.

Returns the SndAudioProcessorChain applied after mixing SndStreamClients.

Returns:
Returns a reference to the audio processor chain.
- (SndStreamClient *) clientAtIndex: (int)  clientIndex

Returns a given SndStreamClient being mixed, indexed by a numeric identifier.

Parameters:
clientIndex
- (SndStreamClient *) clientAtIndex: (int)  clientIndex

Returns a given SndStreamClient being mixed, indexed by a numeric identifier.

Parameters:
clientIndex
- (int) clientCount

Returns the number of stream clients currently connected to the mixer.

Returns:
Returns the number of stream clients currently connected to the mixer.
- (int) clientCount

Returns the number of stream clients currently connected to the mixer.

Returns:
Returns the number of stream clients currently connected to the mixer.
- (NSArray *) clients

Returns an NSArray of clients of the SndStreamMixer instance.

Returns:
Return the clients in an immutable autoreleased array.
- (NSArray *) clients

Returns an NSArray of clients of the SndStreamMixer instance.

Returns:
Return the clients in an immutable autoreleased array.
- (void) finishMixing

Informs the receiver that all mixing is to be completed, that mixing clients and buffers are to be updated.

This should be sent when the manager is shutting down.

- (void) finishMixing

Informs the receiver that all mixing is to be completed, that mixing clients and buffers are to be updated.

This should be sent when the manager is shutting down.

- (id) init

Initializer method.

Returns:
Returns self.
- (id) init

Initializer method.

Returns:
Returns self.
+ (id) mixer

Factory method returning an initialized and autoreleased SndStreamMixer instance.

Returns:
Returns an initialized and autoreleased SndStreamMixer instance.
+ (id) mixer

Factory method returning an initialized and autoreleased SndStreamMixer instance.

Returns:
Returns an initialized and autoreleased SndStreamMixer instance.
- (id) processInBuffer: (SndAudioBuffer *)  inB
outBuffer: (SndAudioBuffer *)  outB
nowTime: (double)  t 

Mixes together all clients currently exposed output buffers.

After mixing all client exposed output buffers, processInBuffer:outBuffer:nowTime then applies any audio processing to the mix. Each client then receives the message startProcessingNextBufferWithInput:nowTime:, passing the input buffer, to generate the next buffer.

Parameters:
inBThe input buffer filled with recorded audio.
outBThe output buffer to fill for playback.
tThe current now time.
Returns:
Returns self.
- (id) processInBuffer: (SndAudioBuffer *)  inB
outBuffer: (SndAudioBuffer *)  outB
nowTime: (double)  t 

Mixes together all clients currently exposed output buffers.

After mixing all client exposed output buffers, processInBuffer:outBuffer:nowTime then applies any audio processing to the mix. Each client then receives the message startProcessingNextBufferWithInput:nowTime:, passing the input buffer, to generate the next buffer.

Parameters:
inBThe input buffer filled with recorded audio.
outBThe output buffer to fill for playback.
tThe current now time.
Returns:
Returns self.
- (BOOL) removeClient: (SndStreamClient *)  client

Removes the given SndStreamClient from mixing.

Parameters:
clientThe SndStreamClient instance to remove.
Returns:
Returns YES if client was successfully removed, NO if it was not being mixed.
- (BOOL) removeClient: (SndStreamClient *)  client

Removes the given SndStreamClient from mixing.

Parameters:
clientThe SndStreamClient instance to remove.
Returns:
Returns YES if client was successfully removed, NO if it was not being mixed.
- (void) resetTime: (double)  originTimeInSeconds

Resets the mixer's sense of time, and pro.

Parameters:
originTimeInSeconds
- (void) resetTime: (double)  originTimeInSeconds

Resets the mixer's sense of time, and pro.

Parameters:
originTimeInSeconds

Member Data Documentation

- (double) lastNowTime [protected]

The previous time of last update from SndStreamManager.

- (double) nowTime [protected]

The current time (in seconds) to mix up to, as updated from the SndStreamManager, passed into processInBuffer:outBuffer:nowTime.

A chain of SndAudioProcessors that is applied after mixing all the stream clients together.

- (NSMutableArray *) streamClients [protected]

A modifiable array of SndStreamClients currently being mixed.

- (NSLock *) streamClientsLock [protected]

Controls access to the clients preventing their addition or removal while being mixed.


The documentation for this class was generated from the following files: