Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 44 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "maolan-engine"
version = "0.4.24"
version = "0.4.25"
edition = "2024"
description = "Audio engine for the Maolan DAW with audio/MIDI tracks, routing, export, and out-of-process CLAP/VST3/LV2 plugin support"
license = "BSD-2-Clause"
Expand Down
9 changes: 9 additions & 0 deletions src/engine/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,15 @@ pub struct MidiLearnFields {
/// Hardware MIDI event queues/routes and active-note tracking.
#[derive(Default)]
pub struct HwMidiFields {
pub timecode_enabled: bool,
pub timecode_decoders: HashMap<String, crate::midi::mtc::Decoder>,
pub timecode_active_device: Option<String>,
pub timecode_last_received: Option<Instant>,
pub timecode_running: bool,
pub timecode_output_enabled: bool,
pub timecode_output_generator: Option<crate::midi::mtc::Generator>,
pub midi_clock_output_enabled: bool,
pub midi_clock_output_generator: Option<crate::midi::clock::Generator>,
pub pending_hw_midi_events: Vec<MidiEvent>,
pub pending_hw_midi_events_by_device: HashMap<String, Vec<MidiEvent>>,
pub pending_hw_midi_out_events: Vec<MidiEvent>,
Expand Down
30 changes: 30 additions & 0 deletions src/engine/hardware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ impl Engine {
self.midi_hub = Some(MidiHub::default());
}
self.jack_runtime = Some(runtime);
let sample_rate = self.sample_rate();
let position = self.transport.transport_sample;
if let Some(generator) = self.hw_midi.timecode_output_generator.as_mut() {
generator.set_sample_rate(sample_rate, position);
}
if let Some(generator) = self.hw_midi.midi_clock_output_generator.as_mut() {
generator.set_sample_rate(sample_rate);
}
self.publish_hw_ports();
self.publish_hw_infos(input_channels, output_channels, rate)
.await;
Expand Down Expand Up @@ -368,6 +376,13 @@ impl Engine {
self.transport.playing = matches!(play_sync, JackTransportPlaySync::Start);
self.bump_prepare_generation();
self.transport.transport_running = self.transport.playing;
self.reset_midi_timecode_output(true);
if self.transport.playing {
self.start_midi_clock_output();
} else {
self.send_midi_clock_transport(0xFC);
self.reset_midi_clock_output();
}
if matches!(play_sync, JackTransportPlaySync::Start) {
self.restart_render_clock();
self.transport.transport_restart_pending = false;
Expand All @@ -388,6 +403,13 @@ impl Engine {
if let Some(sample) = decision.position_sync {
self.transport.transport_sample = sample;
self.restart_render_clock();
self.reset_midi_timecode_output(true);
if self.transport.playing {
self.start_midi_clock_output();
} else {
self.send_midi_clock_song_position();
self.reset_midi_clock_output();
}
self.bump_prepare_generation();
self.notify_event(Event::TransportPosition(self.transport.transport_sample))
.await;
Expand Down Expand Up @@ -552,6 +574,14 @@ impl Engine {
capture_buffer_frames,
fresh_capture,
});
let sample_rate = self.sample_rate();
let position = self.transport.transport_sample;
if let Some(generator) = self.hw_midi.timecode_output_generator.as_mut() {
generator.set_sample_rate(sample_rate, position);
}
if let Some(generator) = self.hw_midi.midi_clock_output_generator.as_mut() {
generator.set_sample_rate(sample_rate);
}
// Bound the plugin-host wait by the device period (ARCHITECTURE.md
// Phase 3): min(100 ms, 2 × period).
#[cfg(feature = "plugins")]
Expand Down
3 changes: 3 additions & 0 deletions src/engine/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,9 @@ mod undo_consistency {
| Action::TransportPosition(_)
| Action::JumpToEnd
| Action::SetOscEnabled(_)
| Action::SetMidiTimecodeEnabled(_)
| Action::SetMidiTimecodeOutput { .. }
| Action::SetMidiClockOutput(_)
| Action::SetSessionClipPlaybackEnabled(_)
| Action::SetStepRecording(_)
| Action::Panic
Expand Down
Loading
Loading