Rename the methods of the backend as well (#164)
This commit is contained in:
parent
84f0acbd65
commit
4b019243c2
|
@ -119,6 +119,6 @@ impl Iterator for EndpointsIterator {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_default_endpoint() -> Option<Endpoint> {
|
||||
pub fn default_endpoint() -> Option<Endpoint> {
|
||||
Some(Endpoint("default".to_owned()))
|
||||
}
|
||||
|
|
|
@ -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<SupportedFormatsIterator, FormatsEnumerationError> {
|
||||
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<T> Buffer<T> {
|
||||
#[inline]
|
||||
pub fn get_buffer(&mut self) -> &mut [T] {
|
||||
pub fn buffer(&mut self) -> &mut [T] {
|
||||
&mut self.buffer
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ impl Iterator for EndpointsIterator {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_default_endpoint() -> Option<Endpoint> {
|
||||
pub fn default_endpoint() -> Option<Endpoint> {
|
||||
Some(Endpoint)
|
||||
}
|
||||
|
||||
|
|
|
@ -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<SupportedFormatsIterator, FormatsEnumerationError> {
|
||||
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<T> Buffer<T>
|
|||
where T: Sample
|
||||
{
|
||||
#[inline]
|
||||
pub fn get_buffer(&mut self) -> &mut [T] {
|
||||
pub fn buffer(&mut self) -> &mut [T] {
|
||||
&mut self.buffer[..]
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Endpoint> {
|
||||
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<SupportedFormatsIterator, FormatsEnumerationError> {
|
||||
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<T> DerefMut for Buffer<T>
|
|||
{
|
||||
#[inline]
|
||||
fn deref_mut(&mut self) -> &mut [T] {
|
||||
self.target.as_mut().unwrap().get_buffer()
|
||||
self.target.as_mut().unwrap().buffer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ impl Iterator for EndpointsIterator {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_default_endpoint() -> Option<Endpoint> {
|
||||
pub fn default_endpoint() -> Option<Endpoint> {
|
||||
None
|
||||
}
|
||||
|
||||
|
@ -45,14 +45,14 @@ pub struct Endpoint;
|
|||
|
||||
impl Endpoint {
|
||||
#[inline]
|
||||
pub fn get_supported_formats_list(
|
||||
pub fn supported_formats(
|
||||
&self)
|
||||
-> Result<SupportedFormatsIterator, FormatsEnumerationError> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_name(&self) -> String {
|
||||
pub fn name(&self) -> String {
|
||||
"null".to_owned()
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ pub struct Buffer<T> {
|
|||
|
||||
impl<T> Buffer<T> {
|
||||
#[inline]
|
||||
pub fn get_buffer(&mut self) -> &mut [T] {
|
||||
pub fn buffer(&mut self) -> &mut [T] {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ impl Iterator for EndpointsIterator {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_default_endpoint() -> Option<Endpoint> {
|
||||
pub fn default_endpoint() -> Option<Endpoint> {
|
||||
unsafe {
|
||||
let mut device = mem::uninitialized();
|
||||
let hres = (*ENUMERATOR.0)
|
||||
|
|
|
@ -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<SupportedFormatsIterator, FormatsEnumerationError> {
|
||||
// We always create voices in shared mode, therefore all samples go through an audio
|
||||
|
|
|
@ -469,7 +469,7 @@ unsafe impl<T> Send for Buffer<T> {
|
|||
|
||||
impl<T> Buffer<T> {
|
||||
#[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) }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue