Fix: MIDI precision
This commit is contained in:
@@ -19,7 +19,7 @@ use soft_ratatui::embedded_graphics_unicodefonts::{
|
||||
use soft_ratatui::{EmbeddedGraphics, SoftBackend};
|
||||
|
||||
use cagire::engine::{
|
||||
build_stream, AnalysisHandle, AudioStreamConfig, LinkState, MidiCommand, ScopeBuffer,
|
||||
build_stream, AnalysisHandle, AudioStreamConfig, LinkState, ScopeBuffer,
|
||||
SequencerHandle, SpectrumBuffer,
|
||||
};
|
||||
use cagire::init::{init, InitArgs};
|
||||
@@ -27,7 +27,6 @@ use cagire::input::{handle_key, handle_mouse, InputContext, InputResult};
|
||||
use cagire::input_egui::{convert_egui_events, convert_egui_mouse, EguiMouseState};
|
||||
use cagire::settings::Settings;
|
||||
use cagire::views;
|
||||
use crossbeam_channel::Receiver;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "cagire-desktop", about = "Cagire desktop application")]
|
||||
@@ -160,7 +159,6 @@ struct CagireDesktop {
|
||||
_stream: Option<cpal::Stream>,
|
||||
_input_stream: Option<cpal::Stream>,
|
||||
_analysis_handle: Option<AnalysisHandle>,
|
||||
midi_rx: Receiver<MidiCommand>,
|
||||
device_lost: Arc<AtomicBool>,
|
||||
stream_error_rx: crossbeam_channel::Receiver<String>,
|
||||
current_font: FontChoice,
|
||||
@@ -207,7 +205,6 @@ impl CagireDesktop {
|
||||
_stream: b.stream,
|
||||
_input_stream: b.input_stream,
|
||||
_analysis_handle: b.analysis_handle,
|
||||
midi_rx: b.midi_rx,
|
||||
device_lost: b.device_lost,
|
||||
stream_error_rx: b.stream_error_rx,
|
||||
current_font,
|
||||
@@ -237,7 +234,6 @@ impl CagireDesktop {
|
||||
return;
|
||||
};
|
||||
let new_audio_rx = sequencer.swap_audio_channel();
|
||||
self.midi_rx = sequencer.swap_midi_channel();
|
||||
|
||||
let new_config = AudioStreamConfig {
|
||||
output_device: self.app.audio.config.output_device.clone(),
|
||||
@@ -288,6 +284,7 @@ impl CagireDesktop {
|
||||
self.app.audio.config.sample_rate = info.sample_rate;
|
||||
self.app.audio.config.host_name = info.host_name;
|
||||
self.app.audio.config.channels = info.channels;
|
||||
self.app.audio.config.input_sample_rate = info.input_sample_rate;
|
||||
self.sample_rate_shared
|
||||
.store(info.sample_rate as u32, Ordering::Relaxed);
|
||||
self.app.audio.error = None;
|
||||
@@ -414,59 +411,6 @@ impl eframe::App for CagireDesktop {
|
||||
self.app.flush_dirty_patterns(&sequencer.cmd_tx);
|
||||
self.app.flush_dirty_script(&sequencer.cmd_tx);
|
||||
|
||||
while let Ok(midi_cmd) = self.midi_rx.try_recv() {
|
||||
match midi_cmd {
|
||||
MidiCommand::NoteOn {
|
||||
device,
|
||||
channel,
|
||||
note,
|
||||
velocity,
|
||||
} => {
|
||||
self.app.midi.send_note_on(device, channel, note, velocity);
|
||||
}
|
||||
MidiCommand::NoteOff {
|
||||
device,
|
||||
channel,
|
||||
note,
|
||||
} => {
|
||||
self.app.midi.send_note_off(device, channel, note);
|
||||
}
|
||||
MidiCommand::CC {
|
||||
device,
|
||||
channel,
|
||||
cc,
|
||||
value,
|
||||
} => {
|
||||
self.app.midi.send_cc(device, channel, cc, value);
|
||||
}
|
||||
MidiCommand::PitchBend {
|
||||
device,
|
||||
channel,
|
||||
value,
|
||||
} => {
|
||||
self.app.midi.send_pitch_bend(device, channel, value);
|
||||
}
|
||||
MidiCommand::Pressure {
|
||||
device,
|
||||
channel,
|
||||
value,
|
||||
} => {
|
||||
self.app.midi.send_pressure(device, channel, value);
|
||||
}
|
||||
MidiCommand::ProgramChange {
|
||||
device,
|
||||
channel,
|
||||
program,
|
||||
} => {
|
||||
self.app.midi.send_program_change(device, channel, program);
|
||||
}
|
||||
MidiCommand::Clock { device } => self.app.midi.send_realtime(device, 0xF8),
|
||||
MidiCommand::Start { device } => self.app.midi.send_realtime(device, 0xFA),
|
||||
MidiCommand::Stop { device } => self.app.midi.send_realtime(device, 0xFC),
|
||||
MidiCommand::Continue { device } => self.app.midi.send_realtime(device, 0xFB),
|
||||
}
|
||||
}
|
||||
|
||||
let should_quit = self.handle_input(ctx);
|
||||
if should_quit {
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
|
||||
|
||||
Reference in New Issue
Block a user