Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alters-mit committed Dec 8, 2023
1 parent 1a506f2 commit cf6c4e5
Show file tree
Hide file tree
Showing 9 changed files with 334 additions and 108 deletions.
32 changes: 14 additions & 18 deletions common/src/effect/effect_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,59 +33,55 @@ impl EffectType {
if up {
if *value < 1000 {
*value += 1;
return true
return true;
}
}
else {
} else {

Check failure on line 38 in common/src/effect/effect_type.rs

View workflow job for this annotation

GitHub Actions / Lint

this `else { if .. }` block can be collapsed
if *value > 0 {
*value -= 1;
return true
return true;
}
}
},
}
Self::Pan(value) => {
if up {
if *value < 500 {
*value += 1;
return true
return true;
}
}
else {
} else {

Check failure on line 51 in common/src/effect/effect_type.rs

View workflow job for this annotation

GitHub Actions / Lint

this `else { if .. }` block can be collapsed
if *value > -500 {
*value -= 1;
return true
return true;
}
}
}
Self::PitchBend(value) => {
if up {
if *value < 16383 {
*value += 1;
return true
return true;
}
}
else {
} else {

Check failure on line 64 in common/src/effect/effect_type.rs

View workflow job for this annotation

GitHub Actions / Lint

this `else { if .. }` block can be collapsed
if *value > 0 {
*value -= 1;
return true
return true;
}
}
}
Self::ChannelPressure(value) | Self::PolyphonicKeyPressure { key: _, value } => {
if up {
if *value < 127 {
*value += 1;
return true
return true;
}
}
else {
} else {

Check failure on line 77 in common/src/effect/effect_type.rs

View workflow job for this annotation

GitHub Actions / Lint

this `else { if .. }` block can be collapsed
if *value > 0 {
*value -= 1;
return true
return true;
}
}
}
}
}
false
}
}
8 changes: 5 additions & 3 deletions common/src/effect/valueless_effect_type.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use super::effect_type::EffectType;
use serde::{Deserialize, Serialize};

/// A hashable EffectType.
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Hash, Deserialize, Serialize)]
Expand Down Expand Up @@ -34,7 +34,9 @@ impl ValuelessEffectType {
EffectType::Pan(_) => *self == Self::Pan,
EffectType::PitchBend(_) => *self == Self::PitchBend,
EffectType::ChannelPressure(_) => *self == Self::ChannelPressure,
EffectType::PolyphonicKeyPressure { key: _, value: _ } => *self == Self::PolyphonicKeyPressure,
EffectType::PolyphonicKeyPressure { key: _, value: _ } => {
*self == Self::PolyphonicKeyPressure
}
}
}
}
}
4 changes: 1 addition & 3 deletions common/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ use serde::{Deserialize, Serialize};
use std::fmt::Display;
use std::ops::{AddAssign, SubAssign};


/// This is used to make const zero and one per type.
pub trait Indexable<T>
{
pub trait Indexable<T> {
const ZERO: T;
const ONE: T;
}
Expand Down
4 changes: 2 additions & 2 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ mod paths_state;
mod state;
pub mod time;
pub mod view;
pub use effect::{Effect, effect_type::EffectType, valueless_effect_type::ValuelessEffectType};
pub use effect::{effect_type::EffectType, valueless_effect_type::ValuelessEffectType, Effect};
pub use event::Event;
pub use index::Index;
mod indexed_values;
pub use indexed_values::IndexedValues;
pub use input_state::InputState;
pub use midi_track::MidiTrack;
pub use music::*;
pub use note::{Note, MAX_NOTE, MIN_NOTE, NOTE_NAMES, MIDDLE_C};
pub use note::{Note, MAX_NOTE, MIDDLE_C, MIN_NOTE, NOTE_NAMES};
pub use panel_type::PanelType;
pub use paths::Paths;
pub use state::State;
Expand Down
2 changes: 1 addition & 1 deletion common/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::ValuelessEffectType;
use crate::music_panel_field::MusicPanelField;
use crate::ValuelessEffectType;
use crate::{
EditMode, Index, IndexedEditModes, IndexedValues, InputState, Music, PanelType, PianoRollMode,
Selection, Time, View,
Expand Down
7 changes: 6 additions & 1 deletion data/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,14 @@ CloseLinksPanel = {"keys": ["Escape"]}
# Effects.
NextEffect = {"keys": ["Down"], "dt": 10}
PreviousEffect = {"keys": ["Up"], "dt": 10}
EffectTimeLeft = {"keys": ["Left"], "mods": ["LeftShift"], "dt": 5}
EffectTimeRight = {"keys": ["Right"], "mods": ["LeftShift"], "dt": 5}
IncrementEffectValue = {"keys": ["Right"], "dt": 2}
DecrementEffectValue = {"keys": ["Left"], "dt": 2}
DeleteEffect = {"keys": ["Delete"]}
IncrementAftertouchNote = {"keys": ["Right"], "mods": ["LeftControl", "LeftShift"], "dt": 5}
DecrementAftertouchNote = {"keys": ["Left"], "mods": ["LeftControl", "LeftShift"], "dt": 5}
AddEffect = {"keys": ["Return"]}
RemoveEffect = {"keys": ["Delete"]}

# Qwerty note input.
C = {"keys": ["A"]}
Expand Down
10 changes: 8 additions & 2 deletions data/text.csv
Original file line number Diff line number Diff line change
Expand Up @@ -502,5 +502,11 @@ EFFECT_TYPE_PITCH_BEND,Pitch Bend
EFFECT_TYPE_CHANNEL_PRESSURE,Channel Pressure
EFFECT_TYPE_POLYPHONIC_KEY_PRESSURE,Aftertouch
EFFECTS_PANEL_INPUT_TTS_SCROLL,\0 and \1 to scroll.
EFFECTS_PANEL_INPUT_TTS_VALUE,\0 and \1 to set the effect value.
EFFECTS_PANEL_INPUT_TTS_AFTERTOCH_KEY,\0 and \1 to set the aftertouch note.
EFFECTS_PANEL_INPUT_TTS_ADD,\0 to add a %0 effect.
EFFECTS_PANEL_INPUT_TTS_REMOVE,\0 to remove a %0 effect.
EFFECTS_PANEL_INPUT_TTS_TIME,\0 and \1 to set the time.
EFFECTS_PANE_INPUT_TTS_VALUE,\0 and \1 to set the effect's value.
EFFECTS_PANEL_INPUT_TTS_AFTERTOUCH,\0 and \1 to set the aftertouch note.
EFFECTS_PANEL_STATUS_TTS_NO_EFFECT,The selected effect is \0 but you haven't added this effect.
EFFECTS_PANEL_STATUS_TTS_EFFECT_NAME,The selected effect is \0. The value is \1. The time is \2.
EFFECTS_PANEL_STATUS_TTS_AFTERTOUCH_KEY,The aftertouch note is \0.
7 changes: 6 additions & 1 deletion input/src/input_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,14 @@ pub enum InputEvent {
// Effects panel.
NextEffect,
PreviousEffect,
EffectTimeLeft,
EffectTimeRight,
IncrementEffectValue,
DecrementEffectValue,
DeleteEffect,
IncrementAftertouchNote,
DecrementAftertouchNote,
AddEffect,
RemoveEffect,
// Qwerty note input.
C,
CSharp,
Expand Down
Loading

0 comments on commit cf6c4e5

Please sign in to comment.