#import <SndStreamMixer.h>
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. | |
(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. | |
Protected Attributes | |
NSMutableArray * | streamClients |
NSLock * | streamClientsLock |
SndAudioProcessorChain * | processorChain |
double | nowTime |
double | lastNowTime |
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.
+ (id) mixer |
Factory method returning an initialized and autoreleased SndStreamMixer instance.
- (id) init |
Initializer method.
- (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.
inB | The input buffer filled with recorded audio. | |
outB | The output buffer to fill for playback. | |
t | The current now time. |
- (BOOL) removeClient: | (SndStreamClient *) | client |
Removes the given SndStreamClient from mixing.
client | The SndStreamClient instance to remove. |
- (int) addClient: | (SndStreamClient *) | client |
Add a SndStreamClient to the mix.
If the client is already being mixed, it will not be added again.
client | A SndStreamClient instance. |
- (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.
- (int) clientCount |
Returns the number of stream clients currently connected to the mixer.
- (SndAudioProcessorChain *) audioProcessorChain |
Returns the SndAudioProcessorChain applied after mixing SndStreamClients.
- (void) resetTime: | (double) | originTimeInSeconds |
Resets the mixer's sense of time, and pro.
originTimeInSeconds |
- (SndStreamClient *) clientAtIndex: | (int) | clientIndex |
Returns a given SndStreamClient being mixed, indexed by a numeric identifier.
clientIndex |
- (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.
- (SndAudioProcessorChain*) processorChain [protected] |
A chain of SndAudioProcessors that is applied after mixing all the stream clients together.
- (double) nowTime [protected] |
The current time (in seconds) to mix up to, as updated from the SndStreamManager, passed into processInBuffer:outBuffer:nowTime.
- (double) lastNowTime [protected] |
The previous time of last update from SndStreamManager.