mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-04 06:01:35 +11:00
Use Default::default which is nicer
This commit is contained in:
parent
2e453e8e0f
commit
b583ba22a9
|
@ -209,12 +209,7 @@ pub fn parse_midi(midi_info: &MidiInfo) -> TokenStream {
|
||||||
let channel_data = &mut channel_data[channel_id];
|
let channel_data = &mut channel_data[channel_id];
|
||||||
let pattern = &mut patterns[channel_id];
|
let pattern = &mut patterns[channel_id];
|
||||||
|
|
||||||
pattern.resize_with((current_ticks as usize).saturating_sub(1), || PatternSlot {
|
pattern.resize_with((current_ticks as usize).saturating_sub(1), Default::default);
|
||||||
speed: 0.into(),
|
|
||||||
sample: 0,
|
|
||||||
effect1: PatternEffect::None,
|
|
||||||
effect2: PatternEffect::None,
|
|
||||||
});
|
|
||||||
|
|
||||||
match message {
|
match message {
|
||||||
midly::MidiMessage::NoteOff { .. } => pattern.push(PatternSlot {
|
midly::MidiMessage::NoteOff { .. } => pattern.push(PatternSlot {
|
||||||
|
@ -329,12 +324,7 @@ pub fn parse_midi(midi_info: &MidiInfo) -> TokenStream {
|
||||||
});
|
});
|
||||||
|
|
||||||
for pattern in &mut patterns {
|
for pattern in &mut patterns {
|
||||||
pattern.resize_with(current_ticks as usize, || PatternSlot {
|
pattern.resize_with(current_ticks as usize, Default::default);
|
||||||
speed: 0.into(),
|
|
||||||
sample: 0,
|
|
||||||
effect1: PatternEffect::None,
|
|
||||||
effect2: PatternEffect::None,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let frames_per_tick = initial_microseconds_per_beat.expect("No tempo was ever sent") as f64
|
let frames_per_tick = initial_microseconds_per_beat.expect("No tempo was ever sent") as f64
|
||||||
|
|
|
@ -32,7 +32,7 @@ pub struct Pattern {
|
||||||
pub start_position: usize,
|
pub start_position: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||||
pub struct PatternSlot {
|
pub struct PatternSlot {
|
||||||
pub speed: Num<u16, 8>,
|
pub speed: Num<u16, 8>,
|
||||||
pub sample: u16,
|
pub sample: u16,
|
||||||
|
@ -48,7 +48,7 @@ pub struct Envelope<'a> {
|
||||||
pub loop_end: Option<usize>,
|
pub loop_end: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub enum PatternEffect {
|
pub enum PatternEffect {
|
||||||
/// Don't play an effect
|
/// Don't play an effect
|
||||||
#[default]
|
#[default]
|
||||||
|
|
Loading…
Reference in a new issue