MKMixerInstrument Class Reference

MKMixerInstrument mixes soundfiles based on a score description of the mix. More...

#import <MKMixerInstrument.h>

Inheritance diagram for MKMixerInstrument:

MKInstrument

List of all members.

Public Member Functions

(void) - setSamplingRate:
 Sets the sampling rate to be used when mixing sounds.
(void) - setChannelCount:
 Sets the number of audio channels to be used when mixing sounds.
(Snd *) - mixedSound
 Returns the sound that has been mixed.
(id) - init
 Initializes the instance to 44.1KHz, 16 bit stereo file output.
(void) - dealloc
 Disconnects, removes, and releases ivars.
(id) - firstNote:
 You do not normally call this method explictly.
(BOOL) - mixNewNote:
 Internal method to manage the reception of a new note.
(BOOL) - mixNoteUpdate:
 Internal method to manage the reception of an update MKNote.
(id) - realizeNote:fromNoteReceiver:
 This is invoked when a new MKNote is received during performance to perform the mixing.
(id) - afterPerformance
 You do not normally call this method explictly.

Protected Attributes

NSMutableDictionary * samplesToMix
unsigned int currentMixFrame
SndFormat soundFormat
Sndsound
SndAudioProcessorChainmixedProcessorChain
double defaultAmplitude
double defaultBearing
double defaultNewFrequency
double defaultOriginalFrequency
NSString * defaultFile
id defaultEnvelope
int defaultTimeScale
BOOL currentlyLooping


Detailed Description

MKMixerInstrument mixes soundfiles based on a score description of the mix.

MKMixerInstrument mixes soundfiles based on a score description of the mix. It allows setting the amplitude scaling of each soundfile and to change that scaling over time by applying an amplitude envelope. It allows resampling (change the pitch of) a file. It also allows you to specify that only a portion of a file be used in the mix. There is no limit to the number of soundfiles that may be mixed together. Also, the same soundfile may be mixed several times and may overlap with itself. The soundfiles may have different sampling rates and different formats. However, the output must be 16 bit linear. The more files you mix, the longer it will take the program to run. Note also that if you mix many large files, you will need a fair degree of swap space--keep some room free on the disk off of which you booted.

MKMixerInstrument is also an illustration of how to make your own MusicKit MKInstrument subclass to "realize MKNotes" in some novel fashion. In this case, MKNotes are soundfile mix specifications. They are "realized" by being mixed into the output file.


Member Function Documentation

- (void) setSamplingRate: (double)  aSrate  

Sets the sampling rate to be used when mixing sounds.

This method should be invoked once before performance is started.

Parameters:
aSrate is a double.

- (void) setChannelCount: (int)  chans  

Sets the number of audio channels to be used when mixing sounds.

This method should be invoked once before performance is started.

Parameters:
chans is an int.

- (Snd *) mixedSound  

Returns the sound that has been mixed.

Returns:
Returns a Snd instance.

- (void) dealloc  

Disconnects, removes, and releases ivars.

If the receiver is in performance, does not release the MKInstrument's MKNoteReceivers.

See also:
- - removeNoteReceivers (MKInstrument):

Reimplemented from MKInstrument.

- (id) firstNote: (MKNote *)  aNote  

You do not normally call this method explictly.

Parameters:
aNote is an MKNote.
Returns:
Returns self. It is invoked when first note is received during performance.

Reimplemented from MKInstrument.

- (BOOL) mixNewNote: (MKNote *)  thisNote  

Internal method to manage the reception of a new note.

This method is not normally called, but may be overloaded by a subclass.

Parameters:
thisNote An MKNote instance.

- (BOOL) mixNoteUpdate: (MKNote *)  thisNote  

Internal method to manage the reception of an update MKNote.

This method is not normally called, but may be overloaded by a subclass.

Parameters:
thisNote An MKNote instance.

- (id) realizeNote: (MKNote *)  aNote
fromNoteReceiver: (MKNoteReceiver *)  aNoteReceiver 

This is invoked when a new MKNote is received during performance to perform the mixing.

Parameters:
aNote is an MKNote.
aNoteReceiver is an MKNoteReceiver. You do not normally call this method explictly. Each note is converted to a common format.

Reimplemented from MKInstrument.

- (id) afterPerformance  

You do not normally call this method explictly.

Returns:
Returns self. It is invoked when performance is over.

Reimplemented from MKInstrument.


Member Data Documentation

- (NSMutableDictionary*) samplesToMix [protected]

Dictionary of MKSamples to mix, keyed by noteTags

- (unsigned int) currentMixFrame [protected]

Index of current output sample.

- (SndFormat) soundFormat [protected]

The format for the final sound, (sample rate, channels, sample format).

- (Snd*) sound [protected]

Output sound

A chain of SndAudioProcessing instances, including fader, applied after mixing all sounds.

- (double) defaultAmplitude [protected]

Default amplitude (set at the start of a MK_noteDur and modified with MK_noteUpdate)

- (double) defaultBearing [protected]

Default bearing in +/- degrees (set at the start of a MK_noteDur and modified with MK_noteUpdate)

- (double) defaultNewFrequency [protected]

Default resampling factor numerator. What the new frequency of the sample is desired to be.

- (double) defaultOriginalFrequency [protected]

Default resampling factor denominator. What the original frequency of the sample is.

- (NSString*) defaultFile [protected]

Default sound file name

- (id) defaultEnvelope [protected]

Default amplitude envelope

- (int) defaultTimeScale [protected]

See README

- (BOOL) currentlyLooping [protected]

Loop the sound if the duration exceeds the sounds length.


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

Generated on Sat Dec 5 17:01:15 2009 for MusicKit by  doxygen 1.5.6