pub struct DefaultStreamValues(/* private fields */);Expand description
The default (optimal) audio streaming values.
On API 16 to 26 OpenSL ES will be used.
When using OpenSL ES the optimal values for sample_rate and
frames_per_burst are not known by the native code.
On API 17+ these values should be obtained from the AudioManager using this code:
// Note that this technique only works for built-in speakers and headphones.
AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
String sampleRateStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);
int defaultSampleRate = Integer.parseInt(sampleRateStr);
String framesPerBurstStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);
int defaultFramesPerBurst = Integer.parseInt(framesPerBurstStr);It can then be passed down to Oboe through JNI.
AAudio will get the optimal frames_per_burst from the HAL and will ignore this value.
Implementations§
Source§impl DefaultStreamValues
impl DefaultStreamValues
Sourcepub fn get_sample_rate() -> i32
pub fn get_sample_rate() -> i32
The default sample rate to use when opening new audio streams
pub fn set_sample_rate(sample_rate: i32)
Sourcepub fn get_frames_per_burst() -> i32
pub fn get_frames_per_burst() -> i32
The default frames per burst to use when opening new audio streams
pub fn set_frames_per_burst(frames_per_burst: i32)
Sourcepub fn get_channel_count() -> i32
pub fn get_channel_count() -> i32
The default channel count to use when opening new audio streams
pub fn set_channel_count(channel_count: i32)
Auto Trait Implementations§
impl Freeze for DefaultStreamValues
impl RefUnwindSafe for DefaultStreamValues
impl Send for DefaultStreamValues
impl Sync for DefaultStreamValues
impl Unpin for DefaultStreamValues
impl UnsafeUnpin for DefaultStreamValues
impl UnwindSafe for DefaultStreamValues
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more