From df5edb7c88314f8cfd5d10ef7f4c49e75786b1ed Mon Sep 17 00:00:00 2001 From: K Date: Mon, 16 Jan 2023 23:45:43 +0500 Subject: [PATCH 1/7] Fix shared audio stream usage in Rust --- src/audio_stream.rs | 82 +++++++++---------- src/audio_stream_builder.rs | 60 +++++--------- sys/oboe-ext/include/oboe/OboeExt.h | 13 ++- .../src/AudioStreamBuilderWrapper.cpp | 10 +-- sys/oboe-ext/src/AudioStreamWrapper.cpp | 14 +++- 5 files changed, 83 insertions(+), 96 deletions(-) diff --git a/src/audio_stream.rs b/src/audio_stream.rs index bcdfd97..5fea92a 100644 --- a/src/audio_stream.rs +++ b/src/audio_stream.rs @@ -6,7 +6,6 @@ use std::{ marker::PhantomData, mem::{transmute, MaybeUninit}, ops::{Deref, DerefMut}, - ptr::null_mut, }; use super::{ @@ -534,30 +533,43 @@ pub(crate) fn audio_stream_fmt( '\n'.fmt(f) } -struct AudioStreamHandle(*mut ffi::oboe_AudioStream, *mut c_void); +pub(crate) struct AudioStreamHandle(ffi::oboe_AudioStreamShared); -impl AudioStreamHandle { - fn new(raw: *mut ffi::oboe_AudioStream, shared_ptr: *mut c_void) -> Self { - Self(raw, shared_ptr) - } +impl Clone for AudioStreamHandle { + fn clone(&self) -> Self { + // We free to clone shared pointers + let mut new = Self::default(); - /// SAFETY: `self.0` and `self.1` must be valid pointers. - pub(crate) unsafe fn delete(&mut self) { - assert!(!self.0.is_null()); - assert!(!self.1.is_null()); + unsafe { ffi::oboe_AudioStream_cloneShared(&self.0, new.as_mut()) }; + new + } +} + +impl Drop for AudioStreamHandle { + /// SAFETY: `self.0` must be valid pointers. + fn drop(&mut self) { // The error callback could be holding a shared_ptr, so don't delete AudioStream // directly, but only its shared_ptr. - ffi::oboe_AudioStream_deleteShared(self.1); - - self.0 = null_mut(); - self.1 = null_mut(); + unsafe { ffi::oboe_AudioStream_deleteShared(&mut self.0 as *mut _) }; } } impl Default for AudioStreamHandle { fn default() -> Self { - Self(null_mut(), null_mut()) + Self(unsafe { MaybeUninit::zeroed().assume_init() }) + } +} + +impl AsRef for AudioStreamHandle { + fn as_ref(&self) -> &ffi::oboe_AudioStreamShared { + &self.0 + } +} + +impl AsMut for AudioStreamHandle { + fn as_mut(&mut self) -> &mut ffi::oboe_AudioStreamShared { + &mut self.0 } } @@ -565,13 +577,13 @@ impl Deref for AudioStreamHandle { type Target = ffi::oboe_AudioStream; fn deref(&self) -> &Self::Target { - unsafe { &(*self.0) } + unsafe { &(*ffi::oboe_AudioStream_derefShared(&self.0 as *const _)) } } } impl DerefMut for AudioStreamHandle { fn deref_mut(&mut self) -> &mut Self::Target { - unsafe { &mut (*self.0) } + unsafe { &mut (*(ffi::oboe_AudioStream_derefShared(&self.0 as *const _) as *mut _)) } } } @@ -638,13 +650,10 @@ impl fmt::Debug for AudioStreamAsync { } impl AudioStreamAsync { - // SAFETY: `raw` and `shared_ptr` must be valid. - pub(crate) unsafe fn wrap_raw( - raw: *mut ffi::oboe_AudioStream, - shared_ptr: *mut c_void, - ) -> Self { + // SAFETY: `raw` must be valid. + pub(crate) fn wrap_handle(raw: AudioStreamHandle) -> Self { Self { - raw: AudioStreamHandle(raw, shared_ptr), + raw, _phantom: PhantomData, } } @@ -654,20 +663,17 @@ impl Drop for AudioStreamAsync { fn drop(&mut self) { // SAFETY: As long as the conditions on Self::wrap_raw are guaranteed on the creation of // self, this is safe. - unsafe { - let _ = self.close(); - self.raw.delete(); - } + let _ = self.close(); } } impl RawAudioStreamBase for AudioStreamAsync { fn _raw_base(&self) -> &ffi::oboe_AudioStreamBase { - unsafe { &*ffi::oboe_AudioStream_getBase(self.raw.0) } + unsafe { &*ffi::oboe_AudioStream_getBase(&*self.raw as *const _ as *mut _) } } fn _raw_base_mut(&mut self) -> &mut ffi::oboe_AudioStreamBase { - unsafe { &mut *ffi::oboe_AudioStream_getBase(self.raw.0) } + unsafe { &mut *ffi::oboe_AudioStream_getBase(&mut *self.raw as *mut _) } } } @@ -700,13 +706,10 @@ impl fmt::Debug for AudioStreamSync { } impl AudioStreamSync { - // SAFETY: `raw`, `shared_ptr` must be valid, because they will be deleted on drop. - pub(crate) unsafe fn wrap_raw( - raw: *mut ffi::oboe_AudioStream, - shared_ptr: *mut c_void, - ) -> Self { + // SAFETY: `raw` must be valid. + pub(crate) fn wrap_handle(raw: AudioStreamHandle) -> Self { Self { - raw: AudioStreamHandle::new(raw, shared_ptr), + raw, _phantom: PhantomData, } } @@ -716,20 +719,17 @@ impl Drop for AudioStreamSync { fn drop(&mut self) { // SAFETY: As long as the conditions on Self::wrap_raw are guaranteed on the creation of // self, this is safe. - unsafe { - let _ = self.close(); - self.raw.delete(); - } + let _ = self.close(); } } impl RawAudioStreamBase for AudioStreamSync { fn _raw_base(&self) -> &ffi::oboe_AudioStreamBase { - unsafe { &*ffi::oboe_AudioStream_getBase(self.raw.0) } + unsafe { &*ffi::oboe_AudioStream_getBase(&*self.raw as *const _ as *mut _) } } fn _raw_base_mut(&mut self) -> &mut ffi::oboe_AudioStreamBase { - unsafe { &mut *ffi::oboe_AudioStream_getBase(self.raw.0) } + unsafe { &mut *ffi::oboe_AudioStream_getBase(&mut *self.raw as *mut _) } } } diff --git a/src/audio_stream_builder.rs b/src/audio_stream_builder.rs index 28ef734..25891f4 100644 --- a/src/audio_stream_builder.rs +++ b/src/audio_stream_builder.rs @@ -1,10 +1,9 @@ use num_traits::FromPrimitive; use oboe_sys as ffi; use std::{ - ffi::c_void, fmt, marker::PhantomData, - mem::{ManuallyDrop, MaybeUninit}, + mem::ManuallyDrop, ops::{Deref, DerefMut}, }; @@ -12,14 +11,26 @@ use crate::{set_input_callback, set_output_callback}; use super::{ audio_stream_base_fmt, wrap_status, AudioApi, AudioInputCallback, AudioOutputCallback, - AudioStreamAsync, AudioStreamSync, ContentType, Input, InputPreset, IsChannelCount, - IsDirection, IsFormat, IsFrameType, Mono, Output, PerformanceMode, RawAudioStreamBase, Result, - SampleRateConversionQuality, SessionId, SharingMode, Stereo, Unspecified, Usage, + AudioStreamAsync, AudioStreamHandle, AudioStreamSync, ContentType, Input, InputPreset, + IsChannelCount, IsDirection, IsFormat, IsFrameType, Mono, Output, PerformanceMode, + RawAudioStreamBase, Result, SampleRateConversionQuality, SessionId, SharingMode, Stereo, + Unspecified, Usage, }; #[repr(transparent)] pub(crate) struct AudioStreamBuilderHandle(*mut ffi::oboe_AudioStreamBuilder); +impl AudioStreamBuilderHandle { + pub(crate) fn open_stream(&mut self) -> Result { + let mut stream = AudioStreamHandle::default(); + + wrap_status(unsafe { + ffi::oboe_AudioStreamBuilder_openStreamShared(&mut **self, stream.as_mut()) + }) + .map(|_| stream) + } +} + impl Default for AudioStreamBuilderHandle { fn default() -> Self { Self(unsafe { ffi::oboe_AudioStreamBuilder_new() }) @@ -466,20 +477,9 @@ impl AudioStreamBuilder * Create and open a synchronous (blocking) stream based on the current settings. */ pub fn open_stream(self) -> Result> { - let mut stream = MaybeUninit::<*mut ffi::oboe_AudioStream>::uninit(); - let mut shared_ptr = MaybeUninit::<*mut c_void>::uninit(); let mut raw = self.destructs(); - let stream = wrap_status(unsafe { - ffi::oboe_AudioStreamBuilder_openStreamShared( - &mut *raw, - stream.as_mut_ptr(), - shared_ptr.as_mut_ptr(), - ) - }) - .map(|_| unsafe { - AudioStreamSync::wrap_raw(stream.assume_init(), shared_ptr.assume_init()) - }); + let stream = raw.open_stream().map(AudioStreamSync::wrap_handle); drop(raw); @@ -603,20 +603,9 @@ impl AudioStreamBuilderAsync { * Create and open an asynchronous (callback-driven) input stream based on the current settings. */ pub fn open_stream(self) -> Result> { - let mut stream = MaybeUninit::<*mut ffi::oboe_AudioStream>::uninit(); - let mut shared_ptr = MaybeUninit::<*mut c_void>::uninit(); let mut raw = self.destructs(); - let stream = wrap_status(unsafe { - ffi::oboe_AudioStreamBuilder_openStreamShared( - &mut *raw, - stream.as_mut_ptr(), - shared_ptr.as_mut_ptr(), - ) - }) - .map(|_| unsafe { - AudioStreamAsync::wrap_raw(stream.assume_init(), shared_ptr.assume_init()) - }); + let stream = raw.open_stream().map(AudioStreamAsync::wrap_handle); drop(raw); @@ -629,20 +618,9 @@ impl AudioStreamBuilderAsync { * Create and open an asynchronous (callback-driven) output stream based on the current settings. */ pub fn open_stream(self) -> Result> { - let mut stream = MaybeUninit::<*mut ffi::oboe_AudioStream>::uninit(); - let mut shared_ptr = MaybeUninit::<*mut c_void>::uninit(); let mut raw = self.destructs(); - let stream = wrap_status(unsafe { - ffi::oboe_AudioStreamBuilder_openStreamShared( - &mut *raw, - stream.as_mut_ptr(), - shared_ptr.as_mut_ptr(), - ) - }) - .map(|_| unsafe { - AudioStreamAsync::wrap_raw(stream.assume_init(), shared_ptr.assume_init()) - }); + let stream = raw.open_stream().map(AudioStreamAsync::wrap_handle); drop(raw); diff --git a/sys/oboe-ext/include/oboe/OboeExt.h b/sys/oboe-ext/include/oboe/OboeExt.h index e3d8c92..7da09fd 100644 --- a/sys/oboe-ext/include/oboe/OboeExt.h +++ b/sys/oboe-ext/include/oboe/OboeExt.h @@ -4,6 +4,8 @@ #include "oboe/Oboe.h" namespace oboe { + typedef std::shared_ptr AudioStreamShared; + typedef void (*DropContextHandler)(void *context); typedef DataCallbackResult (*AudioReadyHandler)(void *context, @@ -56,12 +58,15 @@ namespace oboe { AudioApi AudioStreamBuilder_getAudioApi(const AudioStreamBuilder *builder); void AudioStreamBuilder_setAudioApi(AudioStreamBuilder *builder, AudioApi api); AudioStreamBase* AudioStreamBuilder_getBase(AudioStreamBuilder *builder); + Result AudioStreamBuilder_openStreamShared(AudioStreamBuilder *builder, - AudioStream **stream, - void **shared_ptr); - + AudioStreamShared *sharedStream); + void AudioStream_delete(AudioStream *oboeStream); - void AudioStream_deleteShared(void *shared_ptr); + void AudioStream_cloneShared(const AudioStreamShared *sharedStream, + AudioStreamShared *newSharedStream); + void AudioStream_deleteShared(AudioStreamShared *sharedStream); + const AudioStream *AudioStream_derefShared(const AudioStreamShared *sharedStream); Result AudioStream_open(AudioStream *oboeStream); Result AudioStream_close(AudioStream *oboeStream); Result AudioStream_requestStart(AudioStream *oboeStream); diff --git a/sys/oboe-ext/src/AudioStreamBuilderWrapper.cpp b/sys/oboe-ext/src/AudioStreamBuilderWrapper.cpp index 40baca9..42f0b90 100644 --- a/sys/oboe-ext/src/AudioStreamBuilderWrapper.cpp +++ b/sys/oboe-ext/src/AudioStreamBuilderWrapper.cpp @@ -48,12 +48,8 @@ namespace oboe { } Result AudioStreamBuilder_openStreamShared(AudioStreamBuilder *builder, - AudioStream **stream, - void **shared_ptr) { - std::shared_ptr *s = new std::shared_ptr(); - Result res = builder->openStream(*s); - *stream = s->get(); - *shared_ptr = (void *)s; - return res; + AudioStreamShared *sharedStream) { + new(sharedStream) std::shared_ptr(); // call constructor on preallocated data buffer + return builder->openStream(*sharedStream); } } diff --git a/sys/oboe-ext/src/AudioStreamWrapper.cpp b/sys/oboe-ext/src/AudioStreamWrapper.cpp index e4e011b..09681ef 100644 --- a/sys/oboe-ext/src/AudioStreamWrapper.cpp +++ b/sys/oboe-ext/src/AudioStreamWrapper.cpp @@ -1,9 +1,17 @@ #include "oboe/OboeExt.h" namespace oboe { - void AudioStream_deleteShared(void *shared_ptr) { - std::shared_ptr *s = (std::shared_ptr *)shared_ptr; - delete s; + void AudioStream_cloneShared(const AudioStreamShared *sharedStream, + AudioStreamShared *newSharedStream) { + *newSharedStream = *sharedStream; // initialize with copy constructor + } + + void AudioStream_deleteShared(AudioStreamShared *sharedStream) { + sharedStream->~shared_ptr(); // call destructor directly + } + + const AudioStream *AudioStream_derefShared(const AudioStreamShared *sharedStream) { + return sharedStream->get(); } Result AudioStream_open(AudioStream *oboeStream) { From 908ac8207a7dca3470c2d640fc86c3dd63d45735 Mon Sep 17 00:00:00 2001 From: K Date: Mon, 16 Jan 2023 23:47:52 +0500 Subject: [PATCH 2/7] Update dependencies --- Cargo.toml | 2 +- src/java_interface/devices_info.rs | 2 +- src/java_interface/utils.rs | 7 ++++--- sys/Cargo.toml | 2 +- sys/build.rs | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f87642e..bba3657 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ version = "0.1" optional = true [dependencies.jni] -version = "0.19" +version = "0.20" optional = true [features] diff --git a/src/java_interface/devices_info.rs b/src/java_interface/devices_info.rs index 162336c..7aed1a6 100644 --- a/src/java_interface/devices_info.rs +++ b/src/java_interface/devices_info.rs @@ -47,7 +47,7 @@ fn try_request_devices_info<'a>( let devices = env.auto_local(get_devices(env, audio_manager, direction as i32)?); - let raw_devices = devices.as_obj().into_inner(); + let raw_devices = devices.as_obj().into_raw(); let length = env.get_array_length(raw_devices)?; diff --git a/src/java_interface/utils.rs b/src/java_interface/utils.rs index 16411fb..97b0600 100644 --- a/src/java_interface/utils.rs +++ b/src/java_interface/utils.rs @@ -22,8 +22,9 @@ where F: FnOnce(&JNIEnv, JObject) -> JResult, { let vm = Arc::new(unsafe { JavaVM::from_raw(context.vm().cast())? }); - let context = context.context() as jobject; - Executor::new(vm).with_attached(|env| closure(env, context.into())) + let context = context.context(); + let context = unsafe { JObject::from_raw(context as jobject) }; + Executor::new(vm).with_attached(|env| closure(env, context)) } pub fn call_method_no_args_ret_int_array<'a>( @@ -33,7 +34,7 @@ pub fn call_method_no_args_ret_int_array<'a>( ) -> JResult> { let array = env.auto_local(env.call_method(subject, method, "()[I", &[])?.l()?); - let raw_array = array.as_obj().into_inner(); + let raw_array = array.as_obj().into_raw(); let length = env.get_array_length(raw_array)?; let mut values = Vec::with_capacity(length as usize); diff --git a/sys/Cargo.toml b/sys/Cargo.toml index a21ef89..d6e6bfc 100644 --- a/sys/Cargo.toml +++ b/sys/Cargo.toml @@ -23,7 +23,7 @@ version = "1.0" features = ["parallel"] [build-dependencies.bindgen] -version = "0.60" +version = "0.63" optional = true [features] diff --git a/sys/build.rs b/sys/build.rs index c26f08d..9d21f3d 100644 --- a/sys/build.rs +++ b/sys/build.rs @@ -25,7 +25,7 @@ fn main() { target, profile, "https://github.com/katyo/{package}-rs/releases/download/{version}/lib{package}-ext_{target}_{profile}.tar.gz", - &out_dir, + out_dir, src_dir, ext_dir, ); From 9ffc5300edf048ff93d229789c2257ab7293da33 Mon Sep 17 00:00:00 2001 From: K Date: Mon, 16 Jan 2023 23:48:07 +0500 Subject: [PATCH 3/7] Update bindings --- sys/src/bindings_aarch64.rs | 1188 +++++++++++----------------------- sys/src/bindings_armv7.rs | 1194 +++++++++++------------------------ sys/src/bindings_i686.rs | 1194 +++++++++++------------------------ sys/src/bindings_x86_64.rs | 1194 +++++++++++------------------------ 4 files changed, 1535 insertions(+), 3235 deletions(-) diff --git a/sys/src/bindings_aarch64.rs b/sys/src/bindings_aarch64.rs index 5956176..eedbf42 100644 --- a/sys/src/bindings_aarch64.rs +++ b/sys/src/bindings_aarch64.rs @@ -1,11 +1,6 @@ -/* automatically generated by rust-bindgen 0.60.1 */ +/* automatically generated by rust-bindgen 0.63.0 */ pub type std_string = [u64; 3usize]; -pub type __uint8_t = ::std::os::raw::c_uchar; -pub type __uint16_t = ::std::os::raw::c_ushort; -pub type __int32_t = ::std::os::raw::c_int; -pub type __uint32_t = ::std::os::raw::c_uint; -pub type __int64_t = ::std::os::raw::c_long; pub const oboe_StreamState_Uninitialized: oboe_StreamState = 0; pub const oboe_StreamState_Unknown: oboe_StreamState = 1; pub const oboe_StreamState_Open: oboe_StreamState = 2; @@ -34,27 +29,11 @@ pub const oboe_AudioFormat_Invalid: oboe_AudioFormat = -1; pub const oboe_AudioFormat_Unspecified: oboe_AudioFormat = 0; #[doc = " Signed 16-bit integers."] pub const oboe_AudioFormat_I16: oboe_AudioFormat = 1; -#[doc = " Single precision floating point."] -#[doc = ""] -#[doc = " This is the recommended format for most applications."] -#[doc = " But note that the use of Float may prevent the opening of"] -#[doc = " a low-latency input path on OpenSL ES or Legacy AAudio streams."] +#[doc = " Single precision floating point.\n\n This is the recommended format for most applications.\n But note that the use of Float may prevent the opening of\n a low-latency input path on OpenSL ES or Legacy AAudio streams."] pub const oboe_AudioFormat_Float: oboe_AudioFormat = 2; -#[doc = " Signed 24-bit integers, packed into 3 bytes."] -#[doc = ""] -#[doc = " Note that the use of this format does not guarantee that"] -#[doc = " the full precision will be provided. The underlying device may"] -#[doc = " be using I16 format."] -#[doc = ""] -#[doc = " Added in API 31 (S)."] +#[doc = " Signed 24-bit integers, packed into 3 bytes.\n\n Note that the use of this format does not guarantee that\n the full precision will be provided. The underlying device may\n be using I16 format.\n\n Added in API 31 (S)."] pub const oboe_AudioFormat_I24: oboe_AudioFormat = 3; -#[doc = " Signed 32-bit integers."] -#[doc = ""] -#[doc = " Note that the use of this format does not guarantee that"] -#[doc = " the full precision will be provided. The underlying device may"] -#[doc = " be using I16 format."] -#[doc = ""] -#[doc = " Added in API 31 (S)."] +#[doc = " Signed 32-bit integers.\n\n Note that the use of this format does not guarantee that\n the full precision will be provided. The underlying device may\n be using I16 format.\n\n Added in API 31 (S)."] pub const oboe_AudioFormat_I32: oboe_AudioFormat = 4; #[doc = " The format of audio samples."] pub type oboe_AudioFormat = i32; @@ -91,21 +70,11 @@ pub const oboe_Result_Reserved8: oboe_Result = -872; pub const oboe_Result_Reserved9: oboe_Result = -871; pub const oboe_Result_Reserved10: oboe_Result = -870; pub const oboe_Result_ErrorClosed: oboe_Result = -869; -#[doc = " The result of an operation. All except the `OK` result indicates that an error occurred."] -#[doc = " The `Result` can be converted into a human readable string using `convertToText`."] +#[doc = " The result of an operation. All except the `OK` result indicates that an error occurred.\n The `Result` can be converted into a human readable string using `convertToText`."] pub type oboe_Result = i32; -#[doc = " This will be the only stream using a particular source or sink."] -#[doc = " This mode will provide the lowest possible latency."] -#[doc = " You should close EXCLUSIVE streams immediately when you are not using them."] -#[doc = ""] -#[doc = " If you do not need the lowest possible latency then we recommend using Shared,"] -#[doc = " which is the default."] +#[doc = " This will be the only stream using a particular source or sink.\n This mode will provide the lowest possible latency.\n You should close EXCLUSIVE streams immediately when you are not using them.\n\n If you do not need the lowest possible latency then we recommend using Shared,\n which is the default."] pub const oboe_SharingMode_Exclusive: oboe_SharingMode = 0; -#[doc = " Multiple applications can share the same device."] -#[doc = " The data from output streams will be mixed by the audio service."] -#[doc = " The data for input streams will be distributed by the audio service."] -#[doc = ""] -#[doc = " This will have higher latency than the EXCLUSIVE mode."] +#[doc = " Multiple applications can share the same device.\n The data from output streams will be mixed by the audio service.\n The data for input streams will be distributed by the audio service.\n\n This will have higher latency than the EXCLUSIVE mode."] pub const oboe_SharingMode_Shared: oboe_SharingMode = 1; #[doc = " The sharing mode of the audio stream."] pub type oboe_SharingMode = i32; @@ -119,19 +88,15 @@ pub const oboe_PerformanceMode_LowLatency: oboe_PerformanceMode = 12; pub type oboe_PerformanceMode = i32; #[doc = " Try to use AAudio. If not available then use OpenSL ES."] pub const oboe_AudioApi_Unspecified: oboe_AudioApi = 0; -#[doc = " Use OpenSL ES."] -#[doc = " Note that OpenSL ES is deprecated in Android 13, API 30 and above."] +#[doc = " Use OpenSL ES.\n Note that OpenSL ES is deprecated in Android 13, API 30 and above."] pub const oboe_AudioApi_OpenSLES: oboe_AudioApi = 1; -#[doc = " Try to use AAudio. Fail if unavailable."] -#[doc = " AAudio was first supported in Android 8, API 26 and above."] -#[doc = " It is only recommended for API 27 and above."] +#[doc = " Try to use AAudio. Fail if unavailable.\n AAudio was first supported in Android 8, API 26 and above.\n It is only recommended for API 27 and above."] pub const oboe_AudioApi_AAudio: oboe_AudioApi = 2; #[doc = " The underlying audio API used by the audio stream."] pub type oboe_AudioApi = i32; #[doc = " No conversion by Oboe. Underlying APIs may still do conversion."] pub const oboe_SampleRateConversionQuality_None: oboe_SampleRateConversionQuality = 0; -#[doc = " Fastest conversion but may not sound great."] -#[doc = " This may be implemented using bilinear interpolation."] +#[doc = " Fastest conversion but may not sound great.\n This may be implemented using bilinear interpolation."] pub const oboe_SampleRateConversionQuality_Fastest: oboe_SampleRateConversionQuality = 1; #[doc = " Low quality conversion with 8 taps."] pub const oboe_SampleRateConversionQuality_Low: oboe_SampleRateConversionQuality = 2; @@ -141,9 +106,7 @@ pub const oboe_SampleRateConversionQuality_Medium: oboe_SampleRateConversionQual pub const oboe_SampleRateConversionQuality_High: oboe_SampleRateConversionQuality = 4; #[doc = " Highest quality conversion, which may be expensive in terms of CPU."] pub const oboe_SampleRateConversionQuality_Best: oboe_SampleRateConversionQuality = 5; -#[doc = " Specifies the quality of the sample rate conversion performed by Oboe."] -#[doc = " Higher quality will require more CPU load."] -#[doc = " Higher quality conversion will probably be implemented using a sinc based resampler."] +#[doc = " Specifies the quality of the sample rate conversion performed by Oboe.\n Higher quality will require more CPU load.\n Higher quality conversion will probably be implemented using a sinc based resampler."] pub type oboe_SampleRateConversionQuality = i32; #[doc = " Use this for streaming media, music performance, video, podcasts, etcetera."] pub const oboe_Usage_Media: oboe_Usage = 1; @@ -153,8 +116,7 @@ pub const oboe_Usage_VoiceCommunication: oboe_Usage = 2; pub const oboe_Usage_VoiceCommunicationSignalling: oboe_Usage = 3; #[doc = " Use this to demand the users attention."] pub const oboe_Usage_Alarm: oboe_Usage = 4; -#[doc = " Use this for notifying the user when a message has arrived or some"] -#[doc = " other background event has occured."] +#[doc = " Use this for notifying the user when a message has arrived or some\n other background event has occured."] pub const oboe_Usage_Notification: oboe_Usage = 5; #[doc = " Use this when the phone rings."] pub const oboe_Usage_NotificationRingtone: oboe_Usage = 6; @@ -170,13 +132,7 @@ pub const oboe_Usage_AssistanceSonification: oboe_Usage = 13; pub const oboe_Usage_Game: oboe_Usage = 14; #[doc = " Use this for audio responses to user queries, audio instructions or help utterances."] pub const oboe_Usage_Assistant: oboe_Usage = 16; -#[doc = " The Usage attribute expresses *why* you are playing a sound, what is this sound used for."] -#[doc = " This information is used by certain platforms or routing policies"] -#[doc = " to make more refined volume or routing decisions."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in AudioAttributes in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " The Usage attribute expresses *why* you are playing a sound, what is this sound used for.\n This information is used by certain platforms or routing policies\n to make more refined volume or routing decisions.\n\n Note that these match the equivalent values in AudioAttributes in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_Usage = i32; #[doc = " Use this for spoken voice, audio books, etcetera."] pub const oboe_ContentType_Speech: oboe_ContentType = 1; @@ -184,19 +140,9 @@ pub const oboe_ContentType_Speech: oboe_ContentType = 1; pub const oboe_ContentType_Music: oboe_ContentType = 2; #[doc = " Use this for a movie or video soundtrack."] pub const oboe_ContentType_Movie: oboe_ContentType = 3; -#[doc = " Use this for sound is designed to accompany a user action,"] -#[doc = " such as a click or beep sound made when the user presses a button."] +#[doc = " Use this for sound is designed to accompany a user action,\n such as a click or beep sound made when the user presses a button."] pub const oboe_ContentType_Sonification: oboe_ContentType = 4; -#[doc = " The ContentType attribute describes *what* you are playing."] -#[doc = " It expresses the general category of the content. This information is optional."] -#[doc = " But in case it is known (for instance {@link Movie} for a"] -#[doc = " movie streaming service or {@link Speech} for"] -#[doc = " an audio book application) this information might be used by the audio framework to"] -#[doc = " enforce audio focus."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in AudioAttributes in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " The ContentType attribute describes *what* you are playing.\n It expresses the general category of the content. This information is optional.\n But in case it is known (for instance {@link Movie} for a\n movie streaming service or {@link Speech} for\n an audio book application) this information might be used by the audio framework to\n enforce audio focus.\n\n Note that these match the equivalent values in AudioAttributes in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_ContentType = i32; #[doc = " Use this preset when other presets do not apply."] pub const oboe_InputPreset_Generic: oboe_InputPreset = 1; @@ -206,35 +152,17 @@ pub const oboe_InputPreset_Camcorder: oboe_InputPreset = 5; pub const oboe_InputPreset_VoiceRecognition: oboe_InputPreset = 6; #[doc = " Use this preset when doing telephony or voice messaging."] pub const oboe_InputPreset_VoiceCommunication: oboe_InputPreset = 7; -#[doc = " Use this preset to obtain an input with no effects."] -#[doc = " Note that this input will not have automatic gain control"] -#[doc = " so the recorded volume may be very low."] +#[doc = " Use this preset to obtain an input with no effects.\n Note that this input will not have automatic gain control\n so the recorded volume may be very low."] pub const oboe_InputPreset_Unprocessed: oboe_InputPreset = 9; -#[doc = " Use this preset for capturing audio meant to be processed in real time"] -#[doc = " and played back for live performance (e.g karaoke)."] -#[doc = " The capture path will minimize latency and coupling with playback path."] +#[doc = " Use this preset for capturing audio meant to be processed in real time\n and played back for live performance (e.g karaoke).\n The capture path will minimize latency and coupling with playback path."] pub const oboe_InputPreset_VoicePerformance: oboe_InputPreset = 10; -#[doc = " Defines the audio source."] -#[doc = " An audio source defines both a default physical source of audio signal, and a recording"] -#[doc = " configuration."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " Defines the audio source.\n An audio source defines both a default physical source of audio signal, and a recording\n configuration.\n\n Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_InputPreset = i32; -#[doc = " Do not allocate a session ID."] -#[doc = " Effects cannot be used with this stream."] -#[doc = " Default."] +#[doc = " Do not allocate a session ID.\n Effects cannot be used with this stream.\n Default."] pub const oboe_SessionId_None: oboe_SessionId = -1; -#[doc = " Allocate a session ID that can be used to attach and control"] -#[doc = " effects using the Java AudioEffects API."] -#[doc = " Note that the use of this flag may result in higher latency."] -#[doc = ""] -#[doc = " Note that this matches the value of AudioManager.AUDIO_SESSION_ID_GENERATE."] +#[doc = " Allocate a session ID that can be used to attach and control\n effects using the Java AudioEffects API.\n Note that the use of this flag may result in higher latency.\n\n Note that this matches the value of AudioManager.AUDIO_SESSION_ID_GENERATE."] pub const oboe_SessionId_Allocate: oboe_SessionId = 0; -#[doc = " This attribute can be used to allocate a session ID to the audio stream."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " This attribute can be used to allocate a session ID to the audio stream.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_SessionId = ::std::os::raw::c_int; #[doc = " Audio channel count definition, use Mono or Stereo"] pub const oboe_ChannelCount_Unspecified: oboe_ChannelCount = 0; @@ -242,14 +170,7 @@ pub const oboe_ChannelCount_Unspecified: oboe_ChannelCount = 0; pub const oboe_ChannelCount_Mono: oboe_ChannelCount = 1; #[doc = " Use this for stereo audio."] pub const oboe_ChannelCount_Stereo: oboe_ChannelCount = 2; -#[doc = " The channel count of the audio stream. The underlying type is `int32_t`."] -#[doc = " Use of this enum is convenient to avoid \"magic\""] -#[doc = " numbers when specifying the channel count."] -#[doc = ""] -#[doc = " For example, you can write"] -#[doc = " `builder.setChannelCount(ChannelCount::Stereo)`"] -#[doc = " rather than `builder.setChannelCount(2)`"] -#[doc = ""] +#[doc = " The channel count of the audio stream. The underlying type is `int32_t`.\n Use of this enum is convenient to avoid \"magic\"\n numbers when specifying the channel count.\n\n For example, you can write\n `builder.setChannelCount(ChannelCount::Stereo)`\n rather than `builder.setChannelCount(2)`\n"] pub type oboe_ChannelCount = i32; pub const oboe_ChannelMask_Unspecified: oboe_ChannelMask = 0; pub const oboe_ChannelMask_FrontLeft: oboe_ChannelMask = 1; @@ -303,30 +224,9 @@ pub const oboe_ChannelMask_CM7Point1Point4: oboe_ChannelMask = 185919; pub const oboe_ChannelMask_CM9Point1Point4: oboe_ChannelMask = 50517567; pub const oboe_ChannelMask_CM9Point1Point6: oboe_ChannelMask = 51303999; pub const oboe_ChannelMask_FrontBack: oboe_ChannelMask = 260; -#[doc = " The channel mask of the audio stream. The underlying type is `uint32_t`."] -#[doc = " Use of this enum is convenient."] -#[doc = ""] -#[doc = " ChannelMask::Unspecified means this is not specified."] -#[doc = " The rest of the enums are channel position masks."] -#[doc = " Use the combinations of the channel position masks defined below instead of"] -#[doc = " using those values directly."] +#[doc = " The channel mask of the audio stream. The underlying type is `uint32_t`.\n Use of this enum is convenient.\n\n ChannelMask::Unspecified means this is not specified.\n The rest of the enums are channel position masks.\n Use the combinations of the channel position masks defined below instead of\n using those values directly."] pub type oboe_ChannelMask = u32; -#[doc = " On API 16 to 26 OpenSL ES will be used. When using OpenSL ES the optimal values for sampleRate and"] -#[doc = " framesPerBurst are not known by the native code."] -#[doc = " On API 17+ these values should be obtained from the AudioManager using this code:"] -#[doc = ""] -#[doc = "
"]
-#[doc = " // Note that this technique only works for built-in speakers and headphones."]
-#[doc = " AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);"]
-#[doc = " String sampleRateStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);"]
-#[doc = " int defaultSampleRate = Integer.parseInt(sampleRateStr);"]
-#[doc = " String framesPerBurstStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);"]
-#[doc = " int defaultFramesPerBurst = Integer.parseInt(framesPerBurstStr);"]
-#[doc = " 
"] -#[doc = ""] -#[doc = " It can then be passed down to Oboe through JNI."] -#[doc = ""] -#[doc = " AAudio will get the optimal framesPerBurst from the HAL and will ignore this value."] +#[doc = " On API 16 to 26 OpenSL ES will be used. When using OpenSL ES the optimal values for sampleRate and\n framesPerBurst are not known by the native code.\n On API 17+ these values should be obtained from the AudioManager using this code:\n\n
\n // Note that this technique only works for built-in speakers and headphones.\n AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);\n String sampleRateStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);\n int defaultSampleRate = Integer.parseInt(sampleRateStr);\n String framesPerBurstStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);\n int defaultFramesPerBurst = Integer.parseInt(framesPerBurstStr);\n 
\n\n It can then be passed down to Oboe through JNI.\n\n AAudio will get the optimal framesPerBurst from the HAL and will ignore this value."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_DefaultStreamValues { @@ -369,6 +269,8 @@ pub struct oboe_FrameTimestamp { } #[test] fn bindgen_test_layout_oboe_FrameTimestamp() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, @@ -379,59 +281,28 @@ fn bindgen_test_layout_oboe_FrameTimestamp() { 8usize, concat!("Alignment of ", stringify!(oboe_FrameTimestamp)) ); - fn test_field_position() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).position) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(oboe_FrameTimestamp), - "::", - stringify!(position) - ) - ); - } - test_field_position(); - fn test_field_timestamp() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(oboe_FrameTimestamp), - "::", - stringify!(timestamp) - ) - ); - } - test_field_timestamp(); -} -#[doc = " A ResultWithValue can store both the result of an operation (either OK or an error) and a value."] -#[doc = ""] -#[doc = " It has been designed for cases where the caller needs to know whether an operation succeeded and,"] -#[doc = " if it did, a value which was obtained during the operation."] -#[doc = ""] -#[doc = " For example, when reading from a stream the caller needs to know the result of the read operation"] -#[doc = " and, if it was successful, how many frames were read. Note that ResultWithValue can be evaluated"] -#[doc = " as a boolean so it's simple to check whether the result is OK."] -#[doc = ""] -#[doc = " "] -#[doc = " ResultWithValue resultOfRead = myStream.read(&buffer, numFrames, timeoutNanoseconds);"] -#[doc = ""] -#[doc = " if (resultOfRead) {"] -#[doc = " LOGD(\"Frames read: %d\", resultOfRead.value());"] -#[doc = " } else {"] -#[doc = " LOGD(\"Error reading from stream: %s\", resultOfRead.error());"] -#[doc = " }"] -#[doc = " "] + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).position) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(oboe_FrameTimestamp), + "::", + stringify!(position) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(oboe_FrameTimestamp), + "::", + stringify!(timestamp) + ) + ); +} +#[doc = " A ResultWithValue can store both the result of an operation (either OK or an error) and a value.\n\n It has been designed for cases where the caller needs to know whether an operation succeeded and,\n if it did, a value which was obtained during the operation.\n\n For example, when reading from a stream the caller needs to know the result of the read operation\n and, if it was successful, how many frames were read. Note that ResultWithValue can be evaluated\n as a boolean so it's simple to check whether the result is OK.\n\n \n ResultWithValue resultOfRead = myStream.read(&buffer, numFrames, timeoutNanoseconds);\n\n if (resultOfRead) {\n LOGD(\"Frames read: %d\", resultOfRead.value());\n } else {\n LOGD(\"Error reading from stream: %s\", resultOfRead.error());\n }\n "] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_ResultWithValue { @@ -441,11 +312,7 @@ pub struct oboe_ResultWithValue { } #[repr(C)] pub struct oboe_AudioStreamDataCallback__bindgen_vtable(::std::os::raw::c_void); -#[doc = " AudioStreamDataCallback defines a callback interface for"] -#[doc = " moving data to/from an audio stream using `onAudioReady`"] -#[doc = " 2) being alerted when a stream has an error using `onError*` methods"] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setDataCallback()."] +#[doc = " AudioStreamDataCallback defines a callback interface for\n moving data to/from an audio stream using `onAudioReady`\n 2) being alerted when a stream has an error using `onError*` methods\n\n It is used with AudioStreamBuilder::setDataCallback()."] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamDataCallback { @@ -466,15 +333,7 @@ fn bindgen_test_layout_oboe_AudioStreamDataCallback() { } #[repr(C)] pub struct oboe_AudioStreamErrorCallback__bindgen_vtable(::std::os::raw::c_void); -#[doc = " AudioStreamErrorCallback defines a callback interface for"] -#[doc = " being alerted when a stream has an error or is disconnected"] -#[doc = " using `onError*` methods."] -#[doc = ""] -#[doc = " Note: This callback is only fired when an AudioStreamCallback is set."] -#[doc = " If you use AudioStream::write() you have to evaluate the return codes of"] -#[doc = " AudioStream::write() to notice errors in the stream."] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setErrorCallback()."] +#[doc = " AudioStreamErrorCallback defines a callback interface for\n being alerted when a stream has an error or is disconnected\n using `onError*` methods.\n\n Note: This callback is only fired when an AudioStreamCallback is set.\n If you use AudioStream::write() you have to evaluate the return codes of\n AudioStream::write() to notice errors in the stream.\n\n It is used with AudioStreamBuilder::setErrorCallback()."] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamErrorCallback { @@ -493,18 +352,7 @@ fn bindgen_test_layout_oboe_AudioStreamErrorCallback() { concat!("Alignment of ", stringify!(oboe_AudioStreamErrorCallback)) ); } -#[doc = " AudioStreamCallback defines a callback interface for:"] -#[doc = ""] -#[doc = " 1) moving data to/from an audio stream using `onAudioReady`"] -#[doc = " 2) being alerted when a stream has an error using `onError*` methods"] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setCallback()."] -#[doc = ""] -#[doc = " It combines the interfaces defined by AudioStreamDataCallback and AudioStreamErrorCallback."] -#[doc = " This was the original callback object. We now recommend using the individual interfaces"] -#[doc = " and using setDataCallback() and setErrorCallback()."] -#[doc = ""] -#[doc = " @deprecated Use `AudioStreamDataCallback` and `AudioStreamErrorCallback` instead"] +#[doc = " AudioStreamCallback defines a callback interface for:\n\n 1) moving data to/from an audio stream using `onAudioReady`\n 2) being alerted when a stream has an error using `onError*` methods\n\n It is used with AudioStreamBuilder::setCallback().\n\n It combines the interfaces defined by AudioStreamDataCallback and AudioStreamErrorCallback.\n This was the original callback object. We now recommend using the individual interfaces\n and using setDataCallback() and setErrorCallback().\n\n @deprecated Use `AudioStreamDataCallback` and `AudioStreamErrorCallback` instead"] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamCallback { @@ -562,8 +410,7 @@ pub struct oboe_AudioStreamBase { pub mUsage: oboe_Usage, #[doc = " Stream content type. Only active on Android 28+"] pub mContentType: oboe_ContentType, - #[doc = " Stream input preset. Only active on Android 28+"] - #[doc = " TODO InputPreset::Unspecified should be considered as a possible default alternative."] + #[doc = " Stream input preset. Only active on Android 28+\n TODO InputPreset::Unspecified should be considered as a possible default alternative."] pub mInputPreset: oboe_InputPreset, #[doc = " Stream session ID allocation strategy. Only active on Android 28+"] pub mSessionId: oboe_SessionId, @@ -577,6 +424,8 @@ pub struct oboe_AudioStreamBase { } #[test] fn bindgen_test_layout_oboe_AudioStreamBase() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 176usize, @@ -587,422 +436,251 @@ fn bindgen_test_layout_oboe_AudioStreamBase() { 8usize, concat!("Alignment of ", stringify!(oboe_AudioStreamBase)) ); - fn test_field_mDataCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDataCallback) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDataCallback) - ) - ); - } - test_field_mDataCallback(); - fn test_field_mSharedDataCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharedDataCallback) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharedDataCallback) - ) - ); - } - test_field_mSharedDataCallback(); - fn test_field_mErrorCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mErrorCallback) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mErrorCallback) - ) - ); - } - test_field_mErrorCallback(); - fn test_field_mSharedErrorCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharedErrorCallback) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharedErrorCallback) - ) - ); - } - test_field_mSharedErrorCallback(); - fn test_field_mFramesPerCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFramesPerCallback) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFramesPerCallback) - ) - ); - } - test_field_mFramesPerCallback(); - fn test_field_mChannelCount() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelCount) as usize - ptr as usize - }, - 60usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelCount) - ) - ); - } - test_field_mChannelCount(); - fn test_field_mSampleRate() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSampleRate) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSampleRate) - ) - ); - } - test_field_mSampleRate(); - fn test_field_mDeviceId() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDeviceId) as usize - ptr as usize - }, - 68usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDeviceId) - ) - ); - } - test_field_mDeviceId(); - fn test_field_mBufferCapacityInFrames() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBufferCapacityInFrames) as usize - ptr as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mBufferCapacityInFrames) - ) - ); - } - test_field_mBufferCapacityInFrames(); - fn test_field_mBufferSizeInFrames() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBufferSizeInFrames) as usize - ptr as usize - }, - 76usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mBufferSizeInFrames) - ) - ); - } - test_field_mBufferSizeInFrames(); - fn test_field_mChannelMask() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelMask) as usize - ptr as usize - }, - 80usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelMask) - ) - ); - } - test_field_mChannelMask(); - fn test_field_mSharingMode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharingMode) as usize - ptr as usize - }, - 84usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharingMode) - ) - ); - } - test_field_mSharingMode(); - fn test_field_mFormat() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFormat) as usize - ptr as usize - }, - 88usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFormat) - ) - ); - } - test_field_mFormat(); - fn test_field_mDirection() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDirection) as usize - ptr as usize - }, - 92usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDirection) - ) - ); - } - test_field_mDirection(); - fn test_field_mPerformanceMode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mPerformanceMode) as usize - ptr as usize - }, - 96usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mPerformanceMode) - ) - ); - } - test_field_mPerformanceMode(); - fn test_field_mUsage() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mUsage) as usize - ptr as usize - }, - 100usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mUsage) - ) - ); - } - test_field_mUsage(); - fn test_field_mContentType() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mContentType) as usize - ptr as usize - }, - 104usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mContentType) - ) - ); - } - test_field_mContentType(); - fn test_field_mInputPreset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mInputPreset) as usize - ptr as usize - }, - 108usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mInputPreset) - ) - ); - } - test_field_mInputPreset(); - fn test_field_mSessionId() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSessionId) as usize - ptr as usize - }, - 112usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSessionId) - ) - ); - } - test_field_mSessionId(); - fn test_field_mPackageName() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mPackageName) as usize - ptr as usize - }, - 120usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mPackageName) - ) - ); - } - test_field_mPackageName(); - fn test_field_mAttributionTag() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mAttributionTag) as usize - ptr as usize - }, - 144usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mAttributionTag) - ) - ); - } - test_field_mAttributionTag(); - fn test_field_mChannelConversionAllowed() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelConversionAllowed) as usize - ptr as usize - }, - 168usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelConversionAllowed) - ) - ); - } - test_field_mChannelConversionAllowed(); - fn test_field_mFormatConversionAllowed() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFormatConversionAllowed) as usize - ptr as usize - }, - 169usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFormatConversionAllowed) - ) - ); - } - test_field_mFormatConversionAllowed(); - fn test_field_mSampleRateConversionQuality() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSampleRateConversionQuality) as usize - ptr as usize - }, - 172usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSampleRateConversionQuality) - ) - ); - } - test_field_mSampleRateConversionQuality(); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDataCallback) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDataCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharedDataCallback) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharedDataCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mErrorCallback) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mErrorCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharedErrorCallback) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharedErrorCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFramesPerCallback) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFramesPerCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelCount) as usize - ptr as usize }, + 60usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSampleRate) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSampleRate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDeviceId) as usize - ptr as usize }, + 68usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDeviceId) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mBufferCapacityInFrames) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mBufferCapacityInFrames) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mBufferSizeInFrames) as usize - ptr as usize }, + 76usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mBufferSizeInFrames) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelMask) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelMask) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharingMode) as usize - ptr as usize }, + 84usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharingMode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFormat) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFormat) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDirection) as usize - ptr as usize }, + 92usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDirection) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mPerformanceMode) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mPerformanceMode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mUsage) as usize - ptr as usize }, + 100usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mUsage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mContentType) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mContentType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mInputPreset) as usize - ptr as usize }, + 108usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mInputPreset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSessionId) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSessionId) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mPackageName) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mPackageName) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mAttributionTag) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mAttributionTag) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelConversionAllowed) as usize - ptr as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelConversionAllowed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFormatConversionAllowed) as usize - ptr as usize }, + 169usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFormatConversionAllowed) + ) + ); + assert_eq!( + unsafe { + ::std::ptr::addr_of!((*ptr).mSampleRateConversionQuality) as usize - ptr as usize + }, + 172usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSampleRateConversionQuality) + ) + ); } extern "C" { - #[doc = " Return the version of the SDK that is currently running."] - #[doc = ""] - #[doc = " For example, on Android, this would return 27 for Oreo 8.1."] - #[doc = " If the version number cannot be determined then this will return -1."] - #[doc = ""] - #[doc = " @return version number or -1"] + #[doc = " Return the version of the SDK that is currently running.\n\n For example, on Android, this would return 27 for Oreo 8.1.\n If the version number cannot be determined then this will return -1.\n\n @return version number or -1"] #[link_name = "\u{1}_ZN4oboe13getSdkVersionEv"] pub fn oboe_getSdkVersion() -> ::std::os::raw::c_int; } @@ -1027,21 +705,12 @@ fn bindgen_test_layout_oboe_AudioStreamBuilder() { ); } extern "C" { - #[doc = " Is the AAudio API supported on this device?"] - #[doc = ""] - #[doc = " AAudio was introduced in the Oreo 8.0 release."] - #[doc = ""] - #[doc = " @return true if supported"] + #[doc = " Is the AAudio API supported on this device?\n\n AAudio was introduced in the Oreo 8.0 release.\n\n @return true if supported"] #[link_name = "\u{1}_ZN4oboe18AudioStreamBuilder17isAAudioSupportedEv"] pub fn oboe_AudioStreamBuilder_isAAudioSupported() -> bool; } extern "C" { - #[doc = " Is the AAudio API recommended this device?"] - #[doc = ""] - #[doc = " AAudio may be supported but not recommended because of version specific issues."] - #[doc = " AAudio is not recommended for Android 8.0 or earlier versions."] - #[doc = ""] - #[doc = " @return true if recommended"] + #[doc = " Is the AAudio API recommended this device?\n\n AAudio may be supported but not recommended because of version specific issues.\n AAudio is not recommended for Android 8.0 or earlier versions.\n\n @return true if recommended"] #[link_name = "\u{1}_ZN4oboe18AudioStreamBuilder19isAAudioRecommendedEv"] pub fn oboe_AudioStreamBuilder_isAAudioRecommended() -> bool; } @@ -1075,10 +744,7 @@ fn bindgen_test_layout_oboe_AudioStream() { ); } extern "C" { - #[doc = " Get the number of bytes per sample. This is calculated using the sample format. For example,"] - #[doc = " a stream using 16-bit integer samples will have 2 bytes per sample."] - #[doc = ""] - #[doc = " @return the number of bytes per sample."] + #[doc = " Get the number of bytes per sample. This is calculated using the sample format. For example,\n a stream using 16-bit integer samples will have 2 bytes per sample.\n\n @return the number of bytes per sample."] #[link_name = "\u{1}_ZNK4oboe11AudioStream17getBytesPerSampleEv"] pub fn oboe_AudioStream_getBytesPerSample(this: *const oboe_AudioStream) -> i32; } @@ -1090,13 +756,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Wait until the stream has a minimum amount of data available in its buffer."] - #[doc = " This can be used with an EXCLUSIVE MMAP input stream to avoid reading data too close to"] - #[doc = " the DSP write position, which may cause glitches."] - #[doc = ""] - #[doc = " @param numFrames minimum frames available"] - #[doc = " @param timeoutNanoseconds"] - #[doc = " @return number of frames available, ErrorTimeout"] + #[doc = " Wait until the stream has a minimum amount of data available in its buffer.\n This can be used with an EXCLUSIVE MMAP input stream to avoid reading data too close to\n the DSP write position, which may cause glitches.\n\n @param numFrames minimum frames available\n @param timeoutNanoseconds\n @return number of frames available, ErrorTimeout"] #[link_name = "\u{1}_ZN4oboe11AudioStream22waitForAvailableFramesEil"] pub fn oboe_AudioStream_waitForAvailableFrames( this: *mut oboe_AudioStream, @@ -1105,12 +765,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Override this to provide your own behaviour for the audio callback"] - #[doc = ""] - #[doc = " @param audioData container array which audio frames will be written into or read from"] - #[doc = " @param numFrames number of frames which were read/written"] - #[doc = " @return the result of the callback: stop or continue"] - #[doc = ""] + #[doc = " Override this to provide your own behaviour for the audio callback\n\n @param audioData container array which audio frames will be written into or read from\n @param numFrames number of frames which were read/written\n @return the result of the callback: stop or continue\n"] #[link_name = "\u{1}_ZN4oboe11AudioStream16fireDataCallbackEPvi"] pub fn oboe_AudioStream_fireDataCallback( this: *mut oboe_AudioStream, @@ -1119,15 +774,12 @@ extern "C" { ) -> oboe_DataCallbackResult; } extern "C" { - #[doc = " This should only be called as a stream is being opened."] - #[doc = " Otherwise we might override setDelayBeforeCloseMillis()."] + #[doc = " This should only be called as a stream is being opened.\n Otherwise we might override setDelayBeforeCloseMillis()."] #[link_name = "\u{1}_ZN4oboe11AudioStream38calculateDefaultDelayBeforeCloseMillisEv"] pub fn oboe_AudioStream_calculateDefaultDelayBeforeCloseMillis(this: *mut oboe_AudioStream); } extern "C" { - #[doc = " Construct an `AudioStream` using the given `AudioStreamBuilder`"] - #[doc = ""] - #[doc = " @param builder containing all the stream's attributes"] + #[doc = " Construct an `AudioStream` using the given `AudioStreamBuilder`\n\n @param builder containing all the stream's attributes"] #[link_name = "\u{1}_ZN4oboe11AudioStreamC2ERKNS_18AudioStreamBuilderE"] pub fn oboe_AudioStream_AudioStream( this: *mut oboe_AudioStream, @@ -1176,8 +828,7 @@ extern "C" { pub fn oboe_AudioStream_close(this: *mut ::std::os::raw::c_void) -> oboe_Result; } extern "C" { - #[doc = " Start the stream. This will block until the stream has been started, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Start the stream. This will block until the stream has been started, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5startEl"] pub fn oboe_AudioStream_start( this: *mut ::std::os::raw::c_void, @@ -1185,8 +836,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Pause the stream. This will block until the stream has been paused, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Pause the stream. This will block until the stream has been paused, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5pauseEl"] pub fn oboe_AudioStream_pause( this: *mut ::std::os::raw::c_void, @@ -1194,8 +844,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Flush the stream. This will block until the stream has been flushed, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Flush the stream. This will block until the stream has been flushed, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5flushEl"] pub fn oboe_AudioStream_flush( this: *mut ::std::os::raw::c_void, @@ -1203,8 +852,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Stop the stream. This will block until the stream has been stopped, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Stop the stream. This will block until the stream has been stopped, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream4stopEl"] pub fn oboe_AudioStream_stop( this: *mut ::std::os::raw::c_void, @@ -1212,40 +860,17 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " The number of audio frames written into the stream."] - #[doc = " This monotonic counter will never get reset."] - #[doc = ""] - #[doc = " @return the number of frames written so far"] + #[doc = " The number of audio frames written into the stream.\n This monotonic counter will never get reset.\n\n @return the number of frames written so far"] #[link_name = "\u{1}_ZN4oboe11AudioStream16getFramesWrittenEv"] pub fn oboe_AudioStream_getFramesWritten(this: *mut ::std::os::raw::c_void) -> i64; } extern "C" { - #[doc = " The number of audio frames read from the stream."] - #[doc = " This monotonic counter will never get reset."] - #[doc = ""] - #[doc = " @return the number of frames read so far"] + #[doc = " The number of audio frames read from the stream.\n This monotonic counter will never get reset.\n\n @return the number of frames read so far"] #[link_name = "\u{1}_ZN4oboe11AudioStream13getFramesReadEv"] pub fn oboe_AudioStream_getFramesRead(this: *mut ::std::os::raw::c_void) -> i64; } extern "C" { - #[doc = " Get the estimated time that the frame at `framePosition` entered or left the audio processing"] - #[doc = " pipeline."] - #[doc = ""] - #[doc = " This can be used to coordinate events and interactions with the external environment, and to"] - #[doc = " estimate the latency of an audio stream. An example of usage can be found in the hello-oboe"] - #[doc = " sample (search for \"calculateCurrentOutputLatencyMillis\")."] - #[doc = ""] - #[doc = " The time is based on the implementation's best effort, using whatever knowledge is available"] - #[doc = " to the system, but cannot account for any delay unknown to the implementation."] - #[doc = ""] - #[doc = " Note that due to issues in Android before R, we recommend NOT calling"] - #[doc = " this method from a data callback. See this tech note for more details."] - #[doc = " https://github.com/google/oboe/blob/main/docs/notes/rlsbuffer.md"] - #[doc = ""] - #[doc = " See"] - #[doc = " @param clockId the type of clock to use e.g. CLOCK_MONOTONIC"] - #[doc = " @return a FrameTimestamp containing the position and time at which a particular audio frame"] - #[doc = " entered or left the audio processing pipeline, or an error if the operation failed."] + #[doc = " Get the estimated time that the frame at `framePosition` entered or left the audio processing\n pipeline.\n\n This can be used to coordinate events and interactions with the external environment, and to\n estimate the latency of an audio stream. An example of usage can be found in the hello-oboe\n sample (search for \"calculateCurrentOutputLatencyMillis\").\n\n The time is based on the implementation's best effort, using whatever knowledge is available\n to the system, but cannot account for any delay unknown to the implementation.\n\n Note that due to issues in Android before R, we recommend NOT calling\n this method from a data callback. See this tech note for more details.\n https://github.com/google/oboe/blob/main/docs/notes/rlsbuffer.md\n\n See\n @param clockId the type of clock to use e.g. CLOCK_MONOTONIC\n @return a FrameTimestamp containing the position and time at which a particular audio frame\n entered or left the audio processing pipeline, or an error if the operation failed."] #[link_name = "\u{1}_ZN4oboe11AudioStream12getTimestampEi"] pub fn oboe_AudioStream_getTimestamp( this: *mut ::std::os::raw::c_void, @@ -1253,10 +878,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Wait for a transition from one state to another."] - #[doc = " @return OK if the endingState was observed, or ErrorUnexpectedState"] - #[doc = " if any state that was not the startingState or endingState was observed"] - #[doc = " or ErrorTimeout."] + #[doc = " Wait for a transition from one state to another.\n @return OK if the endingState was observed, or ErrorUnexpectedState\n if any state that was not the startingState or endingState was observed\n or ErrorTimeout."] #[link_name = "\u{1}_ZN4oboe11AudioStream22waitForStateTransitionENS_11StreamStateES1_l"] pub fn oboe_AudioStream_waitForStateTransition( this: *mut ::std::os::raw::c_void, @@ -1266,8 +888,7 @@ extern "C" { ) -> oboe_Result; } pub const oboe_AudioStream_kMinDelayBeforeCloseMillis: ::std::os::raw::c_int = 10; -#[doc = " This struct is a stateless functor which closes an AudioStream prior to its deletion."] -#[doc = " This means it can be used to safely delete a smart pointer referring to an open stream."] +#[doc = " This struct is a stateless functor which closes an AudioStream prior to its deletion.\n This means it can be used to safely delete a smart pointer referring to an open stream."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_StreamDeleterFunctor { @@ -1286,18 +907,7 @@ fn bindgen_test_layout_oboe_StreamDeleterFunctor() { concat!("Alignment of ", stringify!(oboe_StreamDeleterFunctor)) ); } -#[doc = " LatencyTuner can be used to dynamically tune the latency of an output stream."] -#[doc = " It adjusts the stream's bufferSize by monitoring the number of underruns."] -#[doc = ""] -#[doc = " This only affects the latency associated with the first level of buffering that is closest"] -#[doc = " to the application. It does not affect low latency in the HAL, or touch latency in the UI."] -#[doc = ""] -#[doc = " Call tune() right before returning from your data callback function if using callbacks."] -#[doc = " Call tune() right before calling write() if using blocking writes."] -#[doc = ""] -#[doc = " If you want to see the ongoing results of this tuning process then call"] -#[doc = " stream->getBufferSize() periodically."] -#[doc = ""] +#[doc = " LatencyTuner can be used to dynamically tune the latency of an output stream.\n It adjusts the stream's bufferSize by monitoring the number of underruns.\n\n This only affects the latency associated with the first level of buffering that is closest\n to the application. It does not affect low latency in the HAL, or touch latency in the UI.\n\n Call tune() right before returning from your data callback function if using callbacks.\n Call tune() right before calling write() if using blocking writes.\n\n If you want to see the ongoing results of this tuning process then call\n stream->getBufferSize() periodically.\n"] #[repr(C)] #[repr(align(8))] #[derive(Debug, Copy, Clone)] @@ -1323,36 +933,22 @@ fn bindgen_test_layout_oboe_LatencyTuner() { ); } extern "C" { - #[doc = " Adjust the bufferSizeInFrames to optimize latency."] - #[doc = " It will start with a low latency and then raise it if an underrun occurs."] - #[doc = ""] - #[doc = " Latency tuning is only supported for AAudio."] - #[doc = ""] - #[doc = " @return OK or negative error, ErrorUnimplemented for OpenSL ES"] + #[doc = " Adjust the bufferSizeInFrames to optimize latency.\n It will start with a low latency and then raise it if an underrun occurs.\n\n Latency tuning is only supported for AAudio.\n\n @return OK or negative error, ErrorUnimplemented for OpenSL ES"] #[link_name = "\u{1}_ZN4oboe12LatencyTuner4tuneEv"] pub fn oboe_LatencyTuner_tune(this: *mut oboe_LatencyTuner) -> oboe_Result; } extern "C" { - #[doc = " This may be called from another thread. Then tune() will call reset(),"] - #[doc = " which will lower the latency to the minimum and then allow it to rise back up"] - #[doc = " if there are glitches."] - #[doc = ""] - #[doc = " This is typically called in response to a user decision to minimize latency. In other words,"] - #[doc = " call this from a button handler."] + #[doc = " This may be called from another thread. Then tune() will call reset(),\n which will lower the latency to the minimum and then allow it to rise back up\n if there are glitches.\n\n This is typically called in response to a user decision to minimize latency. In other words,\n call this from a button handler."] #[link_name = "\u{1}_ZN4oboe12LatencyTuner12requestResetEv"] pub fn oboe_LatencyTuner_requestReset(this: *mut oboe_LatencyTuner); } extern "C" { - #[doc = " @return true if the audio stream's buffer size is at the maximum value. If no maximum value"] - #[doc = " was specified when constructing the LatencyTuner then the value of"] - #[doc = " stream->getBufferCapacityInFrames is used"] + #[doc = " @return true if the audio stream's buffer size is at the maximum value. If no maximum value\n was specified when constructing the LatencyTuner then the value of\n stream->getBufferCapacityInFrames is used"] #[link_name = "\u{1}_ZN4oboe12LatencyTuner21isAtMaximumBufferSizeEv"] pub fn oboe_LatencyTuner_isAtMaximumBufferSize(this: *mut oboe_LatencyTuner) -> bool; } extern "C" { - #[doc = " Construct a new LatencyTuner object which will act on the given audio stream"] - #[doc = ""] - #[doc = " @param stream the stream who's latency will be tuned"] + #[doc = " Construct a new LatencyTuner object which will act on the given audio stream\n\n @param stream the stream who's latency will be tuned"] #[link_name = "\u{1}_ZN4oboe12LatencyTunerC1ERNS_11AudioStreamE"] pub fn oboe_LatencyTuner_LatencyTuner( this: *mut oboe_LatencyTuner, @@ -1360,10 +956,7 @@ extern "C" { ); } extern "C" { - #[doc = " Construct a new LatencyTuner object which will act on the given audio stream."] - #[doc = ""] - #[doc = " @param stream the stream who's latency will be tuned"] - #[doc = " @param the maximum buffer size which the tune() operation will set the buffer size to"] + #[doc = " Construct a new LatencyTuner object which will act on the given audio stream.\n\n @param stream the stream who's latency will be tuned\n @param the maximum buffer size which the tune() operation will set the buffer size to"] #[link_name = "\u{1}_ZN4oboe12LatencyTunerC1ERNS_11AudioStreamEi"] pub fn oboe_LatencyTuner_LatencyTuner1( this: *mut oboe_LatencyTuner, @@ -1407,16 +1000,13 @@ pub struct oboe_Version { } #[doc = " This is incremented when we make breaking API changes. Based loosely on https://semver.org/."] pub const oboe_Version_Major: u8 = 1; -#[doc = " This is incremented when we add backwards compatible functionality. Or set to zero when MAJOR is"] -#[doc = " incremented."] +#[doc = " This is incremented when we add backwards compatible functionality. Or set to zero when MAJOR is\n incremented."] pub const oboe_Version_Minor: u8 = 7; -#[doc = " This is incremented when we make backwards compatible bug fixes. Or set to zero when MINOR is"] -#[doc = " incremented."] +#[doc = " This is incremented when we make backwards compatible bug fixes. Or set to zero when MINOR is\n incremented."] pub const oboe_Version_Patch: u16 = 0; #[doc = " Version string in the form MAJOR.MINOR.PATCH."] pub const oboe_Version_Text: &[u8; 6usize] = b"1.7.0\0"; -#[doc = " Integer representation of the current Oboe library version. This will always increase when the"] -#[doc = " version number changes so can be compared using integer comparison."] +#[doc = " Integer representation of the current Oboe library version. This will always increase when the\n version number changes so can be compared using integer comparison."] pub const oboe_Version_Number: u32 = 17235968; #[test] fn bindgen_test_layout_oboe_Version() { @@ -1442,6 +1032,9 @@ pub struct oboe_StabilizedCallback { } #[test] fn bindgen_test_layout_oboe_StabilizedCallback() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 48usize, @@ -1452,74 +1045,46 @@ fn bindgen_test_layout_oboe_StabilizedCallback() { 8usize, concat!("Alignment of ", stringify!(oboe_StabilizedCallback)) ); - fn test_field_mCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mCallback) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mCallback) - ) - ); - } - test_field_mCallback(); - fn test_field_mFrameCount() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFrameCount) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mFrameCount) - ) - ); - } - test_field_mFrameCount(); - fn test_field_mEpochTimeNanos() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mEpochTimeNanos) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mEpochTimeNanos) - ) - ); - } - test_field_mEpochTimeNanos(); - fn test_field_mOpsPerNano() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mOpsPerNano) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mOpsPerNano) - ) - ); - } - test_field_mOpsPerNano(); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mCallback) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFrameCount) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mFrameCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mEpochTimeNanos) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mEpochTimeNanos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mOpsPerNano) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mOpsPerNano) + ) + ); } extern "C" { #[link_name = "\u{1}_ZN4oboe18StabilizedCallbackC1EPNS_19AudioStreamCallbackE"] @@ -1545,6 +1110,7 @@ extern "C" { numFrames: i32, ) -> oboe_DataCallbackResult; } +pub type oboe_AudioStreamShared = [u64; 2usize]; pub type oboe_DropContextHandler = ::std::option::Option; pub type oboe_AudioReadyHandler = ::std::option::Option< @@ -1688,11 +1254,10 @@ extern "C" { ) -> *mut oboe_AudioStreamBase; } extern "C" { - #[link_name = "\u{1}_ZN4oboe35AudioStreamBuilder_openStreamSharedEPNS_18AudioStreamBuilderEPPNS_11AudioStreamEPPv"] + #[link_name = "\u{1}_ZN4oboe35AudioStreamBuilder_openStreamSharedEPNS_18AudioStreamBuilderEPNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] pub fn oboe_AudioStreamBuilder_openStreamShared( builder: *mut oboe_AudioStreamBuilder, - stream: *mut *mut oboe_AudioStream, - shared_ptr: *mut *mut ::std::os::raw::c_void, + sharedStream: *mut oboe_AudioStreamShared, ) -> oboe_Result; } extern "C" { @@ -1700,8 +1265,21 @@ extern "C" { pub fn oboe_AudioStream_delete(oboeStream: *mut oboe_AudioStream); } extern "C" { - #[link_name = "\u{1}_ZN4oboe24AudioStream_deleteSharedEPv"] - pub fn oboe_AudioStream_deleteShared(shared_ptr: *mut ::std::os::raw::c_void); + #[link_name = "\u{1}_ZN4oboe23AudioStream_cloneSharedEPKNSt6__ndk110shared_ptrINS_11AudioStreamEEEPS3_"] + pub fn oboe_AudioStream_cloneShared( + sharedStream: *const oboe_AudioStreamShared, + newSharedStream: *mut oboe_AudioStreamShared, + ); +} +extern "C" { + #[link_name = "\u{1}_ZN4oboe24AudioStream_deleteSharedEPNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] + pub fn oboe_AudioStream_deleteShared(sharedStream: *mut oboe_AudioStreamShared); +} +extern "C" { + #[link_name = "\u{1}_ZN4oboe23AudioStream_derefSharedEPKNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] + pub fn oboe_AudioStream_derefShared( + sharedStream: *const oboe_AudioStreamShared, + ) -> *const oboe_AudioStream; } extern "C" { #[link_name = "\u{1}_ZN4oboe16AudioStream_openEPNS_11AudioStreamE"] diff --git a/sys/src/bindings_armv7.rs b/sys/src/bindings_armv7.rs index 6fa5763..63d37bc 100644 --- a/sys/src/bindings_armv7.rs +++ b/sys/src/bindings_armv7.rs @@ -1,11 +1,6 @@ -/* automatically generated by rust-bindgen 0.60.1 */ +/* automatically generated by rust-bindgen 0.63.0 */ pub type std_string = [u32; 3usize]; -pub type __uint8_t = ::std::os::raw::c_uchar; -pub type __uint16_t = ::std::os::raw::c_ushort; -pub type __int32_t = ::std::os::raw::c_int; -pub type __uint32_t = ::std::os::raw::c_uint; -pub type __int64_t = ::std::os::raw::c_longlong; pub const oboe_StreamState_Uninitialized: oboe_StreamState = 0; pub const oboe_StreamState_Unknown: oboe_StreamState = 1; pub const oboe_StreamState_Open: oboe_StreamState = 2; @@ -34,27 +29,11 @@ pub const oboe_AudioFormat_Invalid: oboe_AudioFormat = -1; pub const oboe_AudioFormat_Unspecified: oboe_AudioFormat = 0; #[doc = " Signed 16-bit integers."] pub const oboe_AudioFormat_I16: oboe_AudioFormat = 1; -#[doc = " Single precision floating point."] -#[doc = ""] -#[doc = " This is the recommended format for most applications."] -#[doc = " But note that the use of Float may prevent the opening of"] -#[doc = " a low-latency input path on OpenSL ES or Legacy AAudio streams."] +#[doc = " Single precision floating point.\n\n This is the recommended format for most applications.\n But note that the use of Float may prevent the opening of\n a low-latency input path on OpenSL ES or Legacy AAudio streams."] pub const oboe_AudioFormat_Float: oboe_AudioFormat = 2; -#[doc = " Signed 24-bit integers, packed into 3 bytes."] -#[doc = ""] -#[doc = " Note that the use of this format does not guarantee that"] -#[doc = " the full precision will be provided. The underlying device may"] -#[doc = " be using I16 format."] -#[doc = ""] -#[doc = " Added in API 31 (S)."] +#[doc = " Signed 24-bit integers, packed into 3 bytes.\n\n Note that the use of this format does not guarantee that\n the full precision will be provided. The underlying device may\n be using I16 format.\n\n Added in API 31 (S)."] pub const oboe_AudioFormat_I24: oboe_AudioFormat = 3; -#[doc = " Signed 32-bit integers."] -#[doc = ""] -#[doc = " Note that the use of this format does not guarantee that"] -#[doc = " the full precision will be provided. The underlying device may"] -#[doc = " be using I16 format."] -#[doc = ""] -#[doc = " Added in API 31 (S)."] +#[doc = " Signed 32-bit integers.\n\n Note that the use of this format does not guarantee that\n the full precision will be provided. The underlying device may\n be using I16 format.\n\n Added in API 31 (S)."] pub const oboe_AudioFormat_I32: oboe_AudioFormat = 4; #[doc = " The format of audio samples."] pub type oboe_AudioFormat = i32; @@ -91,21 +70,11 @@ pub const oboe_Result_Reserved8: oboe_Result = -872; pub const oboe_Result_Reserved9: oboe_Result = -871; pub const oboe_Result_Reserved10: oboe_Result = -870; pub const oboe_Result_ErrorClosed: oboe_Result = -869; -#[doc = " The result of an operation. All except the `OK` result indicates that an error occurred."] -#[doc = " The `Result` can be converted into a human readable string using `convertToText`."] +#[doc = " The result of an operation. All except the `OK` result indicates that an error occurred.\n The `Result` can be converted into a human readable string using `convertToText`."] pub type oboe_Result = i32; -#[doc = " This will be the only stream using a particular source or sink."] -#[doc = " This mode will provide the lowest possible latency."] -#[doc = " You should close EXCLUSIVE streams immediately when you are not using them."] -#[doc = ""] -#[doc = " If you do not need the lowest possible latency then we recommend using Shared,"] -#[doc = " which is the default."] +#[doc = " This will be the only stream using a particular source or sink.\n This mode will provide the lowest possible latency.\n You should close EXCLUSIVE streams immediately when you are not using them.\n\n If you do not need the lowest possible latency then we recommend using Shared,\n which is the default."] pub const oboe_SharingMode_Exclusive: oboe_SharingMode = 0; -#[doc = " Multiple applications can share the same device."] -#[doc = " The data from output streams will be mixed by the audio service."] -#[doc = " The data for input streams will be distributed by the audio service."] -#[doc = ""] -#[doc = " This will have higher latency than the EXCLUSIVE mode."] +#[doc = " Multiple applications can share the same device.\n The data from output streams will be mixed by the audio service.\n The data for input streams will be distributed by the audio service.\n\n This will have higher latency than the EXCLUSIVE mode."] pub const oboe_SharingMode_Shared: oboe_SharingMode = 1; #[doc = " The sharing mode of the audio stream."] pub type oboe_SharingMode = i32; @@ -119,19 +88,15 @@ pub const oboe_PerformanceMode_LowLatency: oboe_PerformanceMode = 12; pub type oboe_PerformanceMode = i32; #[doc = " Try to use AAudio. If not available then use OpenSL ES."] pub const oboe_AudioApi_Unspecified: oboe_AudioApi = 0; -#[doc = " Use OpenSL ES."] -#[doc = " Note that OpenSL ES is deprecated in Android 13, API 30 and above."] +#[doc = " Use OpenSL ES.\n Note that OpenSL ES is deprecated in Android 13, API 30 and above."] pub const oboe_AudioApi_OpenSLES: oboe_AudioApi = 1; -#[doc = " Try to use AAudio. Fail if unavailable."] -#[doc = " AAudio was first supported in Android 8, API 26 and above."] -#[doc = " It is only recommended for API 27 and above."] +#[doc = " Try to use AAudio. Fail if unavailable.\n AAudio was first supported in Android 8, API 26 and above.\n It is only recommended for API 27 and above."] pub const oboe_AudioApi_AAudio: oboe_AudioApi = 2; #[doc = " The underlying audio API used by the audio stream."] pub type oboe_AudioApi = i32; #[doc = " No conversion by Oboe. Underlying APIs may still do conversion."] pub const oboe_SampleRateConversionQuality_None: oboe_SampleRateConversionQuality = 0; -#[doc = " Fastest conversion but may not sound great."] -#[doc = " This may be implemented using bilinear interpolation."] +#[doc = " Fastest conversion but may not sound great.\n This may be implemented using bilinear interpolation."] pub const oboe_SampleRateConversionQuality_Fastest: oboe_SampleRateConversionQuality = 1; #[doc = " Low quality conversion with 8 taps."] pub const oboe_SampleRateConversionQuality_Low: oboe_SampleRateConversionQuality = 2; @@ -141,9 +106,7 @@ pub const oboe_SampleRateConversionQuality_Medium: oboe_SampleRateConversionQual pub const oboe_SampleRateConversionQuality_High: oboe_SampleRateConversionQuality = 4; #[doc = " Highest quality conversion, which may be expensive in terms of CPU."] pub const oboe_SampleRateConversionQuality_Best: oboe_SampleRateConversionQuality = 5; -#[doc = " Specifies the quality of the sample rate conversion performed by Oboe."] -#[doc = " Higher quality will require more CPU load."] -#[doc = " Higher quality conversion will probably be implemented using a sinc based resampler."] +#[doc = " Specifies the quality of the sample rate conversion performed by Oboe.\n Higher quality will require more CPU load.\n Higher quality conversion will probably be implemented using a sinc based resampler."] pub type oboe_SampleRateConversionQuality = i32; #[doc = " Use this for streaming media, music performance, video, podcasts, etcetera."] pub const oboe_Usage_Media: oboe_Usage = 1; @@ -153,8 +116,7 @@ pub const oboe_Usage_VoiceCommunication: oboe_Usage = 2; pub const oboe_Usage_VoiceCommunicationSignalling: oboe_Usage = 3; #[doc = " Use this to demand the users attention."] pub const oboe_Usage_Alarm: oboe_Usage = 4; -#[doc = " Use this for notifying the user when a message has arrived or some"] -#[doc = " other background event has occured."] +#[doc = " Use this for notifying the user when a message has arrived or some\n other background event has occured."] pub const oboe_Usage_Notification: oboe_Usage = 5; #[doc = " Use this when the phone rings."] pub const oboe_Usage_NotificationRingtone: oboe_Usage = 6; @@ -170,13 +132,7 @@ pub const oboe_Usage_AssistanceSonification: oboe_Usage = 13; pub const oboe_Usage_Game: oboe_Usage = 14; #[doc = " Use this for audio responses to user queries, audio instructions or help utterances."] pub const oboe_Usage_Assistant: oboe_Usage = 16; -#[doc = " The Usage attribute expresses *why* you are playing a sound, what is this sound used for."] -#[doc = " This information is used by certain platforms or routing policies"] -#[doc = " to make more refined volume or routing decisions."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in AudioAttributes in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " The Usage attribute expresses *why* you are playing a sound, what is this sound used for.\n This information is used by certain platforms or routing policies\n to make more refined volume or routing decisions.\n\n Note that these match the equivalent values in AudioAttributes in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_Usage = i32; #[doc = " Use this for spoken voice, audio books, etcetera."] pub const oboe_ContentType_Speech: oboe_ContentType = 1; @@ -184,19 +140,9 @@ pub const oboe_ContentType_Speech: oboe_ContentType = 1; pub const oboe_ContentType_Music: oboe_ContentType = 2; #[doc = " Use this for a movie or video soundtrack."] pub const oboe_ContentType_Movie: oboe_ContentType = 3; -#[doc = " Use this for sound is designed to accompany a user action,"] -#[doc = " such as a click or beep sound made when the user presses a button."] +#[doc = " Use this for sound is designed to accompany a user action,\n such as a click or beep sound made when the user presses a button."] pub const oboe_ContentType_Sonification: oboe_ContentType = 4; -#[doc = " The ContentType attribute describes *what* you are playing."] -#[doc = " It expresses the general category of the content. This information is optional."] -#[doc = " But in case it is known (for instance {@link Movie} for a"] -#[doc = " movie streaming service or {@link Speech} for"] -#[doc = " an audio book application) this information might be used by the audio framework to"] -#[doc = " enforce audio focus."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in AudioAttributes in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " The ContentType attribute describes *what* you are playing.\n It expresses the general category of the content. This information is optional.\n But in case it is known (for instance {@link Movie} for a\n movie streaming service or {@link Speech} for\n an audio book application) this information might be used by the audio framework to\n enforce audio focus.\n\n Note that these match the equivalent values in AudioAttributes in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_ContentType = i32; #[doc = " Use this preset when other presets do not apply."] pub const oboe_InputPreset_Generic: oboe_InputPreset = 1; @@ -206,35 +152,17 @@ pub const oboe_InputPreset_Camcorder: oboe_InputPreset = 5; pub const oboe_InputPreset_VoiceRecognition: oboe_InputPreset = 6; #[doc = " Use this preset when doing telephony or voice messaging."] pub const oboe_InputPreset_VoiceCommunication: oboe_InputPreset = 7; -#[doc = " Use this preset to obtain an input with no effects."] -#[doc = " Note that this input will not have automatic gain control"] -#[doc = " so the recorded volume may be very low."] +#[doc = " Use this preset to obtain an input with no effects.\n Note that this input will not have automatic gain control\n so the recorded volume may be very low."] pub const oboe_InputPreset_Unprocessed: oboe_InputPreset = 9; -#[doc = " Use this preset for capturing audio meant to be processed in real time"] -#[doc = " and played back for live performance (e.g karaoke)."] -#[doc = " The capture path will minimize latency and coupling with playback path."] +#[doc = " Use this preset for capturing audio meant to be processed in real time\n and played back for live performance (e.g karaoke).\n The capture path will minimize latency and coupling with playback path."] pub const oboe_InputPreset_VoicePerformance: oboe_InputPreset = 10; -#[doc = " Defines the audio source."] -#[doc = " An audio source defines both a default physical source of audio signal, and a recording"] -#[doc = " configuration."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " Defines the audio source.\n An audio source defines both a default physical source of audio signal, and a recording\n configuration.\n\n Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_InputPreset = i32; -#[doc = " Do not allocate a session ID."] -#[doc = " Effects cannot be used with this stream."] -#[doc = " Default."] +#[doc = " Do not allocate a session ID.\n Effects cannot be used with this stream.\n Default."] pub const oboe_SessionId_None: oboe_SessionId = -1; -#[doc = " Allocate a session ID that can be used to attach and control"] -#[doc = " effects using the Java AudioEffects API."] -#[doc = " Note that the use of this flag may result in higher latency."] -#[doc = ""] -#[doc = " Note that this matches the value of AudioManager.AUDIO_SESSION_ID_GENERATE."] +#[doc = " Allocate a session ID that can be used to attach and control\n effects using the Java AudioEffects API.\n Note that the use of this flag may result in higher latency.\n\n Note that this matches the value of AudioManager.AUDIO_SESSION_ID_GENERATE."] pub const oboe_SessionId_Allocate: oboe_SessionId = 0; -#[doc = " This attribute can be used to allocate a session ID to the audio stream."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " This attribute can be used to allocate a session ID to the audio stream.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_SessionId = ::std::os::raw::c_int; #[doc = " Audio channel count definition, use Mono or Stereo"] pub const oboe_ChannelCount_Unspecified: oboe_ChannelCount = 0; @@ -242,14 +170,7 @@ pub const oboe_ChannelCount_Unspecified: oboe_ChannelCount = 0; pub const oboe_ChannelCount_Mono: oboe_ChannelCount = 1; #[doc = " Use this for stereo audio."] pub const oboe_ChannelCount_Stereo: oboe_ChannelCount = 2; -#[doc = " The channel count of the audio stream. The underlying type is `int32_t`."] -#[doc = " Use of this enum is convenient to avoid \"magic\""] -#[doc = " numbers when specifying the channel count."] -#[doc = ""] -#[doc = " For example, you can write"] -#[doc = " `builder.setChannelCount(ChannelCount::Stereo)`"] -#[doc = " rather than `builder.setChannelCount(2)`"] -#[doc = ""] +#[doc = " The channel count of the audio stream. The underlying type is `int32_t`.\n Use of this enum is convenient to avoid \"magic\"\n numbers when specifying the channel count.\n\n For example, you can write\n `builder.setChannelCount(ChannelCount::Stereo)`\n rather than `builder.setChannelCount(2)`\n"] pub type oboe_ChannelCount = i32; pub const oboe_ChannelMask_Unspecified: oboe_ChannelMask = 0; pub const oboe_ChannelMask_FrontLeft: oboe_ChannelMask = 1; @@ -303,30 +224,9 @@ pub const oboe_ChannelMask_CM7Point1Point4: oboe_ChannelMask = 185919; pub const oboe_ChannelMask_CM9Point1Point4: oboe_ChannelMask = 50517567; pub const oboe_ChannelMask_CM9Point1Point6: oboe_ChannelMask = 51303999; pub const oboe_ChannelMask_FrontBack: oboe_ChannelMask = 260; -#[doc = " The channel mask of the audio stream. The underlying type is `uint32_t`."] -#[doc = " Use of this enum is convenient."] -#[doc = ""] -#[doc = " ChannelMask::Unspecified means this is not specified."] -#[doc = " The rest of the enums are channel position masks."] -#[doc = " Use the combinations of the channel position masks defined below instead of"] -#[doc = " using those values directly."] +#[doc = " The channel mask of the audio stream. The underlying type is `uint32_t`.\n Use of this enum is convenient.\n\n ChannelMask::Unspecified means this is not specified.\n The rest of the enums are channel position masks.\n Use the combinations of the channel position masks defined below instead of\n using those values directly."] pub type oboe_ChannelMask = u32; -#[doc = " On API 16 to 26 OpenSL ES will be used. When using OpenSL ES the optimal values for sampleRate and"] -#[doc = " framesPerBurst are not known by the native code."] -#[doc = " On API 17+ these values should be obtained from the AudioManager using this code:"] -#[doc = ""] -#[doc = "
"]
-#[doc = " // Note that this technique only works for built-in speakers and headphones."]
-#[doc = " AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);"]
-#[doc = " String sampleRateStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);"]
-#[doc = " int defaultSampleRate = Integer.parseInt(sampleRateStr);"]
-#[doc = " String framesPerBurstStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);"]
-#[doc = " int defaultFramesPerBurst = Integer.parseInt(framesPerBurstStr);"]
-#[doc = " 
"] -#[doc = ""] -#[doc = " It can then be passed down to Oboe through JNI."] -#[doc = ""] -#[doc = " AAudio will get the optimal framesPerBurst from the HAL and will ignore this value."] +#[doc = " On API 16 to 26 OpenSL ES will be used. When using OpenSL ES the optimal values for sampleRate and\n framesPerBurst are not known by the native code.\n On API 17+ these values should be obtained from the AudioManager using this code:\n\n
\n // Note that this technique only works for built-in speakers and headphones.\n AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);\n String sampleRateStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);\n int defaultSampleRate = Integer.parseInt(sampleRateStr);\n String framesPerBurstStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);\n int defaultFramesPerBurst = Integer.parseInt(framesPerBurstStr);\n 
\n\n It can then be passed down to Oboe through JNI.\n\n AAudio will get the optimal framesPerBurst from the HAL and will ignore this value."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_DefaultStreamValues { @@ -369,6 +269,8 @@ pub struct oboe_FrameTimestamp { } #[test] fn bindgen_test_layout_oboe_FrameTimestamp() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, @@ -379,59 +281,28 @@ fn bindgen_test_layout_oboe_FrameTimestamp() { 8usize, concat!("Alignment of ", stringify!(oboe_FrameTimestamp)) ); - fn test_field_position() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).position) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(oboe_FrameTimestamp), - "::", - stringify!(position) - ) - ); - } - test_field_position(); - fn test_field_timestamp() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(oboe_FrameTimestamp), - "::", - stringify!(timestamp) - ) - ); - } - test_field_timestamp(); -} -#[doc = " A ResultWithValue can store both the result of an operation (either OK or an error) and a value."] -#[doc = ""] -#[doc = " It has been designed for cases where the caller needs to know whether an operation succeeded and,"] -#[doc = " if it did, a value which was obtained during the operation."] -#[doc = ""] -#[doc = " For example, when reading from a stream the caller needs to know the result of the read operation"] -#[doc = " and, if it was successful, how many frames were read. Note that ResultWithValue can be evaluated"] -#[doc = " as a boolean so it's simple to check whether the result is OK."] -#[doc = ""] -#[doc = " "] -#[doc = " ResultWithValue resultOfRead = myStream.read(&buffer, numFrames, timeoutNanoseconds);"] -#[doc = ""] -#[doc = " if (resultOfRead) {"] -#[doc = " LOGD(\"Frames read: %d\", resultOfRead.value());"] -#[doc = " } else {"] -#[doc = " LOGD(\"Error reading from stream: %s\", resultOfRead.error());"] -#[doc = " }"] -#[doc = " "] + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).position) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(oboe_FrameTimestamp), + "::", + stringify!(position) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(oboe_FrameTimestamp), + "::", + stringify!(timestamp) + ) + ); +} +#[doc = " A ResultWithValue can store both the result of an operation (either OK or an error) and a value.\n\n It has been designed for cases where the caller needs to know whether an operation succeeded and,\n if it did, a value which was obtained during the operation.\n\n For example, when reading from a stream the caller needs to know the result of the read operation\n and, if it was successful, how many frames were read. Note that ResultWithValue can be evaluated\n as a boolean so it's simple to check whether the result is OK.\n\n \n ResultWithValue resultOfRead = myStream.read(&buffer, numFrames, timeoutNanoseconds);\n\n if (resultOfRead) {\n LOGD(\"Frames read: %d\", resultOfRead.value());\n } else {\n LOGD(\"Error reading from stream: %s\", resultOfRead.error());\n }\n "] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_ResultWithValue { @@ -441,11 +312,7 @@ pub struct oboe_ResultWithValue { } #[repr(C)] pub struct oboe_AudioStreamDataCallback__bindgen_vtable(::std::os::raw::c_void); -#[doc = " AudioStreamDataCallback defines a callback interface for"] -#[doc = " moving data to/from an audio stream using `onAudioReady`"] -#[doc = " 2) being alerted when a stream has an error using `onError*` methods"] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setDataCallback()."] +#[doc = " AudioStreamDataCallback defines a callback interface for\n moving data to/from an audio stream using `onAudioReady`\n 2) being alerted when a stream has an error using `onError*` methods\n\n It is used with AudioStreamBuilder::setDataCallback()."] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamDataCallback { @@ -466,15 +333,7 @@ fn bindgen_test_layout_oboe_AudioStreamDataCallback() { } #[repr(C)] pub struct oboe_AudioStreamErrorCallback__bindgen_vtable(::std::os::raw::c_void); -#[doc = " AudioStreamErrorCallback defines a callback interface for"] -#[doc = " being alerted when a stream has an error or is disconnected"] -#[doc = " using `onError*` methods."] -#[doc = ""] -#[doc = " Note: This callback is only fired when an AudioStreamCallback is set."] -#[doc = " If you use AudioStream::write() you have to evaluate the return codes of"] -#[doc = " AudioStream::write() to notice errors in the stream."] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setErrorCallback()."] +#[doc = " AudioStreamErrorCallback defines a callback interface for\n being alerted when a stream has an error or is disconnected\n using `onError*` methods.\n\n Note: This callback is only fired when an AudioStreamCallback is set.\n If you use AudioStream::write() you have to evaluate the return codes of\n AudioStream::write() to notice errors in the stream.\n\n It is used with AudioStreamBuilder::setErrorCallback()."] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamErrorCallback { @@ -493,18 +352,7 @@ fn bindgen_test_layout_oboe_AudioStreamErrorCallback() { concat!("Alignment of ", stringify!(oboe_AudioStreamErrorCallback)) ); } -#[doc = " AudioStreamCallback defines a callback interface for:"] -#[doc = ""] -#[doc = " 1) moving data to/from an audio stream using `onAudioReady`"] -#[doc = " 2) being alerted when a stream has an error using `onError*` methods"] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setCallback()."] -#[doc = ""] -#[doc = " It combines the interfaces defined by AudioStreamDataCallback and AudioStreamErrorCallback."] -#[doc = " This was the original callback object. We now recommend using the individual interfaces"] -#[doc = " and using setDataCallback() and setErrorCallback()."] -#[doc = ""] -#[doc = " @deprecated Use `AudioStreamDataCallback` and `AudioStreamErrorCallback` instead"] +#[doc = " AudioStreamCallback defines a callback interface for:\n\n 1) moving data to/from an audio stream using `onAudioReady`\n 2) being alerted when a stream has an error using `onError*` methods\n\n It is used with AudioStreamBuilder::setCallback().\n\n It combines the interfaces defined by AudioStreamDataCallback and AudioStreamErrorCallback.\n This was the original callback object. We now recommend using the individual interfaces\n and using setDataCallback() and setErrorCallback().\n\n @deprecated Use `AudioStreamDataCallback` and `AudioStreamErrorCallback` instead"] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamCallback { @@ -562,8 +410,7 @@ pub struct oboe_AudioStreamBase { pub mUsage: oboe_Usage, #[doc = " Stream content type. Only active on Android 28+"] pub mContentType: oboe_ContentType, - #[doc = " Stream input preset. Only active on Android 28+"] - #[doc = " TODO InputPreset::Unspecified should be considered as a possible default alternative."] + #[doc = " Stream input preset. Only active on Android 28+\n TODO InputPreset::Unspecified should be considered as a possible default alternative."] pub mInputPreset: oboe_InputPreset, #[doc = " Stream session ID allocation strategy. Only active on Android 28+"] pub mSessionId: oboe_SessionId, @@ -577,6 +424,8 @@ pub struct oboe_AudioStreamBase { } #[test] fn bindgen_test_layout_oboe_AudioStreamBase() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 120usize, @@ -587,422 +436,251 @@ fn bindgen_test_layout_oboe_AudioStreamBase() { 4usize, concat!("Alignment of ", stringify!(oboe_AudioStreamBase)) ); - fn test_field_mDataCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDataCallback) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDataCallback) - ) - ); - } - test_field_mDataCallback(); - fn test_field_mSharedDataCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharedDataCallback) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharedDataCallback) - ) - ); - } - test_field_mSharedDataCallback(); - fn test_field_mErrorCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mErrorCallback) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mErrorCallback) - ) - ); - } - test_field_mErrorCallback(); - fn test_field_mSharedErrorCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharedErrorCallback) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharedErrorCallback) - ) - ); - } - test_field_mSharedErrorCallback(); - fn test_field_mFramesPerCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFramesPerCallback) as usize - ptr as usize - }, - 28usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFramesPerCallback) - ) - ); - } - test_field_mFramesPerCallback(); - fn test_field_mChannelCount() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelCount) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelCount) - ) - ); - } - test_field_mChannelCount(); - fn test_field_mSampleRate() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSampleRate) as usize - ptr as usize - }, - 36usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSampleRate) - ) - ); - } - test_field_mSampleRate(); - fn test_field_mDeviceId() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDeviceId) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDeviceId) - ) - ); - } - test_field_mDeviceId(); - fn test_field_mBufferCapacityInFrames() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBufferCapacityInFrames) as usize - ptr as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mBufferCapacityInFrames) - ) - ); - } - test_field_mBufferCapacityInFrames(); - fn test_field_mBufferSizeInFrames() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBufferSizeInFrames) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mBufferSizeInFrames) - ) - ); - } - test_field_mBufferSizeInFrames(); - fn test_field_mChannelMask() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelMask) as usize - ptr as usize - }, - 52usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelMask) - ) - ); - } - test_field_mChannelMask(); - fn test_field_mSharingMode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharingMode) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharingMode) - ) - ); - } - test_field_mSharingMode(); - fn test_field_mFormat() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFormat) as usize - ptr as usize - }, - 60usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFormat) - ) - ); - } - test_field_mFormat(); - fn test_field_mDirection() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDirection) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDirection) - ) - ); - } - test_field_mDirection(); - fn test_field_mPerformanceMode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mPerformanceMode) as usize - ptr as usize - }, - 68usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mPerformanceMode) - ) - ); - } - test_field_mPerformanceMode(); - fn test_field_mUsage() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mUsage) as usize - ptr as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mUsage) - ) - ); - } - test_field_mUsage(); - fn test_field_mContentType() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mContentType) as usize - ptr as usize - }, - 76usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mContentType) - ) - ); - } - test_field_mContentType(); - fn test_field_mInputPreset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mInputPreset) as usize - ptr as usize - }, - 80usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mInputPreset) - ) - ); - } - test_field_mInputPreset(); - fn test_field_mSessionId() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSessionId) as usize - ptr as usize - }, - 84usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSessionId) - ) - ); - } - test_field_mSessionId(); - fn test_field_mPackageName() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mPackageName) as usize - ptr as usize - }, - 88usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mPackageName) - ) - ); - } - test_field_mPackageName(); - fn test_field_mAttributionTag() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mAttributionTag) as usize - ptr as usize - }, - 100usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mAttributionTag) - ) - ); - } - test_field_mAttributionTag(); - fn test_field_mChannelConversionAllowed() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelConversionAllowed) as usize - ptr as usize - }, - 112usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelConversionAllowed) - ) - ); - } - test_field_mChannelConversionAllowed(); - fn test_field_mFormatConversionAllowed() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFormatConversionAllowed) as usize - ptr as usize - }, - 113usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFormatConversionAllowed) - ) - ); - } - test_field_mFormatConversionAllowed(); - fn test_field_mSampleRateConversionQuality() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSampleRateConversionQuality) as usize - ptr as usize - }, - 116usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSampleRateConversionQuality) - ) - ); - } - test_field_mSampleRateConversionQuality(); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDataCallback) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDataCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharedDataCallback) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharedDataCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mErrorCallback) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mErrorCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharedErrorCallback) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharedErrorCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFramesPerCallback) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFramesPerCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelCount) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSampleRate) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSampleRate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDeviceId) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDeviceId) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mBufferCapacityInFrames) as usize - ptr as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mBufferCapacityInFrames) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mBufferSizeInFrames) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mBufferSizeInFrames) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelMask) as usize - ptr as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelMask) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharingMode) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharingMode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFormat) as usize - ptr as usize }, + 60usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFormat) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDirection) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDirection) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mPerformanceMode) as usize - ptr as usize }, + 68usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mPerformanceMode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mUsage) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mUsage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mContentType) as usize - ptr as usize }, + 76usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mContentType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mInputPreset) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mInputPreset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSessionId) as usize - ptr as usize }, + 84usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSessionId) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mPackageName) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mPackageName) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mAttributionTag) as usize - ptr as usize }, + 100usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mAttributionTag) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelConversionAllowed) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelConversionAllowed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFormatConversionAllowed) as usize - ptr as usize }, + 113usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFormatConversionAllowed) + ) + ); + assert_eq!( + unsafe { + ::std::ptr::addr_of!((*ptr).mSampleRateConversionQuality) as usize - ptr as usize + }, + 116usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSampleRateConversionQuality) + ) + ); } extern "C" { - #[doc = " Return the version of the SDK that is currently running."] - #[doc = ""] - #[doc = " For example, on Android, this would return 27 for Oreo 8.1."] - #[doc = " If the version number cannot be determined then this will return -1."] - #[doc = ""] - #[doc = " @return version number or -1"] + #[doc = " Return the version of the SDK that is currently running.\n\n For example, on Android, this would return 27 for Oreo 8.1.\n If the version number cannot be determined then this will return -1.\n\n @return version number or -1"] #[link_name = "\u{1}_ZN4oboe13getSdkVersionEv"] pub fn oboe_getSdkVersion() -> ::std::os::raw::c_int; } @@ -1027,21 +705,12 @@ fn bindgen_test_layout_oboe_AudioStreamBuilder() { ); } extern "C" { - #[doc = " Is the AAudio API supported on this device?"] - #[doc = ""] - #[doc = " AAudio was introduced in the Oreo 8.0 release."] - #[doc = ""] - #[doc = " @return true if supported"] + #[doc = " Is the AAudio API supported on this device?\n\n AAudio was introduced in the Oreo 8.0 release.\n\n @return true if supported"] #[link_name = "\u{1}_ZN4oboe18AudioStreamBuilder17isAAudioSupportedEv"] pub fn oboe_AudioStreamBuilder_isAAudioSupported() -> bool; } extern "C" { - #[doc = " Is the AAudio API recommended this device?"] - #[doc = ""] - #[doc = " AAudio may be supported but not recommended because of version specific issues."] - #[doc = " AAudio is not recommended for Android 8.0 or earlier versions."] - #[doc = ""] - #[doc = " @return true if recommended"] + #[doc = " Is the AAudio API recommended this device?\n\n AAudio may be supported but not recommended because of version specific issues.\n AAudio is not recommended for Android 8.0 or earlier versions.\n\n @return true if recommended"] #[link_name = "\u{1}_ZN4oboe18AudioStreamBuilder19isAAudioRecommendedEv"] pub fn oboe_AudioStreamBuilder_isAAudioRecommended() -> bool; } @@ -1076,10 +745,7 @@ fn bindgen_test_layout_oboe_AudioStream() { ); } extern "C" { - #[doc = " Get the number of bytes per sample. This is calculated using the sample format. For example,"] - #[doc = " a stream using 16-bit integer samples will have 2 bytes per sample."] - #[doc = ""] - #[doc = " @return the number of bytes per sample."] + #[doc = " Get the number of bytes per sample. This is calculated using the sample format. For example,\n a stream using 16-bit integer samples will have 2 bytes per sample.\n\n @return the number of bytes per sample."] #[link_name = "\u{1}_ZNK4oboe11AudioStream17getBytesPerSampleEv"] pub fn oboe_AudioStream_getBytesPerSample(this: *const oboe_AudioStream) -> i32; } @@ -1091,13 +757,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Wait until the stream has a minimum amount of data available in its buffer."] - #[doc = " This can be used with an EXCLUSIVE MMAP input stream to avoid reading data too close to"] - #[doc = " the DSP write position, which may cause glitches."] - #[doc = ""] - #[doc = " @param numFrames minimum frames available"] - #[doc = " @param timeoutNanoseconds"] - #[doc = " @return number of frames available, ErrorTimeout"] + #[doc = " Wait until the stream has a minimum amount of data available in its buffer.\n This can be used with an EXCLUSIVE MMAP input stream to avoid reading data too close to\n the DSP write position, which may cause glitches.\n\n @param numFrames minimum frames available\n @param timeoutNanoseconds\n @return number of frames available, ErrorTimeout"] #[link_name = "\u{1}_ZN4oboe11AudioStream22waitForAvailableFramesEix"] pub fn oboe_AudioStream_waitForAvailableFrames( this: *mut oboe_AudioStream, @@ -1106,12 +766,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Override this to provide your own behaviour for the audio callback"] - #[doc = ""] - #[doc = " @param audioData container array which audio frames will be written into or read from"] - #[doc = " @param numFrames number of frames which were read/written"] - #[doc = " @return the result of the callback: stop or continue"] - #[doc = ""] + #[doc = " Override this to provide your own behaviour for the audio callback\n\n @param audioData container array which audio frames will be written into or read from\n @param numFrames number of frames which were read/written\n @return the result of the callback: stop or continue\n"] #[link_name = "\u{1}_ZN4oboe11AudioStream16fireDataCallbackEPvi"] pub fn oboe_AudioStream_fireDataCallback( this: *mut oboe_AudioStream, @@ -1120,15 +775,12 @@ extern "C" { ) -> oboe_DataCallbackResult; } extern "C" { - #[doc = " This should only be called as a stream is being opened."] - #[doc = " Otherwise we might override setDelayBeforeCloseMillis()."] + #[doc = " This should only be called as a stream is being opened.\n Otherwise we might override setDelayBeforeCloseMillis()."] #[link_name = "\u{1}_ZN4oboe11AudioStream38calculateDefaultDelayBeforeCloseMillisEv"] pub fn oboe_AudioStream_calculateDefaultDelayBeforeCloseMillis(this: *mut oboe_AudioStream); } extern "C" { - #[doc = " Construct an `AudioStream` using the given `AudioStreamBuilder`"] - #[doc = ""] - #[doc = " @param builder containing all the stream's attributes"] + #[doc = " Construct an `AudioStream` using the given `AudioStreamBuilder`\n\n @param builder containing all the stream's attributes"] #[link_name = "\u{1}_ZN4oboe11AudioStreamC2ERKNS_18AudioStreamBuilderE"] pub fn oboe_AudioStream_AudioStream( this: *mut oboe_AudioStream, @@ -1177,8 +829,7 @@ extern "C" { pub fn oboe_AudioStream_close(this: *mut ::std::os::raw::c_void) -> oboe_Result; } extern "C" { - #[doc = " Start the stream. This will block until the stream has been started, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Start the stream. This will block until the stream has been started, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5startEx"] pub fn oboe_AudioStream_start( this: *mut ::std::os::raw::c_void, @@ -1186,8 +837,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Pause the stream. This will block until the stream has been paused, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Pause the stream. This will block until the stream has been paused, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5pauseEx"] pub fn oboe_AudioStream_pause( this: *mut ::std::os::raw::c_void, @@ -1195,8 +845,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Flush the stream. This will block until the stream has been flushed, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Flush the stream. This will block until the stream has been flushed, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5flushEx"] pub fn oboe_AudioStream_flush( this: *mut ::std::os::raw::c_void, @@ -1204,8 +853,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Stop the stream. This will block until the stream has been stopped, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Stop the stream. This will block until the stream has been stopped, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream4stopEx"] pub fn oboe_AudioStream_stop( this: *mut ::std::os::raw::c_void, @@ -1213,40 +861,17 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " The number of audio frames written into the stream."] - #[doc = " This monotonic counter will never get reset."] - #[doc = ""] - #[doc = " @return the number of frames written so far"] + #[doc = " The number of audio frames written into the stream.\n This monotonic counter will never get reset.\n\n @return the number of frames written so far"] #[link_name = "\u{1}_ZN4oboe11AudioStream16getFramesWrittenEv"] pub fn oboe_AudioStream_getFramesWritten(this: *mut ::std::os::raw::c_void) -> i64; } extern "C" { - #[doc = " The number of audio frames read from the stream."] - #[doc = " This monotonic counter will never get reset."] - #[doc = ""] - #[doc = " @return the number of frames read so far"] + #[doc = " The number of audio frames read from the stream.\n This monotonic counter will never get reset.\n\n @return the number of frames read so far"] #[link_name = "\u{1}_ZN4oboe11AudioStream13getFramesReadEv"] pub fn oboe_AudioStream_getFramesRead(this: *mut ::std::os::raw::c_void) -> i64; } extern "C" { - #[doc = " Get the estimated time that the frame at `framePosition` entered or left the audio processing"] - #[doc = " pipeline."] - #[doc = ""] - #[doc = " This can be used to coordinate events and interactions with the external environment, and to"] - #[doc = " estimate the latency of an audio stream. An example of usage can be found in the hello-oboe"] - #[doc = " sample (search for \"calculateCurrentOutputLatencyMillis\")."] - #[doc = ""] - #[doc = " The time is based on the implementation's best effort, using whatever knowledge is available"] - #[doc = " to the system, but cannot account for any delay unknown to the implementation."] - #[doc = ""] - #[doc = " Note that due to issues in Android before R, we recommend NOT calling"] - #[doc = " this method from a data callback. See this tech note for more details."] - #[doc = " https://github.com/google/oboe/blob/main/docs/notes/rlsbuffer.md"] - #[doc = ""] - #[doc = " See"] - #[doc = " @param clockId the type of clock to use e.g. CLOCK_MONOTONIC"] - #[doc = " @return a FrameTimestamp containing the position and time at which a particular audio frame"] - #[doc = " entered or left the audio processing pipeline, or an error if the operation failed."] + #[doc = " Get the estimated time that the frame at `framePosition` entered or left the audio processing\n pipeline.\n\n This can be used to coordinate events and interactions with the external environment, and to\n estimate the latency of an audio stream. An example of usage can be found in the hello-oboe\n sample (search for \"calculateCurrentOutputLatencyMillis\").\n\n The time is based on the implementation's best effort, using whatever knowledge is available\n to the system, but cannot account for any delay unknown to the implementation.\n\n Note that due to issues in Android before R, we recommend NOT calling\n this method from a data callback. See this tech note for more details.\n https://github.com/google/oboe/blob/main/docs/notes/rlsbuffer.md\n\n See\n @param clockId the type of clock to use e.g. CLOCK_MONOTONIC\n @return a FrameTimestamp containing the position and time at which a particular audio frame\n entered or left the audio processing pipeline, or an error if the operation failed."] #[link_name = "\u{1}_ZN4oboe11AudioStream12getTimestampEi"] pub fn oboe_AudioStream_getTimestamp( this: *mut ::std::os::raw::c_void, @@ -1254,10 +879,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Wait for a transition from one state to another."] - #[doc = " @return OK if the endingState was observed, or ErrorUnexpectedState"] - #[doc = " if any state that was not the startingState or endingState was observed"] - #[doc = " or ErrorTimeout."] + #[doc = " Wait for a transition from one state to another.\n @return OK if the endingState was observed, or ErrorUnexpectedState\n if any state that was not the startingState or endingState was observed\n or ErrorTimeout."] #[link_name = "\u{1}_ZN4oboe11AudioStream22waitForStateTransitionENS_11StreamStateES1_x"] pub fn oboe_AudioStream_waitForStateTransition( this: *mut ::std::os::raw::c_void, @@ -1267,8 +889,7 @@ extern "C" { ) -> oboe_Result; } pub const oboe_AudioStream_kMinDelayBeforeCloseMillis: ::std::os::raw::c_int = 10; -#[doc = " This struct is a stateless functor which closes an AudioStream prior to its deletion."] -#[doc = " This means it can be used to safely delete a smart pointer referring to an open stream."] +#[doc = " This struct is a stateless functor which closes an AudioStream prior to its deletion.\n This means it can be used to safely delete a smart pointer referring to an open stream."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_StreamDeleterFunctor { @@ -1287,18 +908,7 @@ fn bindgen_test_layout_oboe_StreamDeleterFunctor() { concat!("Alignment of ", stringify!(oboe_StreamDeleterFunctor)) ); } -#[doc = " LatencyTuner can be used to dynamically tune the latency of an output stream."] -#[doc = " It adjusts the stream's bufferSize by monitoring the number of underruns."] -#[doc = ""] -#[doc = " This only affects the latency associated with the first level of buffering that is closest"] -#[doc = " to the application. It does not affect low latency in the HAL, or touch latency in the UI."] -#[doc = ""] -#[doc = " Call tune() right before returning from your data callback function if using callbacks."] -#[doc = " Call tune() right before calling write() if using blocking writes."] -#[doc = ""] -#[doc = " If you want to see the ongoing results of this tuning process then call"] -#[doc = " stream->getBufferSize() periodically."] -#[doc = ""] +#[doc = " LatencyTuner can be used to dynamically tune the latency of an output stream.\n It adjusts the stream's bufferSize by monitoring the number of underruns.\n\n This only affects the latency associated with the first level of buffering that is closest\n to the application. It does not affect low latency in the HAL, or touch latency in the UI.\n\n Call tune() right before returning from your data callback function if using callbacks.\n Call tune() right before calling write() if using blocking writes.\n\n If you want to see the ongoing results of this tuning process then call\n stream->getBufferSize() periodically.\n"] #[repr(C)] #[repr(align(4))] #[derive(Debug, Copy, Clone)] @@ -1324,36 +934,22 @@ fn bindgen_test_layout_oboe_LatencyTuner() { ); } extern "C" { - #[doc = " Adjust the bufferSizeInFrames to optimize latency."] - #[doc = " It will start with a low latency and then raise it if an underrun occurs."] - #[doc = ""] - #[doc = " Latency tuning is only supported for AAudio."] - #[doc = ""] - #[doc = " @return OK or negative error, ErrorUnimplemented for OpenSL ES"] + #[doc = " Adjust the bufferSizeInFrames to optimize latency.\n It will start with a low latency and then raise it if an underrun occurs.\n\n Latency tuning is only supported for AAudio.\n\n @return OK or negative error, ErrorUnimplemented for OpenSL ES"] #[link_name = "\u{1}_ZN4oboe12LatencyTuner4tuneEv"] pub fn oboe_LatencyTuner_tune(this: *mut oboe_LatencyTuner) -> oboe_Result; } extern "C" { - #[doc = " This may be called from another thread. Then tune() will call reset(),"] - #[doc = " which will lower the latency to the minimum and then allow it to rise back up"] - #[doc = " if there are glitches."] - #[doc = ""] - #[doc = " This is typically called in response to a user decision to minimize latency. In other words,"] - #[doc = " call this from a button handler."] + #[doc = " This may be called from another thread. Then tune() will call reset(),\n which will lower the latency to the minimum and then allow it to rise back up\n if there are glitches.\n\n This is typically called in response to a user decision to minimize latency. In other words,\n call this from a button handler."] #[link_name = "\u{1}_ZN4oboe12LatencyTuner12requestResetEv"] pub fn oboe_LatencyTuner_requestReset(this: *mut oboe_LatencyTuner); } extern "C" { - #[doc = " @return true if the audio stream's buffer size is at the maximum value. If no maximum value"] - #[doc = " was specified when constructing the LatencyTuner then the value of"] - #[doc = " stream->getBufferCapacityInFrames is used"] + #[doc = " @return true if the audio stream's buffer size is at the maximum value. If no maximum value\n was specified when constructing the LatencyTuner then the value of\n stream->getBufferCapacityInFrames is used"] #[link_name = "\u{1}_ZN4oboe12LatencyTuner21isAtMaximumBufferSizeEv"] pub fn oboe_LatencyTuner_isAtMaximumBufferSize(this: *mut oboe_LatencyTuner) -> bool; } extern "C" { - #[doc = " Construct a new LatencyTuner object which will act on the given audio stream"] - #[doc = ""] - #[doc = " @param stream the stream who's latency will be tuned"] + #[doc = " Construct a new LatencyTuner object which will act on the given audio stream\n\n @param stream the stream who's latency will be tuned"] #[link_name = "\u{1}_ZN4oboe12LatencyTunerC1ERNS_11AudioStreamE"] pub fn oboe_LatencyTuner_LatencyTuner( this: *mut oboe_LatencyTuner, @@ -1361,10 +957,7 @@ extern "C" { ); } extern "C" { - #[doc = " Construct a new LatencyTuner object which will act on the given audio stream."] - #[doc = ""] - #[doc = " @param stream the stream who's latency will be tuned"] - #[doc = " @param the maximum buffer size which the tune() operation will set the buffer size to"] + #[doc = " Construct a new LatencyTuner object which will act on the given audio stream.\n\n @param stream the stream who's latency will be tuned\n @param the maximum buffer size which the tune() operation will set the buffer size to"] #[link_name = "\u{1}_ZN4oboe12LatencyTunerC1ERNS_11AudioStreamEi"] pub fn oboe_LatencyTuner_LatencyTuner1( this: *mut oboe_LatencyTuner, @@ -1408,16 +1001,13 @@ pub struct oboe_Version { } #[doc = " This is incremented when we make breaking API changes. Based loosely on https://semver.org/."] pub const oboe_Version_Major: u8 = 1; -#[doc = " This is incremented when we add backwards compatible functionality. Or set to zero when MAJOR is"] -#[doc = " incremented."] +#[doc = " This is incremented when we add backwards compatible functionality. Or set to zero when MAJOR is\n incremented."] pub const oboe_Version_Minor: u8 = 7; -#[doc = " This is incremented when we make backwards compatible bug fixes. Or set to zero when MINOR is"] -#[doc = " incremented."] +#[doc = " This is incremented when we make backwards compatible bug fixes. Or set to zero when MINOR is\n incremented."] pub const oboe_Version_Patch: u16 = 0; #[doc = " Version string in the form MAJOR.MINOR.PATCH."] pub const oboe_Version_Text: &[u8; 6usize] = b"1.7.0\0"; -#[doc = " Integer representation of the current Oboe library version. This will always increase when the"] -#[doc = " version number changes so can be compared using integer comparison."] +#[doc = " Integer representation of the current Oboe library version. This will always increase when the\n version number changes so can be compared using integer comparison."] pub const oboe_Version_Number: u32 = 17235968; #[test] fn bindgen_test_layout_oboe_Version() { @@ -1443,6 +1033,9 @@ pub struct oboe_StabilizedCallback { } #[test] fn bindgen_test_layout_oboe_StabilizedCallback() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 40usize, @@ -1453,74 +1046,46 @@ fn bindgen_test_layout_oboe_StabilizedCallback() { 8usize, concat!("Alignment of ", stringify!(oboe_StabilizedCallback)) ); - fn test_field_mCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mCallback) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mCallback) - ) - ); - } - test_field_mCallback(); - fn test_field_mFrameCount() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFrameCount) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mFrameCount) - ) - ); - } - test_field_mFrameCount(); - fn test_field_mEpochTimeNanos() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mEpochTimeNanos) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mEpochTimeNanos) - ) - ); - } - test_field_mEpochTimeNanos(); - fn test_field_mOpsPerNano() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mOpsPerNano) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mOpsPerNano) - ) - ); - } - test_field_mOpsPerNano(); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mCallback) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFrameCount) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mFrameCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mEpochTimeNanos) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mEpochTimeNanos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mOpsPerNano) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mOpsPerNano) + ) + ); } extern "C" { #[link_name = "\u{1}_ZN4oboe18StabilizedCallbackC1EPNS_19AudioStreamCallbackE"] @@ -1546,6 +1111,7 @@ extern "C" { numFrames: i32, ) -> oboe_DataCallbackResult; } +pub type oboe_AudioStreamShared = [u32; 2usize]; pub type oboe_DropContextHandler = ::std::option::Option; pub type oboe_AudioReadyHandler = ::std::option::Option< @@ -1650,10 +1216,6 @@ extern "C" { error: oboe_Result, ); } -extern "C" { - #[link_name = "\u{1}_ZN4oboe33AudioStreamCallbackWrapper_deleteEPv"] - pub fn oboe_AudioStreamCallbackWrapper_delete(callback: *mut ::std::os::raw::c_void); -} extern "C" { #[link_name = "\u{1}_ZN4oboe22AudioStreamBuilder_newEv"] pub fn oboe_AudioStreamBuilder_new() -> *mut oboe_AudioStreamBuilder; @@ -1671,7 +1233,7 @@ extern "C" { audio_ready: oboe_AudioReadyHandler, before_close: oboe_ErrorCloseHandler, after_close: oboe_ErrorCloseHandler, - ) -> *mut ::std::os::raw::c_void; + ); } extern "C" { #[link_name = "\u{1}_ZN4oboe30AudioStreamBuilder_getAudioApiEPKNS_18AudioStreamBuilderE"] @@ -1693,11 +1255,10 @@ extern "C" { ) -> *mut oboe_AudioStreamBase; } extern "C" { - #[link_name = "\u{1}_ZN4oboe35AudioStreamBuilder_openStreamSharedEPNS_18AudioStreamBuilderEPPNS_11AudioStreamEPPv"] + #[link_name = "\u{1}_ZN4oboe35AudioStreamBuilder_openStreamSharedEPNS_18AudioStreamBuilderEPNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] pub fn oboe_AudioStreamBuilder_openStreamShared( builder: *mut oboe_AudioStreamBuilder, - stream: *mut *mut oboe_AudioStream, - shared_ptr: *mut *mut ::std::os::raw::c_void, + sharedStream: *mut oboe_AudioStreamShared, ) -> oboe_Result; } extern "C" { @@ -1705,8 +1266,21 @@ extern "C" { pub fn oboe_AudioStream_delete(oboeStream: *mut oboe_AudioStream); } extern "C" { - #[link_name = "\u{1}_ZN4oboe24AudioStream_deleteSharedEPv"] - pub fn oboe_AudioStream_deleteShared(shared_ptr: *mut ::std::os::raw::c_void); + #[link_name = "\u{1}_ZN4oboe23AudioStream_cloneSharedEPKNSt6__ndk110shared_ptrINS_11AudioStreamEEEPS3_"] + pub fn oboe_AudioStream_cloneShared( + sharedStream: *const oboe_AudioStreamShared, + newSharedStream: *mut oboe_AudioStreamShared, + ); +} +extern "C" { + #[link_name = "\u{1}_ZN4oboe24AudioStream_deleteSharedEPNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] + pub fn oboe_AudioStream_deleteShared(sharedStream: *mut oboe_AudioStreamShared); +} +extern "C" { + #[link_name = "\u{1}_ZN4oboe23AudioStream_derefSharedEPKNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] + pub fn oboe_AudioStream_derefShared( + sharedStream: *const oboe_AudioStreamShared, + ) -> *const oboe_AudioStream; } extern "C" { #[link_name = "\u{1}_ZN4oboe16AudioStream_openEPNS_11AudioStreamE"] diff --git a/sys/src/bindings_i686.rs b/sys/src/bindings_i686.rs index b00cd80..b5d8153 100644 --- a/sys/src/bindings_i686.rs +++ b/sys/src/bindings_i686.rs @@ -1,11 +1,6 @@ -/* automatically generated by rust-bindgen 0.60.1 */ +/* automatically generated by rust-bindgen 0.63.0 */ pub type std_string = [u32; 3usize]; -pub type __uint8_t = ::std::os::raw::c_uchar; -pub type __uint16_t = ::std::os::raw::c_ushort; -pub type __int32_t = ::std::os::raw::c_int; -pub type __uint32_t = ::std::os::raw::c_uint; -pub type __int64_t = ::std::os::raw::c_longlong; pub const oboe_StreamState_Uninitialized: oboe_StreamState = 0; pub const oboe_StreamState_Unknown: oboe_StreamState = 1; pub const oboe_StreamState_Open: oboe_StreamState = 2; @@ -34,27 +29,11 @@ pub const oboe_AudioFormat_Invalid: oboe_AudioFormat = -1; pub const oboe_AudioFormat_Unspecified: oboe_AudioFormat = 0; #[doc = " Signed 16-bit integers."] pub const oboe_AudioFormat_I16: oboe_AudioFormat = 1; -#[doc = " Single precision floating point."] -#[doc = ""] -#[doc = " This is the recommended format for most applications."] -#[doc = " But note that the use of Float may prevent the opening of"] -#[doc = " a low-latency input path on OpenSL ES or Legacy AAudio streams."] +#[doc = " Single precision floating point.\n\n This is the recommended format for most applications.\n But note that the use of Float may prevent the opening of\n a low-latency input path on OpenSL ES or Legacy AAudio streams."] pub const oboe_AudioFormat_Float: oboe_AudioFormat = 2; -#[doc = " Signed 24-bit integers, packed into 3 bytes."] -#[doc = ""] -#[doc = " Note that the use of this format does not guarantee that"] -#[doc = " the full precision will be provided. The underlying device may"] -#[doc = " be using I16 format."] -#[doc = ""] -#[doc = " Added in API 31 (S)."] +#[doc = " Signed 24-bit integers, packed into 3 bytes.\n\n Note that the use of this format does not guarantee that\n the full precision will be provided. The underlying device may\n be using I16 format.\n\n Added in API 31 (S)."] pub const oboe_AudioFormat_I24: oboe_AudioFormat = 3; -#[doc = " Signed 32-bit integers."] -#[doc = ""] -#[doc = " Note that the use of this format does not guarantee that"] -#[doc = " the full precision will be provided. The underlying device may"] -#[doc = " be using I16 format."] -#[doc = ""] -#[doc = " Added in API 31 (S)."] +#[doc = " Signed 32-bit integers.\n\n Note that the use of this format does not guarantee that\n the full precision will be provided. The underlying device may\n be using I16 format.\n\n Added in API 31 (S)."] pub const oboe_AudioFormat_I32: oboe_AudioFormat = 4; #[doc = " The format of audio samples."] pub type oboe_AudioFormat = i32; @@ -91,21 +70,11 @@ pub const oboe_Result_Reserved8: oboe_Result = -872; pub const oboe_Result_Reserved9: oboe_Result = -871; pub const oboe_Result_Reserved10: oboe_Result = -870; pub const oboe_Result_ErrorClosed: oboe_Result = -869; -#[doc = " The result of an operation. All except the `OK` result indicates that an error occurred."] -#[doc = " The `Result` can be converted into a human readable string using `convertToText`."] +#[doc = " The result of an operation. All except the `OK` result indicates that an error occurred.\n The `Result` can be converted into a human readable string using `convertToText`."] pub type oboe_Result = i32; -#[doc = " This will be the only stream using a particular source or sink."] -#[doc = " This mode will provide the lowest possible latency."] -#[doc = " You should close EXCLUSIVE streams immediately when you are not using them."] -#[doc = ""] -#[doc = " If you do not need the lowest possible latency then we recommend using Shared,"] -#[doc = " which is the default."] +#[doc = " This will be the only stream using a particular source or sink.\n This mode will provide the lowest possible latency.\n You should close EXCLUSIVE streams immediately when you are not using them.\n\n If you do not need the lowest possible latency then we recommend using Shared,\n which is the default."] pub const oboe_SharingMode_Exclusive: oboe_SharingMode = 0; -#[doc = " Multiple applications can share the same device."] -#[doc = " The data from output streams will be mixed by the audio service."] -#[doc = " The data for input streams will be distributed by the audio service."] -#[doc = ""] -#[doc = " This will have higher latency than the EXCLUSIVE mode."] +#[doc = " Multiple applications can share the same device.\n The data from output streams will be mixed by the audio service.\n The data for input streams will be distributed by the audio service.\n\n This will have higher latency than the EXCLUSIVE mode."] pub const oboe_SharingMode_Shared: oboe_SharingMode = 1; #[doc = " The sharing mode of the audio stream."] pub type oboe_SharingMode = i32; @@ -119,19 +88,15 @@ pub const oboe_PerformanceMode_LowLatency: oboe_PerformanceMode = 12; pub type oboe_PerformanceMode = i32; #[doc = " Try to use AAudio. If not available then use OpenSL ES."] pub const oboe_AudioApi_Unspecified: oboe_AudioApi = 0; -#[doc = " Use OpenSL ES."] -#[doc = " Note that OpenSL ES is deprecated in Android 13, API 30 and above."] +#[doc = " Use OpenSL ES.\n Note that OpenSL ES is deprecated in Android 13, API 30 and above."] pub const oboe_AudioApi_OpenSLES: oboe_AudioApi = 1; -#[doc = " Try to use AAudio. Fail if unavailable."] -#[doc = " AAudio was first supported in Android 8, API 26 and above."] -#[doc = " It is only recommended for API 27 and above."] +#[doc = " Try to use AAudio. Fail if unavailable.\n AAudio was first supported in Android 8, API 26 and above.\n It is only recommended for API 27 and above."] pub const oboe_AudioApi_AAudio: oboe_AudioApi = 2; #[doc = " The underlying audio API used by the audio stream."] pub type oboe_AudioApi = i32; #[doc = " No conversion by Oboe. Underlying APIs may still do conversion."] pub const oboe_SampleRateConversionQuality_None: oboe_SampleRateConversionQuality = 0; -#[doc = " Fastest conversion but may not sound great."] -#[doc = " This may be implemented using bilinear interpolation."] +#[doc = " Fastest conversion but may not sound great.\n This may be implemented using bilinear interpolation."] pub const oboe_SampleRateConversionQuality_Fastest: oboe_SampleRateConversionQuality = 1; #[doc = " Low quality conversion with 8 taps."] pub const oboe_SampleRateConversionQuality_Low: oboe_SampleRateConversionQuality = 2; @@ -141,9 +106,7 @@ pub const oboe_SampleRateConversionQuality_Medium: oboe_SampleRateConversionQual pub const oboe_SampleRateConversionQuality_High: oboe_SampleRateConversionQuality = 4; #[doc = " Highest quality conversion, which may be expensive in terms of CPU."] pub const oboe_SampleRateConversionQuality_Best: oboe_SampleRateConversionQuality = 5; -#[doc = " Specifies the quality of the sample rate conversion performed by Oboe."] -#[doc = " Higher quality will require more CPU load."] -#[doc = " Higher quality conversion will probably be implemented using a sinc based resampler."] +#[doc = " Specifies the quality of the sample rate conversion performed by Oboe.\n Higher quality will require more CPU load.\n Higher quality conversion will probably be implemented using a sinc based resampler."] pub type oboe_SampleRateConversionQuality = i32; #[doc = " Use this for streaming media, music performance, video, podcasts, etcetera."] pub const oboe_Usage_Media: oboe_Usage = 1; @@ -153,8 +116,7 @@ pub const oboe_Usage_VoiceCommunication: oboe_Usage = 2; pub const oboe_Usage_VoiceCommunicationSignalling: oboe_Usage = 3; #[doc = " Use this to demand the users attention."] pub const oboe_Usage_Alarm: oboe_Usage = 4; -#[doc = " Use this for notifying the user when a message has arrived or some"] -#[doc = " other background event has occured."] +#[doc = " Use this for notifying the user when a message has arrived or some\n other background event has occured."] pub const oboe_Usage_Notification: oboe_Usage = 5; #[doc = " Use this when the phone rings."] pub const oboe_Usage_NotificationRingtone: oboe_Usage = 6; @@ -170,13 +132,7 @@ pub const oboe_Usage_AssistanceSonification: oboe_Usage = 13; pub const oboe_Usage_Game: oboe_Usage = 14; #[doc = " Use this for audio responses to user queries, audio instructions or help utterances."] pub const oboe_Usage_Assistant: oboe_Usage = 16; -#[doc = " The Usage attribute expresses *why* you are playing a sound, what is this sound used for."] -#[doc = " This information is used by certain platforms or routing policies"] -#[doc = " to make more refined volume or routing decisions."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in AudioAttributes in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " The Usage attribute expresses *why* you are playing a sound, what is this sound used for.\n This information is used by certain platforms or routing policies\n to make more refined volume or routing decisions.\n\n Note that these match the equivalent values in AudioAttributes in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_Usage = i32; #[doc = " Use this for spoken voice, audio books, etcetera."] pub const oboe_ContentType_Speech: oboe_ContentType = 1; @@ -184,19 +140,9 @@ pub const oboe_ContentType_Speech: oboe_ContentType = 1; pub const oboe_ContentType_Music: oboe_ContentType = 2; #[doc = " Use this for a movie or video soundtrack."] pub const oboe_ContentType_Movie: oboe_ContentType = 3; -#[doc = " Use this for sound is designed to accompany a user action,"] -#[doc = " such as a click or beep sound made when the user presses a button."] +#[doc = " Use this for sound is designed to accompany a user action,\n such as a click or beep sound made when the user presses a button."] pub const oboe_ContentType_Sonification: oboe_ContentType = 4; -#[doc = " The ContentType attribute describes *what* you are playing."] -#[doc = " It expresses the general category of the content. This information is optional."] -#[doc = " But in case it is known (for instance {@link Movie} for a"] -#[doc = " movie streaming service or {@link Speech} for"] -#[doc = " an audio book application) this information might be used by the audio framework to"] -#[doc = " enforce audio focus."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in AudioAttributes in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " The ContentType attribute describes *what* you are playing.\n It expresses the general category of the content. This information is optional.\n But in case it is known (for instance {@link Movie} for a\n movie streaming service or {@link Speech} for\n an audio book application) this information might be used by the audio framework to\n enforce audio focus.\n\n Note that these match the equivalent values in AudioAttributes in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_ContentType = i32; #[doc = " Use this preset when other presets do not apply."] pub const oboe_InputPreset_Generic: oboe_InputPreset = 1; @@ -206,35 +152,17 @@ pub const oboe_InputPreset_Camcorder: oboe_InputPreset = 5; pub const oboe_InputPreset_VoiceRecognition: oboe_InputPreset = 6; #[doc = " Use this preset when doing telephony or voice messaging."] pub const oboe_InputPreset_VoiceCommunication: oboe_InputPreset = 7; -#[doc = " Use this preset to obtain an input with no effects."] -#[doc = " Note that this input will not have automatic gain control"] -#[doc = " so the recorded volume may be very low."] +#[doc = " Use this preset to obtain an input with no effects.\n Note that this input will not have automatic gain control\n so the recorded volume may be very low."] pub const oboe_InputPreset_Unprocessed: oboe_InputPreset = 9; -#[doc = " Use this preset for capturing audio meant to be processed in real time"] -#[doc = " and played back for live performance (e.g karaoke)."] -#[doc = " The capture path will minimize latency and coupling with playback path."] +#[doc = " Use this preset for capturing audio meant to be processed in real time\n and played back for live performance (e.g karaoke).\n The capture path will minimize latency and coupling with playback path."] pub const oboe_InputPreset_VoicePerformance: oboe_InputPreset = 10; -#[doc = " Defines the audio source."] -#[doc = " An audio source defines both a default physical source of audio signal, and a recording"] -#[doc = " configuration."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " Defines the audio source.\n An audio source defines both a default physical source of audio signal, and a recording\n configuration.\n\n Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_InputPreset = i32; -#[doc = " Do not allocate a session ID."] -#[doc = " Effects cannot be used with this stream."] -#[doc = " Default."] +#[doc = " Do not allocate a session ID.\n Effects cannot be used with this stream.\n Default."] pub const oboe_SessionId_None: oboe_SessionId = -1; -#[doc = " Allocate a session ID that can be used to attach and control"] -#[doc = " effects using the Java AudioEffects API."] -#[doc = " Note that the use of this flag may result in higher latency."] -#[doc = ""] -#[doc = " Note that this matches the value of AudioManager.AUDIO_SESSION_ID_GENERATE."] +#[doc = " Allocate a session ID that can be used to attach and control\n effects using the Java AudioEffects API.\n Note that the use of this flag may result in higher latency.\n\n Note that this matches the value of AudioManager.AUDIO_SESSION_ID_GENERATE."] pub const oboe_SessionId_Allocate: oboe_SessionId = 0; -#[doc = " This attribute can be used to allocate a session ID to the audio stream."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " This attribute can be used to allocate a session ID to the audio stream.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_SessionId = ::std::os::raw::c_int; #[doc = " Audio channel count definition, use Mono or Stereo"] pub const oboe_ChannelCount_Unspecified: oboe_ChannelCount = 0; @@ -242,14 +170,7 @@ pub const oboe_ChannelCount_Unspecified: oboe_ChannelCount = 0; pub const oboe_ChannelCount_Mono: oboe_ChannelCount = 1; #[doc = " Use this for stereo audio."] pub const oboe_ChannelCount_Stereo: oboe_ChannelCount = 2; -#[doc = " The channel count of the audio stream. The underlying type is `int32_t`."] -#[doc = " Use of this enum is convenient to avoid \"magic\""] -#[doc = " numbers when specifying the channel count."] -#[doc = ""] -#[doc = " For example, you can write"] -#[doc = " `builder.setChannelCount(ChannelCount::Stereo)`"] -#[doc = " rather than `builder.setChannelCount(2)`"] -#[doc = ""] +#[doc = " The channel count of the audio stream. The underlying type is `int32_t`.\n Use of this enum is convenient to avoid \"magic\"\n numbers when specifying the channel count.\n\n For example, you can write\n `builder.setChannelCount(ChannelCount::Stereo)`\n rather than `builder.setChannelCount(2)`\n"] pub type oboe_ChannelCount = i32; pub const oboe_ChannelMask_Unspecified: oboe_ChannelMask = 0; pub const oboe_ChannelMask_FrontLeft: oboe_ChannelMask = 1; @@ -303,30 +224,9 @@ pub const oboe_ChannelMask_CM7Point1Point4: oboe_ChannelMask = 185919; pub const oboe_ChannelMask_CM9Point1Point4: oboe_ChannelMask = 50517567; pub const oboe_ChannelMask_CM9Point1Point6: oboe_ChannelMask = 51303999; pub const oboe_ChannelMask_FrontBack: oboe_ChannelMask = 260; -#[doc = " The channel mask of the audio stream. The underlying type is `uint32_t`."] -#[doc = " Use of this enum is convenient."] -#[doc = ""] -#[doc = " ChannelMask::Unspecified means this is not specified."] -#[doc = " The rest of the enums are channel position masks."] -#[doc = " Use the combinations of the channel position masks defined below instead of"] -#[doc = " using those values directly."] +#[doc = " The channel mask of the audio stream. The underlying type is `uint32_t`.\n Use of this enum is convenient.\n\n ChannelMask::Unspecified means this is not specified.\n The rest of the enums are channel position masks.\n Use the combinations of the channel position masks defined below instead of\n using those values directly."] pub type oboe_ChannelMask = u32; -#[doc = " On API 16 to 26 OpenSL ES will be used. When using OpenSL ES the optimal values for sampleRate and"] -#[doc = " framesPerBurst are not known by the native code."] -#[doc = " On API 17+ these values should be obtained from the AudioManager using this code:"] -#[doc = ""] -#[doc = "
"]
-#[doc = " // Note that this technique only works for built-in speakers and headphones."]
-#[doc = " AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);"]
-#[doc = " String sampleRateStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);"]
-#[doc = " int defaultSampleRate = Integer.parseInt(sampleRateStr);"]
-#[doc = " String framesPerBurstStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);"]
-#[doc = " int defaultFramesPerBurst = Integer.parseInt(framesPerBurstStr);"]
-#[doc = " 
"] -#[doc = ""] -#[doc = " It can then be passed down to Oboe through JNI."] -#[doc = ""] -#[doc = " AAudio will get the optimal framesPerBurst from the HAL and will ignore this value."] +#[doc = " On API 16 to 26 OpenSL ES will be used. When using OpenSL ES the optimal values for sampleRate and\n framesPerBurst are not known by the native code.\n On API 17+ these values should be obtained from the AudioManager using this code:\n\n
\n // Note that this technique only works for built-in speakers and headphones.\n AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);\n String sampleRateStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);\n int defaultSampleRate = Integer.parseInt(sampleRateStr);\n String framesPerBurstStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);\n int defaultFramesPerBurst = Integer.parseInt(framesPerBurstStr);\n 
\n\n It can then be passed down to Oboe through JNI.\n\n AAudio will get the optimal framesPerBurst from the HAL and will ignore this value."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_DefaultStreamValues { @@ -369,6 +269,8 @@ pub struct oboe_FrameTimestamp { } #[test] fn bindgen_test_layout_oboe_FrameTimestamp() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, @@ -379,59 +281,28 @@ fn bindgen_test_layout_oboe_FrameTimestamp() { 4usize, concat!("Alignment of ", stringify!(oboe_FrameTimestamp)) ); - fn test_field_position() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).position) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(oboe_FrameTimestamp), - "::", - stringify!(position) - ) - ); - } - test_field_position(); - fn test_field_timestamp() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(oboe_FrameTimestamp), - "::", - stringify!(timestamp) - ) - ); - } - test_field_timestamp(); -} -#[doc = " A ResultWithValue can store both the result of an operation (either OK or an error) and a value."] -#[doc = ""] -#[doc = " It has been designed for cases where the caller needs to know whether an operation succeeded and,"] -#[doc = " if it did, a value which was obtained during the operation."] -#[doc = ""] -#[doc = " For example, when reading from a stream the caller needs to know the result of the read operation"] -#[doc = " and, if it was successful, how many frames were read. Note that ResultWithValue can be evaluated"] -#[doc = " as a boolean so it's simple to check whether the result is OK."] -#[doc = ""] -#[doc = " "] -#[doc = " ResultWithValue resultOfRead = myStream.read(&buffer, numFrames, timeoutNanoseconds);"] -#[doc = ""] -#[doc = " if (resultOfRead) {"] -#[doc = " LOGD(\"Frames read: %d\", resultOfRead.value());"] -#[doc = " } else {"] -#[doc = " LOGD(\"Error reading from stream: %s\", resultOfRead.error());"] -#[doc = " }"] -#[doc = " "] + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).position) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(oboe_FrameTimestamp), + "::", + stringify!(position) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(oboe_FrameTimestamp), + "::", + stringify!(timestamp) + ) + ); +} +#[doc = " A ResultWithValue can store both the result of an operation (either OK or an error) and a value.\n\n It has been designed for cases where the caller needs to know whether an operation succeeded and,\n if it did, a value which was obtained during the operation.\n\n For example, when reading from a stream the caller needs to know the result of the read operation\n and, if it was successful, how many frames were read. Note that ResultWithValue can be evaluated\n as a boolean so it's simple to check whether the result is OK.\n\n \n ResultWithValue resultOfRead = myStream.read(&buffer, numFrames, timeoutNanoseconds);\n\n if (resultOfRead) {\n LOGD(\"Frames read: %d\", resultOfRead.value());\n } else {\n LOGD(\"Error reading from stream: %s\", resultOfRead.error());\n }\n "] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_ResultWithValue { @@ -441,11 +312,7 @@ pub struct oboe_ResultWithValue { } #[repr(C)] pub struct oboe_AudioStreamDataCallback__bindgen_vtable(::std::os::raw::c_void); -#[doc = " AudioStreamDataCallback defines a callback interface for"] -#[doc = " moving data to/from an audio stream using `onAudioReady`"] -#[doc = " 2) being alerted when a stream has an error using `onError*` methods"] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setDataCallback()."] +#[doc = " AudioStreamDataCallback defines a callback interface for\n moving data to/from an audio stream using `onAudioReady`\n 2) being alerted when a stream has an error using `onError*` methods\n\n It is used with AudioStreamBuilder::setDataCallback()."] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamDataCallback { @@ -466,15 +333,7 @@ fn bindgen_test_layout_oboe_AudioStreamDataCallback() { } #[repr(C)] pub struct oboe_AudioStreamErrorCallback__bindgen_vtable(::std::os::raw::c_void); -#[doc = " AudioStreamErrorCallback defines a callback interface for"] -#[doc = " being alerted when a stream has an error or is disconnected"] -#[doc = " using `onError*` methods."] -#[doc = ""] -#[doc = " Note: This callback is only fired when an AudioStreamCallback is set."] -#[doc = " If you use AudioStream::write() you have to evaluate the return codes of"] -#[doc = " AudioStream::write() to notice errors in the stream."] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setErrorCallback()."] +#[doc = " AudioStreamErrorCallback defines a callback interface for\n being alerted when a stream has an error or is disconnected\n using `onError*` methods.\n\n Note: This callback is only fired when an AudioStreamCallback is set.\n If you use AudioStream::write() you have to evaluate the return codes of\n AudioStream::write() to notice errors in the stream.\n\n It is used with AudioStreamBuilder::setErrorCallback()."] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamErrorCallback { @@ -493,18 +352,7 @@ fn bindgen_test_layout_oboe_AudioStreamErrorCallback() { concat!("Alignment of ", stringify!(oboe_AudioStreamErrorCallback)) ); } -#[doc = " AudioStreamCallback defines a callback interface for:"] -#[doc = ""] -#[doc = " 1) moving data to/from an audio stream using `onAudioReady`"] -#[doc = " 2) being alerted when a stream has an error using `onError*` methods"] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setCallback()."] -#[doc = ""] -#[doc = " It combines the interfaces defined by AudioStreamDataCallback and AudioStreamErrorCallback."] -#[doc = " This was the original callback object. We now recommend using the individual interfaces"] -#[doc = " and using setDataCallback() and setErrorCallback()."] -#[doc = ""] -#[doc = " @deprecated Use `AudioStreamDataCallback` and `AudioStreamErrorCallback` instead"] +#[doc = " AudioStreamCallback defines a callback interface for:\n\n 1) moving data to/from an audio stream using `onAudioReady`\n 2) being alerted when a stream has an error using `onError*` methods\n\n It is used with AudioStreamBuilder::setCallback().\n\n It combines the interfaces defined by AudioStreamDataCallback and AudioStreamErrorCallback.\n This was the original callback object. We now recommend using the individual interfaces\n and using setDataCallback() and setErrorCallback().\n\n @deprecated Use `AudioStreamDataCallback` and `AudioStreamErrorCallback` instead"] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamCallback { @@ -562,8 +410,7 @@ pub struct oboe_AudioStreamBase { pub mUsage: oboe_Usage, #[doc = " Stream content type. Only active on Android 28+"] pub mContentType: oboe_ContentType, - #[doc = " Stream input preset. Only active on Android 28+"] - #[doc = " TODO InputPreset::Unspecified should be considered as a possible default alternative."] + #[doc = " Stream input preset. Only active on Android 28+\n TODO InputPreset::Unspecified should be considered as a possible default alternative."] pub mInputPreset: oboe_InputPreset, #[doc = " Stream session ID allocation strategy. Only active on Android 28+"] pub mSessionId: oboe_SessionId, @@ -577,6 +424,8 @@ pub struct oboe_AudioStreamBase { } #[test] fn bindgen_test_layout_oboe_AudioStreamBase() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 120usize, @@ -587,422 +436,251 @@ fn bindgen_test_layout_oboe_AudioStreamBase() { 4usize, concat!("Alignment of ", stringify!(oboe_AudioStreamBase)) ); - fn test_field_mDataCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDataCallback) as usize - ptr as usize - }, - 4usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDataCallback) - ) - ); - } - test_field_mDataCallback(); - fn test_field_mSharedDataCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharedDataCallback) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharedDataCallback) - ) - ); - } - test_field_mSharedDataCallback(); - fn test_field_mErrorCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mErrorCallback) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mErrorCallback) - ) - ); - } - test_field_mErrorCallback(); - fn test_field_mSharedErrorCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharedErrorCallback) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharedErrorCallback) - ) - ); - } - test_field_mSharedErrorCallback(); - fn test_field_mFramesPerCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFramesPerCallback) as usize - ptr as usize - }, - 28usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFramesPerCallback) - ) - ); - } - test_field_mFramesPerCallback(); - fn test_field_mChannelCount() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelCount) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelCount) - ) - ); - } - test_field_mChannelCount(); - fn test_field_mSampleRate() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSampleRate) as usize - ptr as usize - }, - 36usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSampleRate) - ) - ); - } - test_field_mSampleRate(); - fn test_field_mDeviceId() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDeviceId) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDeviceId) - ) - ); - } - test_field_mDeviceId(); - fn test_field_mBufferCapacityInFrames() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBufferCapacityInFrames) as usize - ptr as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mBufferCapacityInFrames) - ) - ); - } - test_field_mBufferCapacityInFrames(); - fn test_field_mBufferSizeInFrames() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBufferSizeInFrames) as usize - ptr as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mBufferSizeInFrames) - ) - ); - } - test_field_mBufferSizeInFrames(); - fn test_field_mChannelMask() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelMask) as usize - ptr as usize - }, - 52usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelMask) - ) - ); - } - test_field_mChannelMask(); - fn test_field_mSharingMode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharingMode) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharingMode) - ) - ); - } - test_field_mSharingMode(); - fn test_field_mFormat() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFormat) as usize - ptr as usize - }, - 60usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFormat) - ) - ); - } - test_field_mFormat(); - fn test_field_mDirection() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDirection) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDirection) - ) - ); - } - test_field_mDirection(); - fn test_field_mPerformanceMode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mPerformanceMode) as usize - ptr as usize - }, - 68usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mPerformanceMode) - ) - ); - } - test_field_mPerformanceMode(); - fn test_field_mUsage() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mUsage) as usize - ptr as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mUsage) - ) - ); - } - test_field_mUsage(); - fn test_field_mContentType() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mContentType) as usize - ptr as usize - }, - 76usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mContentType) - ) - ); - } - test_field_mContentType(); - fn test_field_mInputPreset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mInputPreset) as usize - ptr as usize - }, - 80usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mInputPreset) - ) - ); - } - test_field_mInputPreset(); - fn test_field_mSessionId() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSessionId) as usize - ptr as usize - }, - 84usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSessionId) - ) - ); - } - test_field_mSessionId(); - fn test_field_mPackageName() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mPackageName) as usize - ptr as usize - }, - 88usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mPackageName) - ) - ); - } - test_field_mPackageName(); - fn test_field_mAttributionTag() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mAttributionTag) as usize - ptr as usize - }, - 100usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mAttributionTag) - ) - ); - } - test_field_mAttributionTag(); - fn test_field_mChannelConversionAllowed() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelConversionAllowed) as usize - ptr as usize - }, - 112usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelConversionAllowed) - ) - ); - } - test_field_mChannelConversionAllowed(); - fn test_field_mFormatConversionAllowed() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFormatConversionAllowed) as usize - ptr as usize - }, - 113usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFormatConversionAllowed) - ) - ); - } - test_field_mFormatConversionAllowed(); - fn test_field_mSampleRateConversionQuality() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSampleRateConversionQuality) as usize - ptr as usize - }, - 116usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSampleRateConversionQuality) - ) - ); - } - test_field_mSampleRateConversionQuality(); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDataCallback) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDataCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharedDataCallback) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharedDataCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mErrorCallback) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mErrorCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharedErrorCallback) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharedErrorCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFramesPerCallback) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFramesPerCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelCount) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSampleRate) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSampleRate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDeviceId) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDeviceId) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mBufferCapacityInFrames) as usize - ptr as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mBufferCapacityInFrames) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mBufferSizeInFrames) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mBufferSizeInFrames) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelMask) as usize - ptr as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelMask) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharingMode) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharingMode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFormat) as usize - ptr as usize }, + 60usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFormat) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDirection) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDirection) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mPerformanceMode) as usize - ptr as usize }, + 68usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mPerformanceMode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mUsage) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mUsage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mContentType) as usize - ptr as usize }, + 76usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mContentType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mInputPreset) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mInputPreset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSessionId) as usize - ptr as usize }, + 84usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSessionId) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mPackageName) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mPackageName) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mAttributionTag) as usize - ptr as usize }, + 100usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mAttributionTag) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelConversionAllowed) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelConversionAllowed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFormatConversionAllowed) as usize - ptr as usize }, + 113usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFormatConversionAllowed) + ) + ); + assert_eq!( + unsafe { + ::std::ptr::addr_of!((*ptr).mSampleRateConversionQuality) as usize - ptr as usize + }, + 116usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSampleRateConversionQuality) + ) + ); } extern "C" { - #[doc = " Return the version of the SDK that is currently running."] - #[doc = ""] - #[doc = " For example, on Android, this would return 27 for Oreo 8.1."] - #[doc = " If the version number cannot be determined then this will return -1."] - #[doc = ""] - #[doc = " @return version number or -1"] + #[doc = " Return the version of the SDK that is currently running.\n\n For example, on Android, this would return 27 for Oreo 8.1.\n If the version number cannot be determined then this will return -1.\n\n @return version number or -1"] #[link_name = "\u{1}_ZN4oboe13getSdkVersionEv"] pub fn oboe_getSdkVersion() -> ::std::os::raw::c_int; } @@ -1027,21 +705,12 @@ fn bindgen_test_layout_oboe_AudioStreamBuilder() { ); } extern "C" { - #[doc = " Is the AAudio API supported on this device?"] - #[doc = ""] - #[doc = " AAudio was introduced in the Oreo 8.0 release."] - #[doc = ""] - #[doc = " @return true if supported"] + #[doc = " Is the AAudio API supported on this device?\n\n AAudio was introduced in the Oreo 8.0 release.\n\n @return true if supported"] #[link_name = "\u{1}_ZN4oboe18AudioStreamBuilder17isAAudioSupportedEv"] pub fn oboe_AudioStreamBuilder_isAAudioSupported() -> bool; } extern "C" { - #[doc = " Is the AAudio API recommended this device?"] - #[doc = ""] - #[doc = " AAudio may be supported but not recommended because of version specific issues."] - #[doc = " AAudio is not recommended for Android 8.0 or earlier versions."] - #[doc = ""] - #[doc = " @return true if recommended"] + #[doc = " Is the AAudio API recommended this device?\n\n AAudio may be supported but not recommended because of version specific issues.\n AAudio is not recommended for Android 8.0 or earlier versions.\n\n @return true if recommended"] #[link_name = "\u{1}_ZN4oboe18AudioStreamBuilder19isAAudioRecommendedEv"] pub fn oboe_AudioStreamBuilder_isAAudioRecommended() -> bool; } @@ -1076,10 +745,7 @@ fn bindgen_test_layout_oboe_AudioStream() { ); } extern "C" { - #[doc = " Get the number of bytes per sample. This is calculated using the sample format. For example,"] - #[doc = " a stream using 16-bit integer samples will have 2 bytes per sample."] - #[doc = ""] - #[doc = " @return the number of bytes per sample."] + #[doc = " Get the number of bytes per sample. This is calculated using the sample format. For example,\n a stream using 16-bit integer samples will have 2 bytes per sample.\n\n @return the number of bytes per sample."] #[link_name = "\u{1}_ZNK4oboe11AudioStream17getBytesPerSampleEv"] pub fn oboe_AudioStream_getBytesPerSample(this: *const oboe_AudioStream) -> i32; } @@ -1091,13 +757,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Wait until the stream has a minimum amount of data available in its buffer."] - #[doc = " This can be used with an EXCLUSIVE MMAP input stream to avoid reading data too close to"] - #[doc = " the DSP write position, which may cause glitches."] - #[doc = ""] - #[doc = " @param numFrames minimum frames available"] - #[doc = " @param timeoutNanoseconds"] - #[doc = " @return number of frames available, ErrorTimeout"] + #[doc = " Wait until the stream has a minimum amount of data available in its buffer.\n This can be used with an EXCLUSIVE MMAP input stream to avoid reading data too close to\n the DSP write position, which may cause glitches.\n\n @param numFrames minimum frames available\n @param timeoutNanoseconds\n @return number of frames available, ErrorTimeout"] #[link_name = "\u{1}_ZN4oboe11AudioStream22waitForAvailableFramesEix"] pub fn oboe_AudioStream_waitForAvailableFrames( this: *mut oboe_AudioStream, @@ -1106,12 +766,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Override this to provide your own behaviour for the audio callback"] - #[doc = ""] - #[doc = " @param audioData container array which audio frames will be written into or read from"] - #[doc = " @param numFrames number of frames which were read/written"] - #[doc = " @return the result of the callback: stop or continue"] - #[doc = ""] + #[doc = " Override this to provide your own behaviour for the audio callback\n\n @param audioData container array which audio frames will be written into or read from\n @param numFrames number of frames which were read/written\n @return the result of the callback: stop or continue\n"] #[link_name = "\u{1}_ZN4oboe11AudioStream16fireDataCallbackEPvi"] pub fn oboe_AudioStream_fireDataCallback( this: *mut oboe_AudioStream, @@ -1120,15 +775,12 @@ extern "C" { ) -> oboe_DataCallbackResult; } extern "C" { - #[doc = " This should only be called as a stream is being opened."] - #[doc = " Otherwise we might override setDelayBeforeCloseMillis()."] + #[doc = " This should only be called as a stream is being opened.\n Otherwise we might override setDelayBeforeCloseMillis()."] #[link_name = "\u{1}_ZN4oboe11AudioStream38calculateDefaultDelayBeforeCloseMillisEv"] pub fn oboe_AudioStream_calculateDefaultDelayBeforeCloseMillis(this: *mut oboe_AudioStream); } extern "C" { - #[doc = " Construct an `AudioStream` using the given `AudioStreamBuilder`"] - #[doc = ""] - #[doc = " @param builder containing all the stream's attributes"] + #[doc = " Construct an `AudioStream` using the given `AudioStreamBuilder`\n\n @param builder containing all the stream's attributes"] #[link_name = "\u{1}_ZN4oboe11AudioStreamC2ERKNS_18AudioStreamBuilderE"] pub fn oboe_AudioStream_AudioStream( this: *mut oboe_AudioStream, @@ -1177,8 +829,7 @@ extern "C" { pub fn oboe_AudioStream_close(this: *mut ::std::os::raw::c_void) -> oboe_Result; } extern "C" { - #[doc = " Start the stream. This will block until the stream has been started, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Start the stream. This will block until the stream has been started, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5startEx"] pub fn oboe_AudioStream_start( this: *mut ::std::os::raw::c_void, @@ -1186,8 +837,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Pause the stream. This will block until the stream has been paused, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Pause the stream. This will block until the stream has been paused, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5pauseEx"] pub fn oboe_AudioStream_pause( this: *mut ::std::os::raw::c_void, @@ -1195,8 +845,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Flush the stream. This will block until the stream has been flushed, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Flush the stream. This will block until the stream has been flushed, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5flushEx"] pub fn oboe_AudioStream_flush( this: *mut ::std::os::raw::c_void, @@ -1204,8 +853,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Stop the stream. This will block until the stream has been stopped, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Stop the stream. This will block until the stream has been stopped, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream4stopEx"] pub fn oboe_AudioStream_stop( this: *mut ::std::os::raw::c_void, @@ -1213,40 +861,17 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " The number of audio frames written into the stream."] - #[doc = " This monotonic counter will never get reset."] - #[doc = ""] - #[doc = " @return the number of frames written so far"] + #[doc = " The number of audio frames written into the stream.\n This monotonic counter will never get reset.\n\n @return the number of frames written so far"] #[link_name = "\u{1}_ZN4oboe11AudioStream16getFramesWrittenEv"] pub fn oboe_AudioStream_getFramesWritten(this: *mut ::std::os::raw::c_void) -> i64; } extern "C" { - #[doc = " The number of audio frames read from the stream."] - #[doc = " This monotonic counter will never get reset."] - #[doc = ""] - #[doc = " @return the number of frames read so far"] + #[doc = " The number of audio frames read from the stream.\n This monotonic counter will never get reset.\n\n @return the number of frames read so far"] #[link_name = "\u{1}_ZN4oboe11AudioStream13getFramesReadEv"] pub fn oboe_AudioStream_getFramesRead(this: *mut ::std::os::raw::c_void) -> i64; } extern "C" { - #[doc = " Get the estimated time that the frame at `framePosition` entered or left the audio processing"] - #[doc = " pipeline."] - #[doc = ""] - #[doc = " This can be used to coordinate events and interactions with the external environment, and to"] - #[doc = " estimate the latency of an audio stream. An example of usage can be found in the hello-oboe"] - #[doc = " sample (search for \"calculateCurrentOutputLatencyMillis\")."] - #[doc = ""] - #[doc = " The time is based on the implementation's best effort, using whatever knowledge is available"] - #[doc = " to the system, but cannot account for any delay unknown to the implementation."] - #[doc = ""] - #[doc = " Note that due to issues in Android before R, we recommend NOT calling"] - #[doc = " this method from a data callback. See this tech note for more details."] - #[doc = " https://github.com/google/oboe/blob/main/docs/notes/rlsbuffer.md"] - #[doc = ""] - #[doc = " See"] - #[doc = " @param clockId the type of clock to use e.g. CLOCK_MONOTONIC"] - #[doc = " @return a FrameTimestamp containing the position and time at which a particular audio frame"] - #[doc = " entered or left the audio processing pipeline, or an error if the operation failed."] + #[doc = " Get the estimated time that the frame at `framePosition` entered or left the audio processing\n pipeline.\n\n This can be used to coordinate events and interactions with the external environment, and to\n estimate the latency of an audio stream. An example of usage can be found in the hello-oboe\n sample (search for \"calculateCurrentOutputLatencyMillis\").\n\n The time is based on the implementation's best effort, using whatever knowledge is available\n to the system, but cannot account for any delay unknown to the implementation.\n\n Note that due to issues in Android before R, we recommend NOT calling\n this method from a data callback. See this tech note for more details.\n https://github.com/google/oboe/blob/main/docs/notes/rlsbuffer.md\n\n See\n @param clockId the type of clock to use e.g. CLOCK_MONOTONIC\n @return a FrameTimestamp containing the position and time at which a particular audio frame\n entered or left the audio processing pipeline, or an error if the operation failed."] #[link_name = "\u{1}_ZN4oboe11AudioStream12getTimestampEi"] pub fn oboe_AudioStream_getTimestamp( this: *mut ::std::os::raw::c_void, @@ -1254,10 +879,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Wait for a transition from one state to another."] - #[doc = " @return OK if the endingState was observed, or ErrorUnexpectedState"] - #[doc = " if any state that was not the startingState or endingState was observed"] - #[doc = " or ErrorTimeout."] + #[doc = " Wait for a transition from one state to another.\n @return OK if the endingState was observed, or ErrorUnexpectedState\n if any state that was not the startingState or endingState was observed\n or ErrorTimeout."] #[link_name = "\u{1}_ZN4oboe11AudioStream22waitForStateTransitionENS_11StreamStateES1_x"] pub fn oboe_AudioStream_waitForStateTransition( this: *mut ::std::os::raw::c_void, @@ -1267,8 +889,7 @@ extern "C" { ) -> oboe_Result; } pub const oboe_AudioStream_kMinDelayBeforeCloseMillis: ::std::os::raw::c_int = 10; -#[doc = " This struct is a stateless functor which closes an AudioStream prior to its deletion."] -#[doc = " This means it can be used to safely delete a smart pointer referring to an open stream."] +#[doc = " This struct is a stateless functor which closes an AudioStream prior to its deletion.\n This means it can be used to safely delete a smart pointer referring to an open stream."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_StreamDeleterFunctor { @@ -1287,18 +908,7 @@ fn bindgen_test_layout_oboe_StreamDeleterFunctor() { concat!("Alignment of ", stringify!(oboe_StreamDeleterFunctor)) ); } -#[doc = " LatencyTuner can be used to dynamically tune the latency of an output stream."] -#[doc = " It adjusts the stream's bufferSize by monitoring the number of underruns."] -#[doc = ""] -#[doc = " This only affects the latency associated with the first level of buffering that is closest"] -#[doc = " to the application. It does not affect low latency in the HAL, or touch latency in the UI."] -#[doc = ""] -#[doc = " Call tune() right before returning from your data callback function if using callbacks."] -#[doc = " Call tune() right before calling write() if using blocking writes."] -#[doc = ""] -#[doc = " If you want to see the ongoing results of this tuning process then call"] -#[doc = " stream->getBufferSize() periodically."] -#[doc = ""] +#[doc = " LatencyTuner can be used to dynamically tune the latency of an output stream.\n It adjusts the stream's bufferSize by monitoring the number of underruns.\n\n This only affects the latency associated with the first level of buffering that is closest\n to the application. It does not affect low latency in the HAL, or touch latency in the UI.\n\n Call tune() right before returning from your data callback function if using callbacks.\n Call tune() right before calling write() if using blocking writes.\n\n If you want to see the ongoing results of this tuning process then call\n stream->getBufferSize() periodically.\n"] #[repr(C)] #[repr(align(4))] #[derive(Debug, Copy, Clone)] @@ -1324,36 +934,22 @@ fn bindgen_test_layout_oboe_LatencyTuner() { ); } extern "C" { - #[doc = " Adjust the bufferSizeInFrames to optimize latency."] - #[doc = " It will start with a low latency and then raise it if an underrun occurs."] - #[doc = ""] - #[doc = " Latency tuning is only supported for AAudio."] - #[doc = ""] - #[doc = " @return OK or negative error, ErrorUnimplemented for OpenSL ES"] + #[doc = " Adjust the bufferSizeInFrames to optimize latency.\n It will start with a low latency and then raise it if an underrun occurs.\n\n Latency tuning is only supported for AAudio.\n\n @return OK or negative error, ErrorUnimplemented for OpenSL ES"] #[link_name = "\u{1}_ZN4oboe12LatencyTuner4tuneEv"] pub fn oboe_LatencyTuner_tune(this: *mut oboe_LatencyTuner) -> oboe_Result; } extern "C" { - #[doc = " This may be called from another thread. Then tune() will call reset(),"] - #[doc = " which will lower the latency to the minimum and then allow it to rise back up"] - #[doc = " if there are glitches."] - #[doc = ""] - #[doc = " This is typically called in response to a user decision to minimize latency. In other words,"] - #[doc = " call this from a button handler."] + #[doc = " This may be called from another thread. Then tune() will call reset(),\n which will lower the latency to the minimum and then allow it to rise back up\n if there are glitches.\n\n This is typically called in response to a user decision to minimize latency. In other words,\n call this from a button handler."] #[link_name = "\u{1}_ZN4oboe12LatencyTuner12requestResetEv"] pub fn oboe_LatencyTuner_requestReset(this: *mut oboe_LatencyTuner); } extern "C" { - #[doc = " @return true if the audio stream's buffer size is at the maximum value. If no maximum value"] - #[doc = " was specified when constructing the LatencyTuner then the value of"] - #[doc = " stream->getBufferCapacityInFrames is used"] + #[doc = " @return true if the audio stream's buffer size is at the maximum value. If no maximum value\n was specified when constructing the LatencyTuner then the value of\n stream->getBufferCapacityInFrames is used"] #[link_name = "\u{1}_ZN4oboe12LatencyTuner21isAtMaximumBufferSizeEv"] pub fn oboe_LatencyTuner_isAtMaximumBufferSize(this: *mut oboe_LatencyTuner) -> bool; } extern "C" { - #[doc = " Construct a new LatencyTuner object which will act on the given audio stream"] - #[doc = ""] - #[doc = " @param stream the stream who's latency will be tuned"] + #[doc = " Construct a new LatencyTuner object which will act on the given audio stream\n\n @param stream the stream who's latency will be tuned"] #[link_name = "\u{1}_ZN4oboe12LatencyTunerC1ERNS_11AudioStreamE"] pub fn oboe_LatencyTuner_LatencyTuner( this: *mut oboe_LatencyTuner, @@ -1361,10 +957,7 @@ extern "C" { ); } extern "C" { - #[doc = " Construct a new LatencyTuner object which will act on the given audio stream."] - #[doc = ""] - #[doc = " @param stream the stream who's latency will be tuned"] - #[doc = " @param the maximum buffer size which the tune() operation will set the buffer size to"] + #[doc = " Construct a new LatencyTuner object which will act on the given audio stream.\n\n @param stream the stream who's latency will be tuned\n @param the maximum buffer size which the tune() operation will set the buffer size to"] #[link_name = "\u{1}_ZN4oboe12LatencyTunerC1ERNS_11AudioStreamEi"] pub fn oboe_LatencyTuner_LatencyTuner1( this: *mut oboe_LatencyTuner, @@ -1408,16 +1001,13 @@ pub struct oboe_Version { } #[doc = " This is incremented when we make breaking API changes. Based loosely on https://semver.org/."] pub const oboe_Version_Major: u8 = 1; -#[doc = " This is incremented when we add backwards compatible functionality. Or set to zero when MAJOR is"] -#[doc = " incremented."] +#[doc = " This is incremented when we add backwards compatible functionality. Or set to zero when MAJOR is\n incremented."] pub const oboe_Version_Minor: u8 = 7; -#[doc = " This is incremented when we make backwards compatible bug fixes. Or set to zero when MINOR is"] -#[doc = " incremented."] +#[doc = " This is incremented when we make backwards compatible bug fixes. Or set to zero when MINOR is\n incremented."] pub const oboe_Version_Patch: u16 = 0; #[doc = " Version string in the form MAJOR.MINOR.PATCH."] pub const oboe_Version_Text: &[u8; 6usize] = b"1.7.0\0"; -#[doc = " Integer representation of the current Oboe library version. This will always increase when the"] -#[doc = " version number changes so can be compared using integer comparison."] +#[doc = " Integer representation of the current Oboe library version. This will always increase when the\n version number changes so can be compared using integer comparison."] pub const oboe_Version_Number: u32 = 17235968; #[test] fn bindgen_test_layout_oboe_Version() { @@ -1443,6 +1033,9 @@ pub struct oboe_StabilizedCallback { } #[test] fn bindgen_test_layout_oboe_StabilizedCallback() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 36usize, @@ -1453,74 +1046,46 @@ fn bindgen_test_layout_oboe_StabilizedCallback() { 4usize, concat!("Alignment of ", stringify!(oboe_StabilizedCallback)) ); - fn test_field_mCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mCallback) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mCallback) - ) - ); - } - test_field_mCallback(); - fn test_field_mFrameCount() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFrameCount) as usize - ptr as usize - }, - 12usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mFrameCount) - ) - ); - } - test_field_mFrameCount(); - fn test_field_mEpochTimeNanos() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mEpochTimeNanos) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mEpochTimeNanos) - ) - ); - } - test_field_mEpochTimeNanos(); - fn test_field_mOpsPerNano() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mOpsPerNano) as usize - ptr as usize - }, - 28usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mOpsPerNano) - ) - ); - } - test_field_mOpsPerNano(); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mCallback) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFrameCount) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mFrameCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mEpochTimeNanos) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mEpochTimeNanos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mOpsPerNano) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mOpsPerNano) + ) + ); } extern "C" { #[link_name = "\u{1}_ZN4oboe18StabilizedCallbackC1EPNS_19AudioStreamCallbackE"] @@ -1546,6 +1111,7 @@ extern "C" { numFrames: i32, ) -> oboe_DataCallbackResult; } +pub type oboe_AudioStreamShared = [u32; 2usize]; pub type oboe_DropContextHandler = ::std::option::Option; pub type oboe_AudioReadyHandler = ::std::option::Option< @@ -1650,10 +1216,6 @@ extern "C" { error: oboe_Result, ); } -extern "C" { - #[link_name = "\u{1}_ZN4oboe33AudioStreamCallbackWrapper_deleteEPv"] - pub fn oboe_AudioStreamCallbackWrapper_delete(callback: *mut ::std::os::raw::c_void); -} extern "C" { #[link_name = "\u{1}_ZN4oboe22AudioStreamBuilder_newEv"] pub fn oboe_AudioStreamBuilder_new() -> *mut oboe_AudioStreamBuilder; @@ -1671,7 +1233,7 @@ extern "C" { audio_ready: oboe_AudioReadyHandler, before_close: oboe_ErrorCloseHandler, after_close: oboe_ErrorCloseHandler, - ) -> *mut ::std::os::raw::c_void; + ); } extern "C" { #[link_name = "\u{1}_ZN4oboe30AudioStreamBuilder_getAudioApiEPKNS_18AudioStreamBuilderE"] @@ -1693,11 +1255,10 @@ extern "C" { ) -> *mut oboe_AudioStreamBase; } extern "C" { - #[link_name = "\u{1}_ZN4oboe35AudioStreamBuilder_openStreamSharedEPNS_18AudioStreamBuilderEPPNS_11AudioStreamEPPv"] + #[link_name = "\u{1}_ZN4oboe35AudioStreamBuilder_openStreamSharedEPNS_18AudioStreamBuilderEPNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] pub fn oboe_AudioStreamBuilder_openStreamShared( builder: *mut oboe_AudioStreamBuilder, - stream: *mut *mut oboe_AudioStream, - shared_ptr: *mut *mut ::std::os::raw::c_void, + sharedStream: *mut oboe_AudioStreamShared, ) -> oboe_Result; } extern "C" { @@ -1705,8 +1266,21 @@ extern "C" { pub fn oboe_AudioStream_delete(oboeStream: *mut oboe_AudioStream); } extern "C" { - #[link_name = "\u{1}_ZN4oboe24AudioStream_deleteSharedEPv"] - pub fn oboe_AudioStream_deleteShared(shared_ptr: *mut ::std::os::raw::c_void); + #[link_name = "\u{1}_ZN4oboe23AudioStream_cloneSharedEPKNSt6__ndk110shared_ptrINS_11AudioStreamEEEPS3_"] + pub fn oboe_AudioStream_cloneShared( + sharedStream: *const oboe_AudioStreamShared, + newSharedStream: *mut oboe_AudioStreamShared, + ); +} +extern "C" { + #[link_name = "\u{1}_ZN4oboe24AudioStream_deleteSharedEPNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] + pub fn oboe_AudioStream_deleteShared(sharedStream: *mut oboe_AudioStreamShared); +} +extern "C" { + #[link_name = "\u{1}_ZN4oboe23AudioStream_derefSharedEPKNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] + pub fn oboe_AudioStream_derefShared( + sharedStream: *const oboe_AudioStreamShared, + ) -> *const oboe_AudioStream; } extern "C" { #[link_name = "\u{1}_ZN4oboe16AudioStream_openEPNS_11AudioStreamE"] diff --git a/sys/src/bindings_x86_64.rs b/sys/src/bindings_x86_64.rs index b97c0f2..eedbf42 100644 --- a/sys/src/bindings_x86_64.rs +++ b/sys/src/bindings_x86_64.rs @@ -1,11 +1,6 @@ -/* automatically generated by rust-bindgen 0.60.1 */ +/* automatically generated by rust-bindgen 0.63.0 */ pub type std_string = [u64; 3usize]; -pub type __uint8_t = ::std::os::raw::c_uchar; -pub type __uint16_t = ::std::os::raw::c_ushort; -pub type __int32_t = ::std::os::raw::c_int; -pub type __uint32_t = ::std::os::raw::c_uint; -pub type __int64_t = ::std::os::raw::c_long; pub const oboe_StreamState_Uninitialized: oboe_StreamState = 0; pub const oboe_StreamState_Unknown: oboe_StreamState = 1; pub const oboe_StreamState_Open: oboe_StreamState = 2; @@ -34,27 +29,11 @@ pub const oboe_AudioFormat_Invalid: oboe_AudioFormat = -1; pub const oboe_AudioFormat_Unspecified: oboe_AudioFormat = 0; #[doc = " Signed 16-bit integers."] pub const oboe_AudioFormat_I16: oboe_AudioFormat = 1; -#[doc = " Single precision floating point."] -#[doc = ""] -#[doc = " This is the recommended format for most applications."] -#[doc = " But note that the use of Float may prevent the opening of"] -#[doc = " a low-latency input path on OpenSL ES or Legacy AAudio streams."] +#[doc = " Single precision floating point.\n\n This is the recommended format for most applications.\n But note that the use of Float may prevent the opening of\n a low-latency input path on OpenSL ES or Legacy AAudio streams."] pub const oboe_AudioFormat_Float: oboe_AudioFormat = 2; -#[doc = " Signed 24-bit integers, packed into 3 bytes."] -#[doc = ""] -#[doc = " Note that the use of this format does not guarantee that"] -#[doc = " the full precision will be provided. The underlying device may"] -#[doc = " be using I16 format."] -#[doc = ""] -#[doc = " Added in API 31 (S)."] +#[doc = " Signed 24-bit integers, packed into 3 bytes.\n\n Note that the use of this format does not guarantee that\n the full precision will be provided. The underlying device may\n be using I16 format.\n\n Added in API 31 (S)."] pub const oboe_AudioFormat_I24: oboe_AudioFormat = 3; -#[doc = " Signed 32-bit integers."] -#[doc = ""] -#[doc = " Note that the use of this format does not guarantee that"] -#[doc = " the full precision will be provided. The underlying device may"] -#[doc = " be using I16 format."] -#[doc = ""] -#[doc = " Added in API 31 (S)."] +#[doc = " Signed 32-bit integers.\n\n Note that the use of this format does not guarantee that\n the full precision will be provided. The underlying device may\n be using I16 format.\n\n Added in API 31 (S)."] pub const oboe_AudioFormat_I32: oboe_AudioFormat = 4; #[doc = " The format of audio samples."] pub type oboe_AudioFormat = i32; @@ -91,21 +70,11 @@ pub const oboe_Result_Reserved8: oboe_Result = -872; pub const oboe_Result_Reserved9: oboe_Result = -871; pub const oboe_Result_Reserved10: oboe_Result = -870; pub const oboe_Result_ErrorClosed: oboe_Result = -869; -#[doc = " The result of an operation. All except the `OK` result indicates that an error occurred."] -#[doc = " The `Result` can be converted into a human readable string using `convertToText`."] +#[doc = " The result of an operation. All except the `OK` result indicates that an error occurred.\n The `Result` can be converted into a human readable string using `convertToText`."] pub type oboe_Result = i32; -#[doc = " This will be the only stream using a particular source or sink."] -#[doc = " This mode will provide the lowest possible latency."] -#[doc = " You should close EXCLUSIVE streams immediately when you are not using them."] -#[doc = ""] -#[doc = " If you do not need the lowest possible latency then we recommend using Shared,"] -#[doc = " which is the default."] +#[doc = " This will be the only stream using a particular source or sink.\n This mode will provide the lowest possible latency.\n You should close EXCLUSIVE streams immediately when you are not using them.\n\n If you do not need the lowest possible latency then we recommend using Shared,\n which is the default."] pub const oboe_SharingMode_Exclusive: oboe_SharingMode = 0; -#[doc = " Multiple applications can share the same device."] -#[doc = " The data from output streams will be mixed by the audio service."] -#[doc = " The data for input streams will be distributed by the audio service."] -#[doc = ""] -#[doc = " This will have higher latency than the EXCLUSIVE mode."] +#[doc = " Multiple applications can share the same device.\n The data from output streams will be mixed by the audio service.\n The data for input streams will be distributed by the audio service.\n\n This will have higher latency than the EXCLUSIVE mode."] pub const oboe_SharingMode_Shared: oboe_SharingMode = 1; #[doc = " The sharing mode of the audio stream."] pub type oboe_SharingMode = i32; @@ -119,19 +88,15 @@ pub const oboe_PerformanceMode_LowLatency: oboe_PerformanceMode = 12; pub type oboe_PerformanceMode = i32; #[doc = " Try to use AAudio. If not available then use OpenSL ES."] pub const oboe_AudioApi_Unspecified: oboe_AudioApi = 0; -#[doc = " Use OpenSL ES."] -#[doc = " Note that OpenSL ES is deprecated in Android 13, API 30 and above."] +#[doc = " Use OpenSL ES.\n Note that OpenSL ES is deprecated in Android 13, API 30 and above."] pub const oboe_AudioApi_OpenSLES: oboe_AudioApi = 1; -#[doc = " Try to use AAudio. Fail if unavailable."] -#[doc = " AAudio was first supported in Android 8, API 26 and above."] -#[doc = " It is only recommended for API 27 and above."] +#[doc = " Try to use AAudio. Fail if unavailable.\n AAudio was first supported in Android 8, API 26 and above.\n It is only recommended for API 27 and above."] pub const oboe_AudioApi_AAudio: oboe_AudioApi = 2; #[doc = " The underlying audio API used by the audio stream."] pub type oboe_AudioApi = i32; #[doc = " No conversion by Oboe. Underlying APIs may still do conversion."] pub const oboe_SampleRateConversionQuality_None: oboe_SampleRateConversionQuality = 0; -#[doc = " Fastest conversion but may not sound great."] -#[doc = " This may be implemented using bilinear interpolation."] +#[doc = " Fastest conversion but may not sound great.\n This may be implemented using bilinear interpolation."] pub const oboe_SampleRateConversionQuality_Fastest: oboe_SampleRateConversionQuality = 1; #[doc = " Low quality conversion with 8 taps."] pub const oboe_SampleRateConversionQuality_Low: oboe_SampleRateConversionQuality = 2; @@ -141,9 +106,7 @@ pub const oboe_SampleRateConversionQuality_Medium: oboe_SampleRateConversionQual pub const oboe_SampleRateConversionQuality_High: oboe_SampleRateConversionQuality = 4; #[doc = " Highest quality conversion, which may be expensive in terms of CPU."] pub const oboe_SampleRateConversionQuality_Best: oboe_SampleRateConversionQuality = 5; -#[doc = " Specifies the quality of the sample rate conversion performed by Oboe."] -#[doc = " Higher quality will require more CPU load."] -#[doc = " Higher quality conversion will probably be implemented using a sinc based resampler."] +#[doc = " Specifies the quality of the sample rate conversion performed by Oboe.\n Higher quality will require more CPU load.\n Higher quality conversion will probably be implemented using a sinc based resampler."] pub type oboe_SampleRateConversionQuality = i32; #[doc = " Use this for streaming media, music performance, video, podcasts, etcetera."] pub const oboe_Usage_Media: oboe_Usage = 1; @@ -153,8 +116,7 @@ pub const oboe_Usage_VoiceCommunication: oboe_Usage = 2; pub const oboe_Usage_VoiceCommunicationSignalling: oboe_Usage = 3; #[doc = " Use this to demand the users attention."] pub const oboe_Usage_Alarm: oboe_Usage = 4; -#[doc = " Use this for notifying the user when a message has arrived or some"] -#[doc = " other background event has occured."] +#[doc = " Use this for notifying the user when a message has arrived or some\n other background event has occured."] pub const oboe_Usage_Notification: oboe_Usage = 5; #[doc = " Use this when the phone rings."] pub const oboe_Usage_NotificationRingtone: oboe_Usage = 6; @@ -170,13 +132,7 @@ pub const oboe_Usage_AssistanceSonification: oboe_Usage = 13; pub const oboe_Usage_Game: oboe_Usage = 14; #[doc = " Use this for audio responses to user queries, audio instructions or help utterances."] pub const oboe_Usage_Assistant: oboe_Usage = 16; -#[doc = " The Usage attribute expresses *why* you are playing a sound, what is this sound used for."] -#[doc = " This information is used by certain platforms or routing policies"] -#[doc = " to make more refined volume or routing decisions."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in AudioAttributes in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " The Usage attribute expresses *why* you are playing a sound, what is this sound used for.\n This information is used by certain platforms or routing policies\n to make more refined volume or routing decisions.\n\n Note that these match the equivalent values in AudioAttributes in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_Usage = i32; #[doc = " Use this for spoken voice, audio books, etcetera."] pub const oboe_ContentType_Speech: oboe_ContentType = 1; @@ -184,19 +140,9 @@ pub const oboe_ContentType_Speech: oboe_ContentType = 1; pub const oboe_ContentType_Music: oboe_ContentType = 2; #[doc = " Use this for a movie or video soundtrack."] pub const oboe_ContentType_Movie: oboe_ContentType = 3; -#[doc = " Use this for sound is designed to accompany a user action,"] -#[doc = " such as a click or beep sound made when the user presses a button."] +#[doc = " Use this for sound is designed to accompany a user action,\n such as a click or beep sound made when the user presses a button."] pub const oboe_ContentType_Sonification: oboe_ContentType = 4; -#[doc = " The ContentType attribute describes *what* you are playing."] -#[doc = " It expresses the general category of the content. This information is optional."] -#[doc = " But in case it is known (for instance {@link Movie} for a"] -#[doc = " movie streaming service or {@link Speech} for"] -#[doc = " an audio book application) this information might be used by the audio framework to"] -#[doc = " enforce audio focus."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in AudioAttributes in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " The ContentType attribute describes *what* you are playing.\n It expresses the general category of the content. This information is optional.\n But in case it is known (for instance {@link Movie} for a\n movie streaming service or {@link Speech} for\n an audio book application) this information might be used by the audio framework to\n enforce audio focus.\n\n Note that these match the equivalent values in AudioAttributes in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_ContentType = i32; #[doc = " Use this preset when other presets do not apply."] pub const oboe_InputPreset_Generic: oboe_InputPreset = 1; @@ -206,35 +152,17 @@ pub const oboe_InputPreset_Camcorder: oboe_InputPreset = 5; pub const oboe_InputPreset_VoiceRecognition: oboe_InputPreset = 6; #[doc = " Use this preset when doing telephony or voice messaging."] pub const oboe_InputPreset_VoiceCommunication: oboe_InputPreset = 7; -#[doc = " Use this preset to obtain an input with no effects."] -#[doc = " Note that this input will not have automatic gain control"] -#[doc = " so the recorded volume may be very low."] +#[doc = " Use this preset to obtain an input with no effects.\n Note that this input will not have automatic gain control\n so the recorded volume may be very low."] pub const oboe_InputPreset_Unprocessed: oboe_InputPreset = 9; -#[doc = " Use this preset for capturing audio meant to be processed in real time"] -#[doc = " and played back for live performance (e.g karaoke)."] -#[doc = " The capture path will minimize latency and coupling with playback path."] +#[doc = " Use this preset for capturing audio meant to be processed in real time\n and played back for live performance (e.g karaoke).\n The capture path will minimize latency and coupling with playback path."] pub const oboe_InputPreset_VoicePerformance: oboe_InputPreset = 10; -#[doc = " Defines the audio source."] -#[doc = " An audio source defines both a default physical source of audio signal, and a recording"] -#[doc = " configuration."] -#[doc = ""] -#[doc = " Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " Defines the audio source.\n An audio source defines both a default physical source of audio signal, and a recording\n configuration.\n\n Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_InputPreset = i32; -#[doc = " Do not allocate a session ID."] -#[doc = " Effects cannot be used with this stream."] -#[doc = " Default."] +#[doc = " Do not allocate a session ID.\n Effects cannot be used with this stream.\n Default."] pub const oboe_SessionId_None: oboe_SessionId = -1; -#[doc = " Allocate a session ID that can be used to attach and control"] -#[doc = " effects using the Java AudioEffects API."] -#[doc = " Note that the use of this flag may result in higher latency."] -#[doc = ""] -#[doc = " Note that this matches the value of AudioManager.AUDIO_SESSION_ID_GENERATE."] +#[doc = " Allocate a session ID that can be used to attach and control\n effects using the Java AudioEffects API.\n Note that the use of this flag may result in higher latency.\n\n Note that this matches the value of AudioManager.AUDIO_SESSION_ID_GENERATE."] pub const oboe_SessionId_Allocate: oboe_SessionId = 0; -#[doc = " This attribute can be used to allocate a session ID to the audio stream."] -#[doc = ""] -#[doc = " This attribute only has an effect on Android API 28+."] +#[doc = " This attribute can be used to allocate a session ID to the audio stream.\n\n This attribute only has an effect on Android API 28+."] pub type oboe_SessionId = ::std::os::raw::c_int; #[doc = " Audio channel count definition, use Mono or Stereo"] pub const oboe_ChannelCount_Unspecified: oboe_ChannelCount = 0; @@ -242,14 +170,7 @@ pub const oboe_ChannelCount_Unspecified: oboe_ChannelCount = 0; pub const oboe_ChannelCount_Mono: oboe_ChannelCount = 1; #[doc = " Use this for stereo audio."] pub const oboe_ChannelCount_Stereo: oboe_ChannelCount = 2; -#[doc = " The channel count of the audio stream. The underlying type is `int32_t`."] -#[doc = " Use of this enum is convenient to avoid \"magic\""] -#[doc = " numbers when specifying the channel count."] -#[doc = ""] -#[doc = " For example, you can write"] -#[doc = " `builder.setChannelCount(ChannelCount::Stereo)`"] -#[doc = " rather than `builder.setChannelCount(2)`"] -#[doc = ""] +#[doc = " The channel count of the audio stream. The underlying type is `int32_t`.\n Use of this enum is convenient to avoid \"magic\"\n numbers when specifying the channel count.\n\n For example, you can write\n `builder.setChannelCount(ChannelCount::Stereo)`\n rather than `builder.setChannelCount(2)`\n"] pub type oboe_ChannelCount = i32; pub const oboe_ChannelMask_Unspecified: oboe_ChannelMask = 0; pub const oboe_ChannelMask_FrontLeft: oboe_ChannelMask = 1; @@ -303,30 +224,9 @@ pub const oboe_ChannelMask_CM7Point1Point4: oboe_ChannelMask = 185919; pub const oboe_ChannelMask_CM9Point1Point4: oboe_ChannelMask = 50517567; pub const oboe_ChannelMask_CM9Point1Point6: oboe_ChannelMask = 51303999; pub const oboe_ChannelMask_FrontBack: oboe_ChannelMask = 260; -#[doc = " The channel mask of the audio stream. The underlying type is `uint32_t`."] -#[doc = " Use of this enum is convenient."] -#[doc = ""] -#[doc = " ChannelMask::Unspecified means this is not specified."] -#[doc = " The rest of the enums are channel position masks."] -#[doc = " Use the combinations of the channel position masks defined below instead of"] -#[doc = " using those values directly."] +#[doc = " The channel mask of the audio stream. The underlying type is `uint32_t`.\n Use of this enum is convenient.\n\n ChannelMask::Unspecified means this is not specified.\n The rest of the enums are channel position masks.\n Use the combinations of the channel position masks defined below instead of\n using those values directly."] pub type oboe_ChannelMask = u32; -#[doc = " On API 16 to 26 OpenSL ES will be used. When using OpenSL ES the optimal values for sampleRate and"] -#[doc = " framesPerBurst are not known by the native code."] -#[doc = " On API 17+ these values should be obtained from the AudioManager using this code:"] -#[doc = ""] -#[doc = "
"]
-#[doc = " // Note that this technique only works for built-in speakers and headphones."]
-#[doc = " AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);"]
-#[doc = " String sampleRateStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);"]
-#[doc = " int defaultSampleRate = Integer.parseInt(sampleRateStr);"]
-#[doc = " String framesPerBurstStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);"]
-#[doc = " int defaultFramesPerBurst = Integer.parseInt(framesPerBurstStr);"]
-#[doc = " 
"] -#[doc = ""] -#[doc = " It can then be passed down to Oboe through JNI."] -#[doc = ""] -#[doc = " AAudio will get the optimal framesPerBurst from the HAL and will ignore this value."] +#[doc = " On API 16 to 26 OpenSL ES will be used. When using OpenSL ES the optimal values for sampleRate and\n framesPerBurst are not known by the native code.\n On API 17+ these values should be obtained from the AudioManager using this code:\n\n
\n // Note that this technique only works for built-in speakers and headphones.\n AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);\n String sampleRateStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);\n int defaultSampleRate = Integer.parseInt(sampleRateStr);\n String framesPerBurstStr = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);\n int defaultFramesPerBurst = Integer.parseInt(framesPerBurstStr);\n 
\n\n It can then be passed down to Oboe through JNI.\n\n AAudio will get the optimal framesPerBurst from the HAL and will ignore this value."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_DefaultStreamValues { @@ -369,6 +269,8 @@ pub struct oboe_FrameTimestamp { } #[test] fn bindgen_test_layout_oboe_FrameTimestamp() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 16usize, @@ -379,59 +281,28 @@ fn bindgen_test_layout_oboe_FrameTimestamp() { 8usize, concat!("Alignment of ", stringify!(oboe_FrameTimestamp)) ); - fn test_field_position() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).position) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(oboe_FrameTimestamp), - "::", - stringify!(position) - ) - ); - } - test_field_position(); - fn test_field_timestamp() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(oboe_FrameTimestamp), - "::", - stringify!(timestamp) - ) - ); - } - test_field_timestamp(); -} -#[doc = " A ResultWithValue can store both the result of an operation (either OK or an error) and a value."] -#[doc = ""] -#[doc = " It has been designed for cases where the caller needs to know whether an operation succeeded and,"] -#[doc = " if it did, a value which was obtained during the operation."] -#[doc = ""] -#[doc = " For example, when reading from a stream the caller needs to know the result of the read operation"] -#[doc = " and, if it was successful, how many frames were read. Note that ResultWithValue can be evaluated"] -#[doc = " as a boolean so it's simple to check whether the result is OK."] -#[doc = ""] -#[doc = " "] -#[doc = " ResultWithValue resultOfRead = myStream.read(&buffer, numFrames, timeoutNanoseconds);"] -#[doc = ""] -#[doc = " if (resultOfRead) {"] -#[doc = " LOGD(\"Frames read: %d\", resultOfRead.value());"] -#[doc = " } else {"] -#[doc = " LOGD(\"Error reading from stream: %s\", resultOfRead.error());"] -#[doc = " }"] -#[doc = " "] + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).position) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(oboe_FrameTimestamp), + "::", + stringify!(position) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(oboe_FrameTimestamp), + "::", + stringify!(timestamp) + ) + ); +} +#[doc = " A ResultWithValue can store both the result of an operation (either OK or an error) and a value.\n\n It has been designed for cases where the caller needs to know whether an operation succeeded and,\n if it did, a value which was obtained during the operation.\n\n For example, when reading from a stream the caller needs to know the result of the read operation\n and, if it was successful, how many frames were read. Note that ResultWithValue can be evaluated\n as a boolean so it's simple to check whether the result is OK.\n\n \n ResultWithValue resultOfRead = myStream.read(&buffer, numFrames, timeoutNanoseconds);\n\n if (resultOfRead) {\n LOGD(\"Frames read: %d\", resultOfRead.value());\n } else {\n LOGD(\"Error reading from stream: %s\", resultOfRead.error());\n }\n "] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_ResultWithValue { @@ -441,11 +312,7 @@ pub struct oboe_ResultWithValue { } #[repr(C)] pub struct oboe_AudioStreamDataCallback__bindgen_vtable(::std::os::raw::c_void); -#[doc = " AudioStreamDataCallback defines a callback interface for"] -#[doc = " moving data to/from an audio stream using `onAudioReady`"] -#[doc = " 2) being alerted when a stream has an error using `onError*` methods"] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setDataCallback()."] +#[doc = " AudioStreamDataCallback defines a callback interface for\n moving data to/from an audio stream using `onAudioReady`\n 2) being alerted when a stream has an error using `onError*` methods\n\n It is used with AudioStreamBuilder::setDataCallback()."] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamDataCallback { @@ -466,15 +333,7 @@ fn bindgen_test_layout_oboe_AudioStreamDataCallback() { } #[repr(C)] pub struct oboe_AudioStreamErrorCallback__bindgen_vtable(::std::os::raw::c_void); -#[doc = " AudioStreamErrorCallback defines a callback interface for"] -#[doc = " being alerted when a stream has an error or is disconnected"] -#[doc = " using `onError*` methods."] -#[doc = ""] -#[doc = " Note: This callback is only fired when an AudioStreamCallback is set."] -#[doc = " If you use AudioStream::write() you have to evaluate the return codes of"] -#[doc = " AudioStream::write() to notice errors in the stream."] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setErrorCallback()."] +#[doc = " AudioStreamErrorCallback defines a callback interface for\n being alerted when a stream has an error or is disconnected\n using `onError*` methods.\n\n Note: This callback is only fired when an AudioStreamCallback is set.\n If you use AudioStream::write() you have to evaluate the return codes of\n AudioStream::write() to notice errors in the stream.\n\n It is used with AudioStreamBuilder::setErrorCallback()."] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamErrorCallback { @@ -493,18 +352,7 @@ fn bindgen_test_layout_oboe_AudioStreamErrorCallback() { concat!("Alignment of ", stringify!(oboe_AudioStreamErrorCallback)) ); } -#[doc = " AudioStreamCallback defines a callback interface for:"] -#[doc = ""] -#[doc = " 1) moving data to/from an audio stream using `onAudioReady`"] -#[doc = " 2) being alerted when a stream has an error using `onError*` methods"] -#[doc = ""] -#[doc = " It is used with AudioStreamBuilder::setCallback()."] -#[doc = ""] -#[doc = " It combines the interfaces defined by AudioStreamDataCallback and AudioStreamErrorCallback."] -#[doc = " This was the original callback object. We now recommend using the individual interfaces"] -#[doc = " and using setDataCallback() and setErrorCallback()."] -#[doc = ""] -#[doc = " @deprecated Use `AudioStreamDataCallback` and `AudioStreamErrorCallback` instead"] +#[doc = " AudioStreamCallback defines a callback interface for:\n\n 1) moving data to/from an audio stream using `onAudioReady`\n 2) being alerted when a stream has an error using `onError*` methods\n\n It is used with AudioStreamBuilder::setCallback().\n\n It combines the interfaces defined by AudioStreamDataCallback and AudioStreamErrorCallback.\n This was the original callback object. We now recommend using the individual interfaces\n and using setDataCallback() and setErrorCallback().\n\n @deprecated Use `AudioStreamDataCallback` and `AudioStreamErrorCallback` instead"] #[repr(C)] #[derive(Debug)] pub struct oboe_AudioStreamCallback { @@ -562,8 +410,7 @@ pub struct oboe_AudioStreamBase { pub mUsage: oboe_Usage, #[doc = " Stream content type. Only active on Android 28+"] pub mContentType: oboe_ContentType, - #[doc = " Stream input preset. Only active on Android 28+"] - #[doc = " TODO InputPreset::Unspecified should be considered as a possible default alternative."] + #[doc = " Stream input preset. Only active on Android 28+\n TODO InputPreset::Unspecified should be considered as a possible default alternative."] pub mInputPreset: oboe_InputPreset, #[doc = " Stream session ID allocation strategy. Only active on Android 28+"] pub mSessionId: oboe_SessionId, @@ -577,6 +424,8 @@ pub struct oboe_AudioStreamBase { } #[test] fn bindgen_test_layout_oboe_AudioStreamBase() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 176usize, @@ -587,422 +436,251 @@ fn bindgen_test_layout_oboe_AudioStreamBase() { 8usize, concat!("Alignment of ", stringify!(oboe_AudioStreamBase)) ); - fn test_field_mDataCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDataCallback) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDataCallback) - ) - ); - } - test_field_mDataCallback(); - fn test_field_mSharedDataCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharedDataCallback) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharedDataCallback) - ) - ); - } - test_field_mSharedDataCallback(); - fn test_field_mErrorCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mErrorCallback) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mErrorCallback) - ) - ); - } - test_field_mErrorCallback(); - fn test_field_mSharedErrorCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharedErrorCallback) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharedErrorCallback) - ) - ); - } - test_field_mSharedErrorCallback(); - fn test_field_mFramesPerCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFramesPerCallback) as usize - ptr as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFramesPerCallback) - ) - ); - } - test_field_mFramesPerCallback(); - fn test_field_mChannelCount() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelCount) as usize - ptr as usize - }, - 60usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelCount) - ) - ); - } - test_field_mChannelCount(); - fn test_field_mSampleRate() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSampleRate) as usize - ptr as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSampleRate) - ) - ); - } - test_field_mSampleRate(); - fn test_field_mDeviceId() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDeviceId) as usize - ptr as usize - }, - 68usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDeviceId) - ) - ); - } - test_field_mDeviceId(); - fn test_field_mBufferCapacityInFrames() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBufferCapacityInFrames) as usize - ptr as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mBufferCapacityInFrames) - ) - ); - } - test_field_mBufferCapacityInFrames(); - fn test_field_mBufferSizeInFrames() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mBufferSizeInFrames) as usize - ptr as usize - }, - 76usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mBufferSizeInFrames) - ) - ); - } - test_field_mBufferSizeInFrames(); - fn test_field_mChannelMask() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelMask) as usize - ptr as usize - }, - 80usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelMask) - ) - ); - } - test_field_mChannelMask(); - fn test_field_mSharingMode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSharingMode) as usize - ptr as usize - }, - 84usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSharingMode) - ) - ); - } - test_field_mSharingMode(); - fn test_field_mFormat() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFormat) as usize - ptr as usize - }, - 88usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFormat) - ) - ); - } - test_field_mFormat(); - fn test_field_mDirection() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mDirection) as usize - ptr as usize - }, - 92usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mDirection) - ) - ); - } - test_field_mDirection(); - fn test_field_mPerformanceMode() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mPerformanceMode) as usize - ptr as usize - }, - 96usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mPerformanceMode) - ) - ); - } - test_field_mPerformanceMode(); - fn test_field_mUsage() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mUsage) as usize - ptr as usize - }, - 100usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mUsage) - ) - ); - } - test_field_mUsage(); - fn test_field_mContentType() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mContentType) as usize - ptr as usize - }, - 104usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mContentType) - ) - ); - } - test_field_mContentType(); - fn test_field_mInputPreset() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mInputPreset) as usize - ptr as usize - }, - 108usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mInputPreset) - ) - ); - } - test_field_mInputPreset(); - fn test_field_mSessionId() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSessionId) as usize - ptr as usize - }, - 112usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSessionId) - ) - ); - } - test_field_mSessionId(); - fn test_field_mPackageName() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mPackageName) as usize - ptr as usize - }, - 120usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mPackageName) - ) - ); - } - test_field_mPackageName(); - fn test_field_mAttributionTag() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mAttributionTag) as usize - ptr as usize - }, - 144usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mAttributionTag) - ) - ); - } - test_field_mAttributionTag(); - fn test_field_mChannelConversionAllowed() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mChannelConversionAllowed) as usize - ptr as usize - }, - 168usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mChannelConversionAllowed) - ) - ); - } - test_field_mChannelConversionAllowed(); - fn test_field_mFormatConversionAllowed() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFormatConversionAllowed) as usize - ptr as usize - }, - 169usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mFormatConversionAllowed) - ) - ); - } - test_field_mFormatConversionAllowed(); - fn test_field_mSampleRateConversionQuality() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mSampleRateConversionQuality) as usize - ptr as usize - }, - 172usize, - concat!( - "Offset of field: ", - stringify!(oboe_AudioStreamBase), - "::", - stringify!(mSampleRateConversionQuality) - ) - ); - } - test_field_mSampleRateConversionQuality(); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDataCallback) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDataCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharedDataCallback) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharedDataCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mErrorCallback) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mErrorCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharedErrorCallback) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharedErrorCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFramesPerCallback) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFramesPerCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelCount) as usize - ptr as usize }, + 60usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSampleRate) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSampleRate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDeviceId) as usize - ptr as usize }, + 68usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDeviceId) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mBufferCapacityInFrames) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mBufferCapacityInFrames) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mBufferSizeInFrames) as usize - ptr as usize }, + 76usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mBufferSizeInFrames) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelMask) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelMask) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSharingMode) as usize - ptr as usize }, + 84usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSharingMode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFormat) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFormat) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mDirection) as usize - ptr as usize }, + 92usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mDirection) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mPerformanceMode) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mPerformanceMode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mUsage) as usize - ptr as usize }, + 100usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mUsage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mContentType) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mContentType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mInputPreset) as usize - ptr as usize }, + 108usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mInputPreset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mSessionId) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSessionId) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mPackageName) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mPackageName) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mAttributionTag) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mAttributionTag) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mChannelConversionAllowed) as usize - ptr as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mChannelConversionAllowed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFormatConversionAllowed) as usize - ptr as usize }, + 169usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mFormatConversionAllowed) + ) + ); + assert_eq!( + unsafe { + ::std::ptr::addr_of!((*ptr).mSampleRateConversionQuality) as usize - ptr as usize + }, + 172usize, + concat!( + "Offset of field: ", + stringify!(oboe_AudioStreamBase), + "::", + stringify!(mSampleRateConversionQuality) + ) + ); } extern "C" { - #[doc = " Return the version of the SDK that is currently running."] - #[doc = ""] - #[doc = " For example, on Android, this would return 27 for Oreo 8.1."] - #[doc = " If the version number cannot be determined then this will return -1."] - #[doc = ""] - #[doc = " @return version number or -1"] + #[doc = " Return the version of the SDK that is currently running.\n\n For example, on Android, this would return 27 for Oreo 8.1.\n If the version number cannot be determined then this will return -1.\n\n @return version number or -1"] #[link_name = "\u{1}_ZN4oboe13getSdkVersionEv"] pub fn oboe_getSdkVersion() -> ::std::os::raw::c_int; } @@ -1027,21 +705,12 @@ fn bindgen_test_layout_oboe_AudioStreamBuilder() { ); } extern "C" { - #[doc = " Is the AAudio API supported on this device?"] - #[doc = ""] - #[doc = " AAudio was introduced in the Oreo 8.0 release."] - #[doc = ""] - #[doc = " @return true if supported"] + #[doc = " Is the AAudio API supported on this device?\n\n AAudio was introduced in the Oreo 8.0 release.\n\n @return true if supported"] #[link_name = "\u{1}_ZN4oboe18AudioStreamBuilder17isAAudioSupportedEv"] pub fn oboe_AudioStreamBuilder_isAAudioSupported() -> bool; } extern "C" { - #[doc = " Is the AAudio API recommended this device?"] - #[doc = ""] - #[doc = " AAudio may be supported but not recommended because of version specific issues."] - #[doc = " AAudio is not recommended for Android 8.0 or earlier versions."] - #[doc = ""] - #[doc = " @return true if recommended"] + #[doc = " Is the AAudio API recommended this device?\n\n AAudio may be supported but not recommended because of version specific issues.\n AAudio is not recommended for Android 8.0 or earlier versions.\n\n @return true if recommended"] #[link_name = "\u{1}_ZN4oboe18AudioStreamBuilder19isAAudioRecommendedEv"] pub fn oboe_AudioStreamBuilder_isAAudioRecommended() -> bool; } @@ -1075,10 +744,7 @@ fn bindgen_test_layout_oboe_AudioStream() { ); } extern "C" { - #[doc = " Get the number of bytes per sample. This is calculated using the sample format. For example,"] - #[doc = " a stream using 16-bit integer samples will have 2 bytes per sample."] - #[doc = ""] - #[doc = " @return the number of bytes per sample."] + #[doc = " Get the number of bytes per sample. This is calculated using the sample format. For example,\n a stream using 16-bit integer samples will have 2 bytes per sample.\n\n @return the number of bytes per sample."] #[link_name = "\u{1}_ZNK4oboe11AudioStream17getBytesPerSampleEv"] pub fn oboe_AudioStream_getBytesPerSample(this: *const oboe_AudioStream) -> i32; } @@ -1090,13 +756,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Wait until the stream has a minimum amount of data available in its buffer."] - #[doc = " This can be used with an EXCLUSIVE MMAP input stream to avoid reading data too close to"] - #[doc = " the DSP write position, which may cause glitches."] - #[doc = ""] - #[doc = " @param numFrames minimum frames available"] - #[doc = " @param timeoutNanoseconds"] - #[doc = " @return number of frames available, ErrorTimeout"] + #[doc = " Wait until the stream has a minimum amount of data available in its buffer.\n This can be used with an EXCLUSIVE MMAP input stream to avoid reading data too close to\n the DSP write position, which may cause glitches.\n\n @param numFrames minimum frames available\n @param timeoutNanoseconds\n @return number of frames available, ErrorTimeout"] #[link_name = "\u{1}_ZN4oboe11AudioStream22waitForAvailableFramesEil"] pub fn oboe_AudioStream_waitForAvailableFrames( this: *mut oboe_AudioStream, @@ -1105,12 +765,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Override this to provide your own behaviour for the audio callback"] - #[doc = ""] - #[doc = " @param audioData container array which audio frames will be written into or read from"] - #[doc = " @param numFrames number of frames which were read/written"] - #[doc = " @return the result of the callback: stop or continue"] - #[doc = ""] + #[doc = " Override this to provide your own behaviour for the audio callback\n\n @param audioData container array which audio frames will be written into or read from\n @param numFrames number of frames which were read/written\n @return the result of the callback: stop or continue\n"] #[link_name = "\u{1}_ZN4oboe11AudioStream16fireDataCallbackEPvi"] pub fn oboe_AudioStream_fireDataCallback( this: *mut oboe_AudioStream, @@ -1119,15 +774,12 @@ extern "C" { ) -> oboe_DataCallbackResult; } extern "C" { - #[doc = " This should only be called as a stream is being opened."] - #[doc = " Otherwise we might override setDelayBeforeCloseMillis()."] + #[doc = " This should only be called as a stream is being opened.\n Otherwise we might override setDelayBeforeCloseMillis()."] #[link_name = "\u{1}_ZN4oboe11AudioStream38calculateDefaultDelayBeforeCloseMillisEv"] pub fn oboe_AudioStream_calculateDefaultDelayBeforeCloseMillis(this: *mut oboe_AudioStream); } extern "C" { - #[doc = " Construct an `AudioStream` using the given `AudioStreamBuilder`"] - #[doc = ""] - #[doc = " @param builder containing all the stream's attributes"] + #[doc = " Construct an `AudioStream` using the given `AudioStreamBuilder`\n\n @param builder containing all the stream's attributes"] #[link_name = "\u{1}_ZN4oboe11AudioStreamC2ERKNS_18AudioStreamBuilderE"] pub fn oboe_AudioStream_AudioStream( this: *mut oboe_AudioStream, @@ -1176,8 +828,7 @@ extern "C" { pub fn oboe_AudioStream_close(this: *mut ::std::os::raw::c_void) -> oboe_Result; } extern "C" { - #[doc = " Start the stream. This will block until the stream has been started, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Start the stream. This will block until the stream has been started, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5startEl"] pub fn oboe_AudioStream_start( this: *mut ::std::os::raw::c_void, @@ -1185,8 +836,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Pause the stream. This will block until the stream has been paused, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Pause the stream. This will block until the stream has been paused, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5pauseEl"] pub fn oboe_AudioStream_pause( this: *mut ::std::os::raw::c_void, @@ -1194,8 +844,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Flush the stream. This will block until the stream has been flushed, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Flush the stream. This will block until the stream has been flushed, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream5flushEl"] pub fn oboe_AudioStream_flush( this: *mut ::std::os::raw::c_void, @@ -1203,8 +852,7 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " Stop the stream. This will block until the stream has been stopped, an error occurs"] - #[doc = " or `timeoutNanoseconds` has been reached."] + #[doc = " Stop the stream. This will block until the stream has been stopped, an error occurs\n or `timeoutNanoseconds` has been reached."] #[link_name = "\u{1}_ZN4oboe11AudioStream4stopEl"] pub fn oboe_AudioStream_stop( this: *mut ::std::os::raw::c_void, @@ -1212,40 +860,17 @@ extern "C" { ) -> oboe_Result; } extern "C" { - #[doc = " The number of audio frames written into the stream."] - #[doc = " This monotonic counter will never get reset."] - #[doc = ""] - #[doc = " @return the number of frames written so far"] + #[doc = " The number of audio frames written into the stream.\n This monotonic counter will never get reset.\n\n @return the number of frames written so far"] #[link_name = "\u{1}_ZN4oboe11AudioStream16getFramesWrittenEv"] pub fn oboe_AudioStream_getFramesWritten(this: *mut ::std::os::raw::c_void) -> i64; } extern "C" { - #[doc = " The number of audio frames read from the stream."] - #[doc = " This monotonic counter will never get reset."] - #[doc = ""] - #[doc = " @return the number of frames read so far"] + #[doc = " The number of audio frames read from the stream.\n This monotonic counter will never get reset.\n\n @return the number of frames read so far"] #[link_name = "\u{1}_ZN4oboe11AudioStream13getFramesReadEv"] pub fn oboe_AudioStream_getFramesRead(this: *mut ::std::os::raw::c_void) -> i64; } extern "C" { - #[doc = " Get the estimated time that the frame at `framePosition` entered or left the audio processing"] - #[doc = " pipeline."] - #[doc = ""] - #[doc = " This can be used to coordinate events and interactions with the external environment, and to"] - #[doc = " estimate the latency of an audio stream. An example of usage can be found in the hello-oboe"] - #[doc = " sample (search for \"calculateCurrentOutputLatencyMillis\")."] - #[doc = ""] - #[doc = " The time is based on the implementation's best effort, using whatever knowledge is available"] - #[doc = " to the system, but cannot account for any delay unknown to the implementation."] - #[doc = ""] - #[doc = " Note that due to issues in Android before R, we recommend NOT calling"] - #[doc = " this method from a data callback. See this tech note for more details."] - #[doc = " https://github.com/google/oboe/blob/main/docs/notes/rlsbuffer.md"] - #[doc = ""] - #[doc = " See"] - #[doc = " @param clockId the type of clock to use e.g. CLOCK_MONOTONIC"] - #[doc = " @return a FrameTimestamp containing the position and time at which a particular audio frame"] - #[doc = " entered or left the audio processing pipeline, or an error if the operation failed."] + #[doc = " Get the estimated time that the frame at `framePosition` entered or left the audio processing\n pipeline.\n\n This can be used to coordinate events and interactions with the external environment, and to\n estimate the latency of an audio stream. An example of usage can be found in the hello-oboe\n sample (search for \"calculateCurrentOutputLatencyMillis\").\n\n The time is based on the implementation's best effort, using whatever knowledge is available\n to the system, but cannot account for any delay unknown to the implementation.\n\n Note that due to issues in Android before R, we recommend NOT calling\n this method from a data callback. See this tech note for more details.\n https://github.com/google/oboe/blob/main/docs/notes/rlsbuffer.md\n\n See\n @param clockId the type of clock to use e.g. CLOCK_MONOTONIC\n @return a FrameTimestamp containing the position and time at which a particular audio frame\n entered or left the audio processing pipeline, or an error if the operation failed."] #[link_name = "\u{1}_ZN4oboe11AudioStream12getTimestampEi"] pub fn oboe_AudioStream_getTimestamp( this: *mut ::std::os::raw::c_void, @@ -1253,10 +878,7 @@ extern "C" { ) -> oboe_ResultWithValue; } extern "C" { - #[doc = " Wait for a transition from one state to another."] - #[doc = " @return OK if the endingState was observed, or ErrorUnexpectedState"] - #[doc = " if any state that was not the startingState or endingState was observed"] - #[doc = " or ErrorTimeout."] + #[doc = " Wait for a transition from one state to another.\n @return OK if the endingState was observed, or ErrorUnexpectedState\n if any state that was not the startingState or endingState was observed\n or ErrorTimeout."] #[link_name = "\u{1}_ZN4oboe11AudioStream22waitForStateTransitionENS_11StreamStateES1_l"] pub fn oboe_AudioStream_waitForStateTransition( this: *mut ::std::os::raw::c_void, @@ -1266,8 +888,7 @@ extern "C" { ) -> oboe_Result; } pub const oboe_AudioStream_kMinDelayBeforeCloseMillis: ::std::os::raw::c_int = 10; -#[doc = " This struct is a stateless functor which closes an AudioStream prior to its deletion."] -#[doc = " This means it can be used to safely delete a smart pointer referring to an open stream."] +#[doc = " This struct is a stateless functor which closes an AudioStream prior to its deletion.\n This means it can be used to safely delete a smart pointer referring to an open stream."] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct oboe_StreamDeleterFunctor { @@ -1286,18 +907,7 @@ fn bindgen_test_layout_oboe_StreamDeleterFunctor() { concat!("Alignment of ", stringify!(oboe_StreamDeleterFunctor)) ); } -#[doc = " LatencyTuner can be used to dynamically tune the latency of an output stream."] -#[doc = " It adjusts the stream's bufferSize by monitoring the number of underruns."] -#[doc = ""] -#[doc = " This only affects the latency associated with the first level of buffering that is closest"] -#[doc = " to the application. It does not affect low latency in the HAL, or touch latency in the UI."] -#[doc = ""] -#[doc = " Call tune() right before returning from your data callback function if using callbacks."] -#[doc = " Call tune() right before calling write() if using blocking writes."] -#[doc = ""] -#[doc = " If you want to see the ongoing results of this tuning process then call"] -#[doc = " stream->getBufferSize() periodically."] -#[doc = ""] +#[doc = " LatencyTuner can be used to dynamically tune the latency of an output stream.\n It adjusts the stream's bufferSize by monitoring the number of underruns.\n\n This only affects the latency associated with the first level of buffering that is closest\n to the application. It does not affect low latency in the HAL, or touch latency in the UI.\n\n Call tune() right before returning from your data callback function if using callbacks.\n Call tune() right before calling write() if using blocking writes.\n\n If you want to see the ongoing results of this tuning process then call\n stream->getBufferSize() periodically.\n"] #[repr(C)] #[repr(align(8))] #[derive(Debug, Copy, Clone)] @@ -1323,36 +933,22 @@ fn bindgen_test_layout_oboe_LatencyTuner() { ); } extern "C" { - #[doc = " Adjust the bufferSizeInFrames to optimize latency."] - #[doc = " It will start with a low latency and then raise it if an underrun occurs."] - #[doc = ""] - #[doc = " Latency tuning is only supported for AAudio."] - #[doc = ""] - #[doc = " @return OK or negative error, ErrorUnimplemented for OpenSL ES"] + #[doc = " Adjust the bufferSizeInFrames to optimize latency.\n It will start with a low latency and then raise it if an underrun occurs.\n\n Latency tuning is only supported for AAudio.\n\n @return OK or negative error, ErrorUnimplemented for OpenSL ES"] #[link_name = "\u{1}_ZN4oboe12LatencyTuner4tuneEv"] pub fn oboe_LatencyTuner_tune(this: *mut oboe_LatencyTuner) -> oboe_Result; } extern "C" { - #[doc = " This may be called from another thread. Then tune() will call reset(),"] - #[doc = " which will lower the latency to the minimum and then allow it to rise back up"] - #[doc = " if there are glitches."] - #[doc = ""] - #[doc = " This is typically called in response to a user decision to minimize latency. In other words,"] - #[doc = " call this from a button handler."] + #[doc = " This may be called from another thread. Then tune() will call reset(),\n which will lower the latency to the minimum and then allow it to rise back up\n if there are glitches.\n\n This is typically called in response to a user decision to minimize latency. In other words,\n call this from a button handler."] #[link_name = "\u{1}_ZN4oboe12LatencyTuner12requestResetEv"] pub fn oboe_LatencyTuner_requestReset(this: *mut oboe_LatencyTuner); } extern "C" { - #[doc = " @return true if the audio stream's buffer size is at the maximum value. If no maximum value"] - #[doc = " was specified when constructing the LatencyTuner then the value of"] - #[doc = " stream->getBufferCapacityInFrames is used"] + #[doc = " @return true if the audio stream's buffer size is at the maximum value. If no maximum value\n was specified when constructing the LatencyTuner then the value of\n stream->getBufferCapacityInFrames is used"] #[link_name = "\u{1}_ZN4oboe12LatencyTuner21isAtMaximumBufferSizeEv"] pub fn oboe_LatencyTuner_isAtMaximumBufferSize(this: *mut oboe_LatencyTuner) -> bool; } extern "C" { - #[doc = " Construct a new LatencyTuner object which will act on the given audio stream"] - #[doc = ""] - #[doc = " @param stream the stream who's latency will be tuned"] + #[doc = " Construct a new LatencyTuner object which will act on the given audio stream\n\n @param stream the stream who's latency will be tuned"] #[link_name = "\u{1}_ZN4oboe12LatencyTunerC1ERNS_11AudioStreamE"] pub fn oboe_LatencyTuner_LatencyTuner( this: *mut oboe_LatencyTuner, @@ -1360,10 +956,7 @@ extern "C" { ); } extern "C" { - #[doc = " Construct a new LatencyTuner object which will act on the given audio stream."] - #[doc = ""] - #[doc = " @param stream the stream who's latency will be tuned"] - #[doc = " @param the maximum buffer size which the tune() operation will set the buffer size to"] + #[doc = " Construct a new LatencyTuner object which will act on the given audio stream.\n\n @param stream the stream who's latency will be tuned\n @param the maximum buffer size which the tune() operation will set the buffer size to"] #[link_name = "\u{1}_ZN4oboe12LatencyTunerC1ERNS_11AudioStreamEi"] pub fn oboe_LatencyTuner_LatencyTuner1( this: *mut oboe_LatencyTuner, @@ -1407,16 +1000,13 @@ pub struct oboe_Version { } #[doc = " This is incremented when we make breaking API changes. Based loosely on https://semver.org/."] pub const oboe_Version_Major: u8 = 1; -#[doc = " This is incremented when we add backwards compatible functionality. Or set to zero when MAJOR is"] -#[doc = " incremented."] +#[doc = " This is incremented when we add backwards compatible functionality. Or set to zero when MAJOR is\n incremented."] pub const oboe_Version_Minor: u8 = 7; -#[doc = " This is incremented when we make backwards compatible bug fixes. Or set to zero when MINOR is"] -#[doc = " incremented."] +#[doc = " This is incremented when we make backwards compatible bug fixes. Or set to zero when MINOR is\n incremented."] pub const oboe_Version_Patch: u16 = 0; #[doc = " Version string in the form MAJOR.MINOR.PATCH."] pub const oboe_Version_Text: &[u8; 6usize] = b"1.7.0\0"; -#[doc = " Integer representation of the current Oboe library version. This will always increase when the"] -#[doc = " version number changes so can be compared using integer comparison."] +#[doc = " Integer representation of the current Oboe library version. This will always increase when the\n version number changes so can be compared using integer comparison."] pub const oboe_Version_Number: u32 = 17235968; #[test] fn bindgen_test_layout_oboe_Version() { @@ -1442,6 +1032,9 @@ pub struct oboe_StabilizedCallback { } #[test] fn bindgen_test_layout_oboe_StabilizedCallback() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), 48usize, @@ -1452,74 +1045,46 @@ fn bindgen_test_layout_oboe_StabilizedCallback() { 8usize, concat!("Alignment of ", stringify!(oboe_StabilizedCallback)) ); - fn test_field_mCallback() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mCallback) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mCallback) - ) - ); - } - test_field_mCallback(); - fn test_field_mFrameCount() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mFrameCount) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mFrameCount) - ) - ); - } - test_field_mFrameCount(); - fn test_field_mEpochTimeNanos() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mEpochTimeNanos) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mEpochTimeNanos) - ) - ); - } - test_field_mEpochTimeNanos(); - fn test_field_mOpsPerNano() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mOpsPerNano) as usize - ptr as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(oboe_StabilizedCallback), - "::", - stringify!(mOpsPerNano) - ) - ); - } - test_field_mOpsPerNano(); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mCallback) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mCallback) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mFrameCount) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mFrameCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mEpochTimeNanos) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mEpochTimeNanos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mOpsPerNano) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(oboe_StabilizedCallback), + "::", + stringify!(mOpsPerNano) + ) + ); } extern "C" { #[link_name = "\u{1}_ZN4oboe18StabilizedCallbackC1EPNS_19AudioStreamCallbackE"] @@ -1545,6 +1110,7 @@ extern "C" { numFrames: i32, ) -> oboe_DataCallbackResult; } +pub type oboe_AudioStreamShared = [u64; 2usize]; pub type oboe_DropContextHandler = ::std::option::Option; pub type oboe_AudioReadyHandler = ::std::option::Option< @@ -1649,10 +1215,6 @@ extern "C" { error: oboe_Result, ); } -extern "C" { - #[link_name = "\u{1}_ZN4oboe33AudioStreamCallbackWrapper_deleteEPv"] - pub fn oboe_AudioStreamCallbackWrapper_delete(callback: *mut ::std::os::raw::c_void); -} extern "C" { #[link_name = "\u{1}_ZN4oboe22AudioStreamBuilder_newEv"] pub fn oboe_AudioStreamBuilder_new() -> *mut oboe_AudioStreamBuilder; @@ -1670,7 +1232,7 @@ extern "C" { audio_ready: oboe_AudioReadyHandler, before_close: oboe_ErrorCloseHandler, after_close: oboe_ErrorCloseHandler, - ) -> *mut ::std::os::raw::c_void; + ); } extern "C" { #[link_name = "\u{1}_ZN4oboe30AudioStreamBuilder_getAudioApiEPKNS_18AudioStreamBuilderE"] @@ -1692,11 +1254,10 @@ extern "C" { ) -> *mut oboe_AudioStreamBase; } extern "C" { - #[link_name = "\u{1}_ZN4oboe35AudioStreamBuilder_openStreamSharedEPNS_18AudioStreamBuilderEPPNS_11AudioStreamEPPv"] + #[link_name = "\u{1}_ZN4oboe35AudioStreamBuilder_openStreamSharedEPNS_18AudioStreamBuilderEPNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] pub fn oboe_AudioStreamBuilder_openStreamShared( builder: *mut oboe_AudioStreamBuilder, - stream: *mut *mut oboe_AudioStream, - shared_ptr: *mut *mut ::std::os::raw::c_void, + sharedStream: *mut oboe_AudioStreamShared, ) -> oboe_Result; } extern "C" { @@ -1704,8 +1265,21 @@ extern "C" { pub fn oboe_AudioStream_delete(oboeStream: *mut oboe_AudioStream); } extern "C" { - #[link_name = "\u{1}_ZN4oboe24AudioStream_deleteSharedEPv"] - pub fn oboe_AudioStream_deleteShared(shared_ptr: *mut ::std::os::raw::c_void); + #[link_name = "\u{1}_ZN4oboe23AudioStream_cloneSharedEPKNSt6__ndk110shared_ptrINS_11AudioStreamEEEPS3_"] + pub fn oboe_AudioStream_cloneShared( + sharedStream: *const oboe_AudioStreamShared, + newSharedStream: *mut oboe_AudioStreamShared, + ); +} +extern "C" { + #[link_name = "\u{1}_ZN4oboe24AudioStream_deleteSharedEPNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] + pub fn oboe_AudioStream_deleteShared(sharedStream: *mut oboe_AudioStreamShared); +} +extern "C" { + #[link_name = "\u{1}_ZN4oboe23AudioStream_derefSharedEPKNSt6__ndk110shared_ptrINS_11AudioStreamEEE"] + pub fn oboe_AudioStream_derefShared( + sharedStream: *const oboe_AudioStreamShared, + ) -> *const oboe_AudioStream; } extern "C" { #[link_name = "\u{1}_ZN4oboe16AudioStream_openEPNS_11AudioStreamE"] From 082fd30d9062f22f4b2b62328086748a1fc0850f Mon Sep 17 00:00:00 2001 From: K Date: Mon, 16 Jan 2023 23:48:27 +0500 Subject: [PATCH 4/7] Update nix shell --- default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 8e53945..2b8d6bb 100644 --- a/default.nix +++ b/default.nix @@ -3,7 +3,7 @@ with pkgs; let androidComposition = androidenv.composeAndroidPackages { #toolsVersion = "25.2.5"; - platformToolsVersion = "31.0.2"; + platformToolsVersion = "33.0.3"; buildToolsVersions = [ "30.0.3" ]; #includeEmulator = true; #emulatorVersion = "27.2.0"; @@ -17,7 +17,8 @@ let #cmakeVersions = [ "3.6.4111459" ]; includeNDK = true; #ndkVersion = "21.0.6113669"; - ndkVersion = "21.3.6528147"; + #ndkVersion = "21.3.6528147"; + ndkVersion = "21.4.7075529"; useGoogleAPIs = false; useGoogleTVAddOns = false; includeExtras = [ From bded6fbab0d5921d3b2b3b8d2f7d116bd300a93f Mon Sep 17 00:00:00 2001 From: K Date: Mon, 16 Jan 2023 23:48:48 +0500 Subject: [PATCH 5/7] Add helper rules for generating bindings manually --- Makefile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Makefile b/Makefile index 84a9cc5..3246864 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,22 @@ doc: @DOCS_RS=1 cargo +nightly doc --features java-interface,doc-cfg --target x86_64-linux-android + +ANDROID_TARGETS := \ + armv7-linux-androideabi \ + aarch64-linux-android \ + i686-linux-android \ + x86_64-linux-android + +ANDROID_API-armv7-linux-androideabi := 16 +ANDROID_API-i686-linux-android := 16 +ANDROID_API-aarch64-linux-android := 21 +ANDROID_API-x86_64-linux-android := 21 + +define bindgen-rules +bindgen: bindgen-$(1) +bindgen-$(1): + @cargo ndk --android-platform $$(ANDROID_API-$(1)) --target $(1) -- build --release --features generate-bindings + @cp target/$(1)/release/build/oboe-sys-*/out/bindings.rs sys/src/bindings_`echo $(1) | sed -r 's/^([^-]+).*$$$$/\1/'`.rs +endef + +$(foreach target,$(ANDROID_TARGETS),$(eval $(call bindgen-rules,$(target)))) From 1ece737132f4d107e7f0c3d30e3f0bfb487c5d0b Mon Sep 17 00:00:00 2001 From: K Date: Tue, 17 Jan 2023 00:47:58 +0500 Subject: [PATCH 6/7] Update CI rules --- .github/workflows/rust.yml | 43 ++++++++++++++++++------------------- demo/release.keystore | Bin 0 -> 2660 bytes 2 files changed, 21 insertions(+), 22 deletions(-) create mode 100644 demo/release.keystore diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1b4b9ec..bf2904e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,7 +10,7 @@ jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Setup Rust @@ -21,7 +21,7 @@ jobs: components: rustfmt default: true override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: Format uses: actions-rs/cargo@v1 with: @@ -31,7 +31,7 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Setup Rust @@ -43,7 +43,7 @@ jobs: components: rust-docs default: true override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: Documentation uses: actions-rs/cargo@v1 env: @@ -86,7 +86,7 @@ jobs: components: clippy default: true override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -114,7 +114,7 @@ jobs: - i686-linux-android - x86_64-linux-android steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Setup JDK @@ -142,23 +142,23 @@ jobs: default: true override: true - name: Setup Cargo ndk - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cargo/bin/cargo-ndk key: ${{ runner.os }}-cargo-ndk-v1 - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: Prepare config id: config run: | if [[ "${{ matrix.target }}" =~ "64" ]]; then - echo "::set-output name=android-api::21" + echo "android-api=21" >> $GITHUB_OUTPUT else - echo "::set-output name=android-api::16" + echo "android-api=16" >> $GITHUB_OUTPUT fi if [[ "${{ matrix.profile }}" == "release" ]]; then - echo "::set-output name=cargo-args::--release" + echo "cargo-args=--release" >> $GITHUB_OUTPUT else - echo "::set-output name=cargo-args::" + echo "cargo-args=" >> $GITHUB_OUTPUT fi - name: Build target ${{ matrix.target }} uses: actions-rs/cargo@v1 @@ -170,7 +170,7 @@ jobs: - name: Get latest build path id: result run: | - echo "::set-output name=build-path::$(ls -td target/${{ matrix.target }}/${{ matrix.profile }}/build/oboe-sys-*/ | head -1)" + echo "build-path=$(ls -td target/${{ matrix.target }}/${{ matrix.profile }}/build/oboe-sys-*/ | head -1)" >> $GITHUB_OUTPUT - name: Copy bindings if: matrix.rust == 'stable' && matrix.profile == 'release' run: | @@ -198,7 +198,7 @@ jobs: - build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Download bindings @@ -223,7 +223,7 @@ jobs: - cargo-apk runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Setup JDK @@ -239,15 +239,14 @@ jobs: with: targets: armv7-linux-androideabi, aarch64-linux-android, i686-linux-android, x86_64-linux-android - name: Setup Cargo apk - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cargo/bin/cargo-apk key: ${{ runner.os }}-cargo-apk - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: Create signing key run: | - echo ${{ secrets.APK_SIGN_KEY_DATA }} | base64 -d > demo/release.keystore - sed -i 's/keystore_password = "android"/keystore_password = "${{ secrets.APK_SIGN_KEY_SECRET }}"/' demo/Cargo.toml + sed -i 's/keystore_password = "android"/keystore_password = "${{ secrets.APK_KEYSTORE_PASSWORD }}"/' demo/Cargo.toml - name: Build demo apk uses: actions-rs/cargo@v1 with: @@ -292,7 +291,7 @@ jobs: - release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Setup Rust @@ -311,7 +310,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Prepare cache - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache with: path: ~/.cargo/bin/cargo-ndk @@ -327,7 +326,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Prepare cache - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache with: path: ~/.cargo/bin/cargo-apk diff --git a/demo/release.keystore b/demo/release.keystore new file mode 100644 index 0000000000000000000000000000000000000000..48617bc309a728c51e2b0e294042e764fe07009f GIT binary patch literal 2660 zcma);X*d*$8pq9;g+U>rktJK!nqdZmIrcr1WyY2yOUH~H`N03=}5M=Pn|FXa|5E-2MQ%?F>R0!LDQtU7QFoz7*{3)s|Of-qL$Lw$%2)xV*1c)HmAuRvC2xJ8_Ap{|;jubDcn1LEvD{xJR;yFz-k4Ib{+;nxF^L4z*vuJ!xZA8H6Uub&9;U%6Fz=Bw4~5=us^ z45xDw|GBm1IVAkCTf|6|E?3;i^C`(_6aMWBAoeDQlB#~SZR*UkQg9%h{$W)xZEd3{Qx(5tp=Faey|{%Yg0K7R|DE9NoDt zl6c*R&>}mDf)A0w1G|5eEDkRP26zcMx=eW}YJg1(!-p9qV-9!=j&&8lKEOm)?c=gx z+M=wJ@rp$-^d5|`A{Oe}dj5U>(llMf`CEI0ogNTVk%p^pwUS29*QxjCyh}*yXONC- zE#~B-mIK2dJSmy4S!L*FlI-ISFcS6&Tab1|ok!Ij*z}=m*GInab+#em>YhF!aC5W8 zzb%`(wJq0dfvHePyn)EU_oy}9n5Y*gMcj%gMH@*w5Tqw?=HFFxrfjvlc}Q*jc6Z7~ z2c)F^BrBpKtI)^!E@8%tixvx$?J8O9e@&=68=Zz}&u-W^-uBH>gl|+xq^X*vQsJ5p zUPKjWHM$;B3&YT#VG14V_`rnnby=In<%YVkT*n?8o5*}0NafIXr8%*T@jUNH5j%M; zt;rOmWV8sSk74t+rs;{E!pVtky@;B^tjWMRBC0Rc-L4yDdHOW7;D-f6@D=hiZyYA_ z>eiXWxYDbByUVEP)=@^8fw(?|eim6MNS>Lj6EHiHttRm{@b()1cJn>cyV9AY?lLa= z?u@($&8Okm@1CkMk{GGG#4p`d6ebGXyf4qlN-u>c{{VEuxw#(J7Fy>x1Tj9!C`D=e zzEGR^KsVs?x=?SV@7@2#@!pxkB!lyvwO{nX@u{u@r&sq|cKv4tlg1^dd!~LgJn-pf z2|nqqX4|CUocqzWQrIs?$k4D;&b%Wbx$ckr0zag# z#V)%%mtmJp!V(UXAlYgkqHeYh2su-2ie@pefKeko4OrHmoViYZ4Ba&35Heb~8GOg) zld49-{d)p}lzai1voDNSgk^(<`V&a1c=6|4UQuC99eM0Dl^GTL+hXf*qsbJ2Y2g>i zC@XJzINpznl0zRoeH@6*OE9c|J~m!zB*>aF(`q3dgxRO!aCgn~g{KUgt;3wCGrm&z zDrU=zLTdQcX|jn{G{UCIU{NztYinBl^;C(CD4WUE&)F+R-9Y0trwK=?B%QuQ-i3I% zJj0AuQ+FQt9r&pti*dmtVpoi%Q8?P>H8yheCJ#=4C`(A8d4+iFp(LFOjmPHB3E7Jk zx22=-7!Ur~n4V9rbo2iQ(d<=5 zyPZRpD)nk29jRaUu;FCpDjL+kh8ma{$d#!Ra)GwsFu+CH9u{fo?n<~zs>T$Nk5&uf zrtV(n)Kqc1eBUqyp~_~@Qe3Oq8rp;Hg;h2qSk|)KPl*Oc@gZq=BTI43Mcch#?X~)mecFnZd;#tW;RLYxT zW&?A;rP@Lta2POgH~3PuM+n-Ca@a9|jnOm;V9B|}{oXt%`UKf!V|!8?N-@kGa`dFz zEBSLm1l&F8Kb!`vB!rja(I}Dwz4iRO08M*6OcU(SLA7o-AjKBr^*J9HzV+vIU#Q&H zr-K?4SFWqdUrTy?L3t&s@Zx5M&U6GeyZ3!pu!`lLz0Ww)ng0DP-gh;y=UOgX`=5gf zf|@HU^EQ9CIm)VNm2W-U&vL7Mb!_h&MDZIW7EDyzPJAkx42`&GAK;;$$<*l{R=GAT z$=I)B@5^cNBX61x{$YCCKX*vNY#EgPiH{Mmra}jneB<~Nm!SVBt-4ZRcz412 z9bfcdQS28V{|lR#b}7xxi=qIx5J|x4vRyc$vU~(?jOC8SqQ(9sNsVP5^DdXoB-`(d z`7OC^#A?`kY{f!LOgcxK1JBs~B{$MjtXBJspgiC{UQs~2y50(HI=Npi9d3+E%tus{ zJd$@;ajd>hInnIQaW&Gqao@1hQ1L6)67tvGR8wQeHLdO_E_o}^#Y-vh9dYXU)$E<~ z#3fIk@!{hHr=^8B&%WN~B2(2xs4a+$*GrYw+snGWG-y+EV}Gl0RQUC(ck+--7+a(4 zjd)d_ddVPEX8Blp?Ln zK1V?AGo-R_9FQ9ICZes=Sqr)!rHM83!yPi_4WJQKq436*W$a9Gf_572J;9 z&uMlDb{xb9>x-3m9VLcQ(sRkQ|FjRMZIX>2Wni8I1U4kRKn??$F_qY?13r1oux@fy zq=@b}{+Fp+@vv8UR?j%hrUWXqb?-nC<45VgD@4w|!d#M1)_zQP7&-rGalv_y?_qXE z{@Y_Bv;wrEW_gN^;EbJdme6>s>g^+jq{kBKhW8#UD~eBkPCbO3-CZBM{7g_gInrL2 zt2`r=aN-tYkT*qRhblHI^EOxpStCplNCd~P&kG0uGl4|FLZZli*>Svx^!UzzfGRM; sv>~ARYfrU_Pm_7L# Date: Tue, 17 Jan 2023 01:12:26 +0500 Subject: [PATCH 7/7] Fix clippy suggestions --- demo/src/audio.rs | 11 ++++------- demo/src/window.rs | 2 +- src/audio_stream.rs | 8 ++++---- src/java_interface/audio_features.rs | 6 +----- src/java_interface/devices_info.rs | 5 ++--- src/java_interface/stream_defaults.rs | 4 ++-- src/java_interface/utils.rs | 26 +++++++++++++------------- 7 files changed, 27 insertions(+), 35 deletions(-) diff --git a/demo/src/audio.rs b/demo/src/audio.rs index 9cc7f34..5ba450a 100644 --- a/demo/src/audio.rs +++ b/demo/src/audio.rs @@ -86,10 +86,7 @@ impl SineParam { self.delta.store(delta, Ordering::Release); self.sample_rate.store(sample_rate, Ordering::Relaxed); - println!( - "Prepare sine wave generator: samplerate={}, time delta={}", - sample_rate, delta - ); + println!("Prepare sine wave generator: samplerate={sample_rate}, time delta={delta}"); } fn set_frequency(&self, frequency: f32) { @@ -151,7 +148,7 @@ impl AudioOutputCallback for SineWave { fn on_audio_ready( &mut self, - stream: &mut dyn AudioOutputStreamSafe, + _stream: &mut dyn AudioOutputStreamSafe, frames: &mut [f32], ) -> DataCallbackResult { for frame in frames { @@ -166,7 +163,7 @@ impl AudioOutputCallback for SineWave { fn on_audio_ready( &mut self, - stream: &mut dyn AudioOutputStreamSafe, + _stream: &mut dyn AudioOutputStreamSafe, frames: &mut [(f32, f32)], ) -> DataCallbackResult { for frame in frames { @@ -180,7 +177,7 @@ impl AudioOutputCallback for SineWave { /// Print device's audio info pub fn audio_probe() { if let Err(error) = DefaultStreamValues::init() { - eprintln!("Unable to init default stream values due to: {}", error); + eprintln!("Unable to init default stream values due to: {error}"); } println!("Default stream values:"); diff --git a/demo/src/window.rs b/demo/src/window.rs index 4013983..f370583 100644 --- a/demo/src/window.rs +++ b/demo/src/window.rs @@ -90,7 +90,7 @@ impl ViewContext { .with_gl_debug_flag(false) .with_srgb(false) .with_vsync(true) - .build_windowed(wb, &el) + .build_windowed(wb, el) .unwrap(); let context = unsafe { context.make_current().unwrap() }; //let gl = Gl::load_with(|ptr| window_context.get_proc_address(ptr) as *const _); diff --git a/src/audio_stream.rs b/src/audio_stream.rs index 5fea92a..bdf7238 100644 --- a/src/audio_stream.rs +++ b/src/audio_stream.rs @@ -679,11 +679,11 @@ impl RawAudioStreamBase for AudioStreamAsync { impl RawAudioStream for AudioStreamAsync { fn _raw_stream(&self) -> &ffi::oboe_AudioStream { - &*self.raw + &self.raw } fn _raw_stream_mut(&mut self) -> &mut ffi::oboe_AudioStream { - &mut *self.raw + &mut self.raw } } @@ -735,11 +735,11 @@ impl RawAudioStreamBase for AudioStreamSync { impl RawAudioStream for AudioStreamSync { fn _raw_stream(&self) -> &ffi::oboe_AudioStream { - &*self.raw + &self.raw } fn _raw_stream_mut(&mut self) -> &mut ffi::oboe_AudioStream { - &mut *self.raw + &mut self.raw } } diff --git a/src/java_interface/audio_features.rs b/src/java_interface/audio_features.rs index 308b90d..919cdfe 100644 --- a/src/java_interface/audio_features.rs +++ b/src/java_interface/audio_features.rs @@ -46,11 +46,7 @@ impl AudioFeature { } } -fn try_check_system_feature<'a>( - env: &JNIEnv<'a>, - activity: JObject, - feature: &str, -) -> JResult { +fn try_check_system_feature(env: &JNIEnv<'_>, activity: JObject, feature: &str) -> JResult { let package_manager = get_package_manager(env, activity)?; has_system_feature(env, package_manager, feature) diff --git a/src/java_interface/devices_info.rs b/src/java_interface/devices_info.rs index 7aed1a6..ccdf5ae 100644 --- a/src/java_interface/devices_info.rs +++ b/src/java_interface/devices_info.rs @@ -38,8 +38,8 @@ impl AudioDeviceInfo { } } -fn try_request_devices_info<'a>( - env: &JNIEnv<'a>, +fn try_request_devices_info( + env: &JNIEnv<'_>, context: JObject, direction: AudioDeviceDirection, ) -> JResult> { @@ -52,7 +52,6 @@ fn try_request_devices_info<'a>( let length = env.get_array_length(raw_devices)?; (0..length) - .into_iter() .map(|index| { let device = env.get_object_array_element(raw_devices, index)?; diff --git a/src/java_interface/stream_defaults.rs b/src/java_interface/stream_defaults.rs index 2b19020..47a877b 100644 --- a/src/java_interface/stream_defaults.rs +++ b/src/java_interface/stream_defaults.rs @@ -49,8 +49,8 @@ impl DefaultStreamValues { } } -fn try_request_default_stream_values<'a>( - env: &JNIEnv<'a>, +fn try_request_default_stream_values( + env: &JNIEnv<'_>, context: JObject, ) -> JResult<(Option, Option)> { let audio_manager = get_system_service(env, context, Context::AUDIO_SERVICE)?; diff --git a/src/java_interface/utils.rs b/src/java_interface/utils.rs index 97b0600..d8d2066 100644 --- a/src/java_interface/utils.rs +++ b/src/java_interface/utils.rs @@ -27,8 +27,8 @@ where Executor::new(vm).with_attached(|env| closure(env, context)) } -pub fn call_method_no_args_ret_int_array<'a>( - env: &JNIEnv<'a>, +pub fn call_method_no_args_ret_int_array( + env: &JNIEnv<'_>, subject: JObject, method: &str, ) -> JResult> { @@ -44,24 +44,24 @@ pub fn call_method_no_args_ret_int_array<'a>( Ok(values) } -pub fn call_method_no_args_ret_int<'a>( - env: &JNIEnv<'a>, +pub fn call_method_no_args_ret_int( + env: &JNIEnv<'_>, subject: JObject, method: &str, ) -> JResult { env.call_method(subject, method, "()I", &[])?.i() } -pub fn call_method_no_args_ret_bool<'a>( - env: &JNIEnv<'a>, +pub fn call_method_no_args_ret_bool( + env: &JNIEnv<'_>, subject: JObject, method: &str, ) -> JResult { env.call_method(subject, method, "()Z", &[])?.z() } -pub fn call_method_no_args_ret_string<'a>( - env: &JNIEnv<'a>, +pub fn call_method_no_args_ret_string( + env: &JNIEnv<'_>, subject: JObject, method: &str, ) -> JResult { @@ -73,8 +73,8 @@ pub fn call_method_no_args_ret_string<'a>( .map(String::from) } -pub fn call_method_no_args_ret_char_sequence<'a>( - env: &JNIEnv<'a>, +pub fn call_method_no_args_ret_char_sequence( + env: &JNIEnv<'_>, subject: JObject, method: &str, ) -> JResult { @@ -92,8 +92,8 @@ pub fn call_method_no_args_ret_char_sequence<'a>( .map(String::from) } -pub fn call_method_string_arg_ret_bool<'a, S: AsRef>( - env: &JNIEnv<'a>, +pub fn call_method_string_arg_ret_bool>( + env: &JNIEnv<'_>, subject: JObject, name: &str, arg: S, @@ -150,7 +150,7 @@ pub fn get_package_manager<'a>(env: &JNIEnv<'a>, subject: JObject<'a>) -> JResul .l() } -pub fn has_system_feature<'a>(env: &JNIEnv<'a>, subject: JObject, name: &str) -> JResult { +pub fn has_system_feature(env: &JNIEnv<'_>, subject: JObject, name: &str) -> JResult { call_method_string_arg_ret_bool(env, subject, "hasSystemFeature", name) }