forked from processing/libprocessing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmidi.rs
More file actions
18 lines (17 loc) · 717 Bytes
/
Copy pathmidi.rs
File metadata and controls
18 lines (17 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use processing::prelude::*;
use pyo3::{exceptions::PyRuntimeError, prelude::*};
pub fn connect(port: usize) -> PyResult<()> {
midi_connect(port).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
}
pub fn disconnect() -> PyResult<()> {
midi_disconnect().map_err(|e| PyRuntimeError::new_err(format!("{e}")))
}
pub fn refresh_ports() -> PyResult<()> {
midi_refresh_ports().map_err(|e| PyRuntimeError::new_err(format!("{e}")))
}
pub fn list_ports() -> PyResult<Vec<String>> {
midi_list_ports().map_err(|e| PyRuntimeError::new_err(format!("{e}")))
}
pub fn play_notes(note: u8, duration: u64) -> PyResult<()> {
midi_play_notes(note, duration).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
}