Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
- (PdAudioStatus)configurePlaybackWithSampleRate:(int)sampleRate
numberChannels:(int)numChannels
inputEnabled:(BOOL)inputEnabled
mixingEnabled:(BOOL)mixingEnabled
ambientEnabled:(BOOL)ambientEnabled {
PdAudioStatus status = PdAudioOK;
if (inputEnabled && ![[AVAudioSession sharedInstance] inputIsAvailable]) {
inputEnabled = NO;
status |= PdAudioPropertyChanged;
}
status |= [self updateSampleRate:sampleRate];
if (status == PdAudioError) {
return PdAudioError;
}
status |= [self selectCategoryWithInputs:inputEnabled isAmbient:ambientEnabled allowsMixing:mixingEnabled];
if (status == PdAudioError) {
return PdAudioError;
}
status |= [self configureAudioUnitWithNumberChannels:numChannels inputEnabled:inputEnabled];
AU_LOGV(@"configuration finished. status: %d", status);
return status;
}
- (PdAudioStatus)configureAmbientWithSampleRate:(int)sampleRate
numberChannels:(int)numChannels
mixingEnabled:(BOOL)mixingEnabled {
PdAudioStatus status = [self updateSampleRate:sampleRate];
if (status == PdAudioError) {
return PdAudioError;
}
status |= [self selectCategoryWithInputs:NO isAmbient:YES allowsMixing:mixingEnabled];
if (status == PdAudioError) {
return PdAudioError;
}
status |= [self configureAudioUnitWithNumberChannels:numChannels inputEnabled:NO];
AU_LOGV(@"configuration finished. status: %d", status);
return status;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.