-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
# MSeq | ||
|
||
[![CI/CD](https://github.com/MF-Room/mseq/actions/workflows/rust.yml/badge.svg)](https://github.com/MF-Room/mseq/actions/workflows/rust.yml) | ||
[![doc](https://docs.rs/mseq/badge.svg)](https://docs.rs/mseq) [![crates.io](https://img.shields.io/crates/v/mseq.svg)](https://crates.io/crates/mseq) [![CI/CD](https://github.com/MF-Room/mseq/actions/workflows/rust.yml/badge.svg)](https://github.com/MF-Room/mseq/actions/workflows/rust.yml) | ||
|
||
Library for developing MIDI Sequencers. | ||
|
||
*WIP* | ||
## Usage | ||
|
||
Add this to your `Cargo.toml`: | ||
|
||
```toml | ||
[dependencies] | ||
mseq = "0.1" | ||
``` | ||
To start using `mseq`, create a struct that implements the `Conductor` trait. | ||
|
||
You can then add tracks to your sequencer by adding fields (to your struct that implements the | ||
`Conductor` trait) of type `DeteTrack` or more generally fields that implement the trait `Track`. | ||
|
||
Once this is done, you can play your track in the `Conductor::update` function of your struct that | ||
implements the `Conductor` trait. To do so, call the method `MidiController::play_track` (of | ||
the `Context::midi`) with the track you want to play as a parameter. | ||
|
||
You can find some examples in the [`examples`](https://github.com/MF-Room/mseq/tree/main/examples) directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
use crate::{Context, MidiConnection}; | ||
|
||
/// The Conductor trait is the trait that the client has to implement to be able to use mseq. The | ||
/// client has to implement init and update, then pass the Conductor to the main entry point | ||
/// (`mseq::run`). Refer to the examples in `examples/` for complete examples. | ||
/// The Conductor trait is the trait that the user has to implement to be able to use mseq. The | ||
/// user has to implement [`Conductor::init`] and [`Conductor::update`], then pass the Conductor to the main entry point | ||
/// [`crate::run`]. Refer to these [`examples`] for complete implementation examples. | ||
/// | ||
/// [`examples`]: https://github.com/MF-Room/mseq/tree/main/examples | ||
pub trait Conductor { | ||
/// This function will be called only once when the Conductor is passed to the main entry point. | ||
/// This function will be called only once at the start when the Conductor is passed to [`crate::run`] (the main entry point). | ||
fn init(&mut self, context: &mut Context<impl MidiConnection>); | ||
/// This function will be called at every midi clock. All the notes sent to the MidiController | ||
/// (`context.midi_controller`) will be played at the next midi clock. | ||
/// This function will be called at every midi clock cycle. All the notes sent to the [`Context::midi`] | ||
/// will be played at the beginning of the next midi clock cycle. | ||
/// | ||
/// __Warning: if this function takes too long, the midi clock might be late. Be careful not to | ||
/// do any intensive computation, call sleep(), or wait for a lock inside this function.__ | ||
/// do any intensive computation, ot block the thread.__ | ||
fn update(&mut self, context: &mut Context<impl MidiConnection>); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters