diff --git a/src/alsa/enumerate.rs b/src/alsa/enumerate.rs index c96fcc6..b6da734 100644 --- a/src/alsa/enumerate.rs +++ b/src/alsa/enumerate.rs @@ -119,6 +119,6 @@ impl Iterator for EndpointsIterator { } #[inline] -pub fn get_default_endpoint() -> Option { +pub fn default_endpoint() -> Option { Some(Endpoint("default".to_owned())) } diff --git a/src/alsa/mod.rs b/src/alsa/mod.rs index 22f3cbf..b0fb361 100644 --- a/src/alsa/mod.rs +++ b/src/alsa/mod.rs @@ -1,7 +1,7 @@ extern crate alsa_sys as alsa; extern crate libc; -pub use self::enumerate::{EndpointsIterator, get_default_endpoint}; +pub use self::enumerate::{EndpointsIterator, default_endpoint}; use ChannelPosition; use CreationError; @@ -72,7 +72,7 @@ impl Drop for Trigger { pub struct Endpoint(String); impl Endpoint { - pub fn get_supported_formats_list( + pub fn supported_formats( &self) -> Result { unsafe { @@ -250,7 +250,7 @@ impl Endpoint { } #[inline] - pub fn get_name(&self) -> String { + pub fn name(&self) -> String { self.0.clone() } } @@ -762,7 +762,7 @@ impl Drop for VoiceInner { impl Buffer { #[inline] - pub fn get_buffer(&mut self) -> &mut [T] { + pub fn buffer(&mut self) -> &mut [T] { &mut self.buffer } diff --git a/src/coreaudio/enumerate.rs b/src/coreaudio/enumerate.rs index 7abc5b4..ea7c20f 100644 --- a/src/coreaudio/enumerate.rs +++ b/src/coreaudio/enumerate.rs @@ -29,7 +29,7 @@ impl Iterator for EndpointsIterator { } } -pub fn get_default_endpoint() -> Option { +pub fn default_endpoint() -> Option { Some(Endpoint) } diff --git a/src/coreaudio/mod.rs b/src/coreaudio/mod.rs index b96dcac..c06153e 100644 --- a/src/coreaudio/mod.rs +++ b/src/coreaudio/mod.rs @@ -24,13 +24,13 @@ use self::coreaudio::audio_unit::render_callback::{self, data}; mod enumerate; -pub use self::enumerate::{EndpointsIterator, SupportedFormatsIterator, get_default_endpoint}; +pub use self::enumerate::{EndpointsIterator, SupportedFormatsIterator, default_endpoint}; #[derive(Clone, PartialEq, Eq)] pub struct Endpoint; impl Endpoint { - pub fn get_supported_formats_list( + pub fn supported_formats( &self) -> Result { Ok( @@ -44,7 +44,7 @@ impl Endpoint { ) } - pub fn get_name(&self) -> String { + pub fn name(&self) -> String { "Default AudioUnit Endpoint".to_string() } } @@ -73,7 +73,7 @@ impl Buffer where T: Sample { #[inline] - pub fn get_buffer(&mut self) -> &mut [T] { + pub fn buffer(&mut self) -> &mut [T] { &mut self.buffer[..] } diff --git a/src/lib.rs b/src/lib.rs index 3914096..4128fb6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -135,7 +135,7 @@ pub fn get_endpoints_list() -> EndpointsIterator { /// Return the default endpoint, or `None` if no device is available. #[inline] pub fn default_endpoint() -> Option { - cpal_impl::get_default_endpoint().map(Endpoint) + cpal_impl::default_endpoint().map(Endpoint) } /// Deprecated. Use `default_endpoint()` instead. @@ -153,7 +153,7 @@ impl Endpoint { /// Returns an iterator that produces the list of formats that are supported by the backend. #[inline] pub fn supported_formats(&self) -> Result { - Ok(SupportedFormatsIterator(self.0.get_supported_formats_list()?)) + Ok(SupportedFormatsIterator(self.0.supported_formats()?)) } /// Deprecated. Use `supported_formats` instead. @@ -168,7 +168,7 @@ impl Endpoint { /// Returns the name of the endpoint. #[inline] pub fn name(&self) -> String { - self.0.get_name() + self.0.name() } /// Deprecated. Use `name()` instead. @@ -463,7 +463,7 @@ impl DerefMut for Buffer { #[inline] fn deref_mut(&mut self) -> &mut [T] { - self.target.as_mut().unwrap().get_buffer() + self.target.as_mut().unwrap().buffer() } } diff --git a/src/null/mod.rs b/src/null/mod.rs index df542be..bd29684 100644 --- a/src/null/mod.rs +++ b/src/null/mod.rs @@ -36,7 +36,7 @@ impl Iterator for EndpointsIterator { } #[inline] -pub fn get_default_endpoint() -> Option { +pub fn default_endpoint() -> Option { None } @@ -45,14 +45,14 @@ pub struct Endpoint; impl Endpoint { #[inline] - pub fn get_supported_formats_list( + pub fn supported_formats( &self) -> Result { unreachable!() } #[inline] - pub fn get_name(&self) -> String { + pub fn name(&self) -> String { "null".to_owned() } } @@ -103,7 +103,7 @@ pub struct Buffer { impl Buffer { #[inline] - pub fn get_buffer(&mut self) -> &mut [T] { + pub fn buffer(&mut self) -> &mut [T] { unreachable!() } diff --git a/src/wasapi/enumerate.rs b/src/wasapi/enumerate.rs index cc67330..3c4e19f 100644 --- a/src/wasapi/enumerate.rs +++ b/src/wasapi/enumerate.rs @@ -118,7 +118,7 @@ impl Iterator for EndpointsIterator { } } -pub fn get_default_endpoint() -> Option { +pub fn default_endpoint() -> Option { unsafe { let mut device = mem::uninitialized(); let hres = (*ENUMERATOR.0) diff --git a/src/wasapi/mod.rs b/src/wasapi/mod.rs index 64b7634..cc1fa5c 100644 --- a/src/wasapi/mod.rs +++ b/src/wasapi/mod.rs @@ -16,7 +16,7 @@ use FormatsEnumerationError; use SampleFormat; use SamplesRate; -pub use self::enumerate::{EndpointsIterator, get_default_endpoint}; +pub use self::enumerate::{EndpointsIterator, default_endpoint}; pub use self::voice::{Buffer, EventLoop, SamplesStream, Voice}; pub use std::option::IntoIter as OptionIntoIter; @@ -60,7 +60,7 @@ unsafe impl Sync for Endpoint { impl Endpoint { // TODO: this function returns a GUID of the endpoin // instead it should use the property store and return the friendly name - pub fn get_name(&self) -> String { + pub fn name(&self) -> String { unsafe { let mut name_ptr = mem::uninitialized(); // can only fail if wrong params or out of memory @@ -125,7 +125,7 @@ impl Endpoint { Ok(client) } - pub fn get_supported_formats_list( + pub fn supported_formats( &self) -> Result { // We always create voices in shared mode, therefore all samples go through an audio diff --git a/src/wasapi/voice.rs b/src/wasapi/voice.rs index 21698ef..f06961a 100644 --- a/src/wasapi/voice.rs +++ b/src/wasapi/voice.rs @@ -469,7 +469,7 @@ unsafe impl Send for Buffer { impl Buffer { #[inline] - pub fn get_buffer(&mut self) -> &mut [T] { + pub fn buffer(&mut self) -> &mut [T] { unsafe { slice::from_raw_parts_mut(self.buffer_data, self.buffer_len) } }