Skip to content

Commit

Permalink
Add MidiController trait
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Aug 26, 2023
1 parent fb2db2e commit 17a80e0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repos:
stages:
- commit-msg
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.9.0
rev: v0.9.2
hooks:
- id: markdownlint-cli2
exclude: ^LICENSE\.md$
Expand All @@ -45,7 +45,7 @@ repos:
- id: codespell
args: [--ignore-words=.codespellignore]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.25.0
rev: 0.26.1
hooks:
- id: check-github-actions
- id: check-github-workflows
Expand Down
12 changes: 12 additions & 0 deletions src/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,15 @@ pub trait Controller {
event: <Self::Types as ControllerTypes>::InputEvent,
) -> Option<<Self::Types as ControllerTypes>::ControlAction>;
}

#[cfg(feature = "midi")]
pub trait MidiController:
Controller + crate::MidiOutputGateway<crate::BoxedMidiOutputConnection>
{
}

#[cfg(feature = "midi")]
impl<T> MidiController for T where
T: Controller + crate::MidiOutputGateway<crate::BoxedMidiOutputConnection>
{
}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ use std::{
mod controller;
pub use self::controller::{BoxedControllerTask, Controller, ControllerTypes};

#[cfg(feature = "midi")]
pub use self::controller::MidiController;

#[cfg(feature = "controller-thread")]
pub use self::controller::thread::ControllerThread;

Expand Down

0 comments on commit 17a80e0

Please sign in to comment.