Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pitch wheel #5

Merged
merged 4 commits into from
Sep 12, 2024
Merged

Pitch wheel #5

merged 4 commits into from
Sep 12, 2024

Conversation

joculatrix
Copy link
Owner

Add support for MIDI pitch wheels.

Also abstracts some Oscillator functionality into an auxiliary struct called PitchController.

This commit:
* Creates a new private struct called `PitchController`.
* Moves details of frequency, MIDI pitch, and detuning into `PitchController`
so `Oscillator` has to deal with as little of it as possible on its own.
* Renames `OscMode` to `PitchMode`.
* Renames `Message::OscMode` to `Message::PitchMode`.
* Renames `Oscillator::set_coarse_detune()` and `Oscillator::set_fine_detune()`
to `detune_coarse()` and `detune_fine()`.
* Removes or strips down several `Oscillator` methods/fields to reference
or call `PitchController` instead.
This commit:
* Adds a test module `pitch_control_tests` to provide basic checks for
`PitchController` functionality.
* Removes an unnecessary `mut` from `PitchController::get_freq()`.
This commit:
* Allows `midi` to send `Message::PitchBend`.
* Implements the function `PitchController::pitch_bend()`, which uses
bit operations to convert the MIDI bytes to a usable value.
* Updates `PitchController::get_freq()` to use the pitch bend value.
* Adds a `byte_conversion_is_correct` test to `pitch_control_tests`.
@joculatrix joculatrix merged commit 462f730 into main Sep 12, 2024
1 check passed
@joculatrix joculatrix deleted the pitch_wheel branch September 12, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant