summaryrefslogtreecommitdiffstats
path: root/third_party/rust/coremidi/examples/endpoints.rs
blob: 1411d1d2aab8e62491bc4bbd97f0c4470544a36b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
extern crate coremidi;

fn main() {
    println!("System destinations:");

    for (i, destination) in coremidi::Destinations.into_iter().enumerate() {
        let display_name = get_display_name(&destination);
        println!("[{}] {}", i, display_name);
    }

    println!();
    println!("System sources:");

    for (i, source) in coremidi::Sources.into_iter().enumerate() {
        let display_name = get_display_name(&source);
        println!("[{}] {}", i, display_name);
    }
}

fn get_display_name(endpoint: &coremidi::Endpoint) -> String {
    endpoint
        .display_name()
        .unwrap_or_else(|| "[Unknown Display Name]".to_string())
}