Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

API design ideas. #15

Open
mitchmindtree opened this issue Mar 29, 2015 · 4 comments
Open

API design ideas. #15

mitchmindtree opened this issue Mar 29, 2015 · 4 comments

Comments

@mitchmindtree
Copy link
Member

It looks like the Tonic library has some great API design ideas for constructing controllers, generators and processors.

@bvssvni
Copy link

bvssvni commented Mar 29, 2015

I like the idea that you can use operators to combine them.

@filmor
Copy link
Contributor

filmor commented Sep 2, 2015

Another idea might be allowing arbitrary types from pitch_calc to be used for note_on and note_off messages.

@mitchmindtree
Copy link
Member Author

@filmor thanks for the suggestion! I originally considered this also, but thought it might be safer/simpler to keep the design simple for now as each of the pitch_calc makes it easy to convert to hz anyway. i.e.

let c_1 = LetterOctave(Letter::C, 1);
synth.note_on(c_1.hz(), 1.0);

I'm open to the idea of adding a ToHz trait though and implementing it for each of the pitch_calc types, and then having the note_on and note_off methods take T: ToHz instead :)

@filmor
Copy link
Contributor

filmor commented Sep 2, 2015

That was my idea, yes. If you want I can prepare a PR for this. If used synth in a simple midi player example, that's where it came up (see https://github.com/filmor/midi-rs/blob/master/examples/play.rs).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants