Struct oboe::DefaultStreamValues
source · [−]pub struct DefaultStreamValues(_);
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
sourceimpl 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 RefUnwindSafe for DefaultStreamValues
impl Send for DefaultStreamValues
impl Sync for DefaultStreamValues
impl Unpin for DefaultStreamValues
impl UnwindSafe for DefaultStreamValues
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more