#import <MKMixerInstrument.h>
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 |
Snd * | sound |
SndAudioProcessorChain * | mixedProcessorChain |
double | defaultAmplitude |
double | defaultBearing |
double | defaultNewFrequency |
double | defaultOriginalFrequency |
NSString * | defaultFile |
id | defaultEnvelope |
int | defaultTimeScale |
BOOL | currentlyLooping |
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.
- (void) setSamplingRate: | (double) | aSrate |
Sets the sampling rate to be used when mixing sounds.
This method should be invoked once before performance is started.
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.
chans | is an int. |
- (void) dealloc |
Disconnects, removes, and releases ivars.
If the receiver is in performance, does not release the MKInstrument's MKNoteReceivers.
Reimplemented from MKInstrument.
- (id) firstNote: | (MKNote *) | aNote |
You do not normally call this method explictly.
aNote | is an MKNote. |
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.
thisNote | An MKNote instance. |
- (BOOL) mixNoteUpdate: | (MKNote *) | thisNote |
- (id) realizeNote: | (MKNote *) | aNote | ||
fromNoteReceiver: | (MKNoteReceiver *) | aNoteReceiver | ||
This is invoked when a new MKNote is received during performance to perform the mixing.
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.
Reimplemented from MKInstrument.
- (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).
- (SndAudioProcessorChain*) mixedProcessorChain [protected] |
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.