-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
11 changed files
with
98 additions
and
7 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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use helgoboss_learn::{Interval, DEFAULT_OSC_ARG_VALUE_RANGE}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct IntervalData<T> { | ||
min: T, | ||
max: T, | ||
} | ||
|
||
impl<T: Copy + PartialOrd> IntervalData<T> { | ||
pub fn from_interval(interval: Interval<T>) -> Self { | ||
Self { | ||
min: interval.min_val(), | ||
max: interval.max_val(), | ||
} | ||
} | ||
|
||
pub fn to_interval(&self) -> Interval<T> { | ||
Interval::new_auto(self.min, self.max) | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct OscValueRange(IntervalData<f64>); | ||
|
||
impl Default for OscValueRange { | ||
fn default() -> Self { | ||
Self(IntervalData::from_interval(DEFAULT_OSC_ARG_VALUE_RANGE)) | ||
} | ||
} | ||
|
||
impl OscValueRange { | ||
pub fn from_interval(interval: Interval<f64>) -> Self { | ||
Self(IntervalData::from_interval(interval)) | ||
} | ||
|
||
pub fn to_interval(&self) -> Interval<f64> { | ||
self.0.to_interval() | ||
} | ||
} |
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 |
---|---|---|
|
@@ -53,3 +53,6 @@ mod virtual_control; | |
pub use virtual_control::*; | ||
|
||
mod clip_legacy; | ||
|
||
mod common; | ||
pub use common::*; |
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