1use baton_studio::*;
2use nusb::MaybeFuture;
3use std::error::Error;
4
5fn main() -> Result<(), Box<dyn Error>> {
6 let device = nusb::list_devices()
7 .wait()?
8 .find(|dev| dev.vendor_id() == 0x194f && dev.product_id() == 0x010d)
9 .ok_or(std::io::Error::new(
10 std::io::ErrorKind::NotFound,
11 "device not found",
12 ))?
13 .open()
14 .wait()?;
15
16 let mut command = Command::new();
17
18 for m in 0..9 {
20 command.set_output_fader(m, Value::Unity).send(&device)?;
21 }
22
23 let mut daw_channel_left = 16;
36 let mut daw_channel_right;
37
38 for m in 0..9 {
39 daw_channel_left += 2;
40 daw_channel_right = daw_channel_left + 1;
41 for c in 0..35 {
42 if c == daw_channel_left {
43 command
44 .set_input_fader(c, m, Channel::Left, Value::Unity)
45 .send(&device)?;
46 command
47 .set_input_fader(c, m, Channel::Right, Value::Muted)
48 .send(&device)?;
49 } else if c == daw_channel_right {
50 command
51 .set_input_fader(c, m, Channel::Left, Value::Muted)
52 .send(&device)?;
53 command
54 .set_input_fader(c, m, Channel::Right, Value::Unity)
55 .send(&device)?;
56 } else {
57 command
58 .set_input_fader(c, m, Channel::Left, Value::Muted)
59 .send(&device)?;
60 command
61 .set_input_fader(c, m, Channel::Right, Value::Muted)
62 .send(&device)?;
63 }
64 }
65 }
66
67 Ok(())
68}