Add endpoint::get_name() and an enumerate example
This commit is contained in:
parent
8f11173256
commit
ec48453b6f
|
@ -8,6 +8,7 @@ fn main() {
|
||||||
println!("Endpoints: ");
|
println!("Endpoints: ");
|
||||||
for (endpoint_index, endpoint) in endpoints.enumerate() {
|
for (endpoint_index, endpoint) in endpoints.enumerate() {
|
||||||
println!("{}. Endpoint \"{}\" Audio formats: ", endpoint_index + 1, endpoint.get_name());
|
println!("{}. Endpoint \"{}\" Audio formats: ", endpoint_index + 1, endpoint.get_name());
|
||||||
|
|
||||||
let formats = endpoint.get_supported_formats_list().unwrap();
|
let formats = endpoint.get_supported_formats_list().unwrap();
|
||||||
for (format_index, format) in formats.enumerate() {
|
for (format_index, format) in formats.enumerate() {
|
||||||
println!("{}.{}. {:?}", endpoint_index + 1, format_index + 1, format);
|
println!("{}.{}. {:?}", endpoint_index + 1, format_index + 1, format);
|
||||||
|
|
|
@ -33,6 +33,11 @@ impl Endpoint {
|
||||||
|
|
||||||
Ok(Some(format).into_iter())
|
Ok(Some(format).into_iter())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn get_name(&self) -> String {
|
||||||
|
"unknown".to_owned() // TODO:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Voice {
|
pub struct Voice {
|
||||||
|
|
|
@ -105,6 +105,12 @@ impl Endpoint {
|
||||||
{
|
{
|
||||||
Ok(SupportedFormatsIterator(try!(self.0.get_supported_formats_list())))
|
Ok(SupportedFormatsIterator(try!(self.0.get_supported_formats_list())))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the name of the endpoint.
|
||||||
|
#[inline]
|
||||||
|
pub fn get_name(&self) -> String {
|
||||||
|
self.0.get_name()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Number of channels.
|
/// Number of channels.
|
||||||
|
|
|
@ -33,6 +33,11 @@ impl Endpoint {
|
||||||
{
|
{
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn get_name(&self) -> String {
|
||||||
|
"null".to_owned()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SupportedFormatsIterator;
|
pub struct SupportedFormatsIterator;
|
||||||
|
|
|
@ -51,6 +51,11 @@ unsafe impl Send for Endpoint {}
|
||||||
unsafe impl Sync for Endpoint {}
|
unsafe impl Sync for Endpoint {}
|
||||||
|
|
||||||
impl Endpoint {
|
impl Endpoint {
|
||||||
|
#[inline]
|
||||||
|
pub fn get_name(&self) -> String {
|
||||||
|
"unknown".to_owned() // TODO:
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_immdevice(device: *mut winapi::IMMDevice) -> Endpoint {
|
fn from_immdevice(device: *mut winapi::IMMDevice) -> Endpoint {
|
||||||
Endpoint {
|
Endpoint {
|
||||||
|
|
Loading…
Reference in New Issue