Feat: cleanup

This commit is contained in:
2026-02-22 13:28:03 +01:00
parent 3093b40dbc
commit 3d552ec072
26 changed files with 213 additions and 181 deletions

View File

@@ -1,3 +1,5 @@
//! Audio output stream (cpal) and FFT spectrum analysis.
use ringbuf::{traits::*, HeapRb};
use rustfft::{num_complex::Complex, FftPlanner};
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
@@ -173,8 +175,8 @@ impl SpectrumAnalyzer {
pub struct AnalysisHandle {
running: Arc<AtomicBool>,
#[allow(dead_code)]
thread: Option<JoinHandle<()>>,
// Held to keep the thread alive until this handle is dropped.
_thread: Option<JoinHandle<()>>,
}
impl Drop for AnalysisHandle {
@@ -202,7 +204,7 @@ pub fn spawn_analysis_thread(
let handle = AnalysisHandle {
running,
thread: Some(thread),
_thread: Some(thread),
};
(producer, handle)

View File

@@ -7,20 +7,27 @@ mod timing;
pub use timing::{substeps_in_window, StepTiming, SyncTime};
// Used by plugin and desktop crates via the lib; not by the terminal binary directly.
pub use audio::{preload_sample_heads, AnalysisHandle, ScopeBuffer, SpectrumBuffer};
// Re-exported for the plugin crate (not used by the terminal binary).
#[allow(unused_imports)]
pub use audio::{
preload_sample_heads, spawn_analysis_thread, AnalysisHandle, ScopeBuffer, SpectrumBuffer,
};
pub use audio::spawn_analysis_thread;
#[cfg(feature = "cli")]
pub use audio::{build_stream, AudioStreamConfig};
#[cfg(feature = "cli")]
#[allow(unused_imports)]
pub use audio::{build_stream, AudioStreamConfig, AudioStreamInfo};
pub use audio::AudioStreamInfo;
pub use link::LinkState;
pub use sequencer::{
spawn_sequencer, AudioCommand, MidiCommand, PatternChange, PatternSnapshot, SeqCommand,
SequencerConfig, SequencerHandle, SequencerSnapshot, StepSnapshot,
};
// Re-exported for the plugin crate (not used by the terminal binary).
#[allow(unused_imports)]
pub use sequencer::{
parse_midi_command, spawn_sequencer, AudioCommand, MidiCommand, PatternChange, PatternSnapshot,
SeqCommand, SequencerConfig, SequencerHandle, SequencerSnapshot, SequencerState,
SharedSequencerState, StepSnapshot, TickInput, TickOutput, TimestampedCommand,
parse_midi_command, SequencerState, SharedSequencerState, TickInput, TickOutput,
TimestampedCommand,
};

View File

@@ -1,3 +1,5 @@
//! Real-time pattern sequencer: evaluates Forth scripts per step and produces audio/MIDI commands.
use arc_swap::ArcSwap;
use crossbeam_channel::{bounded, unbounded, Receiver, Sender};
use parking_lot::Mutex;
@@ -132,6 +134,7 @@ pub struct PatternSnapshot {
pub speed: crate::model::PatternSpeed,
pub length: usize,
pub steps: Vec<StepSnapshot>,
#[allow(dead_code)]
pub quantization: LaunchQuantization,
pub sync_mode: SyncMode,
pub follow_up: FollowUp,
@@ -164,7 +167,6 @@ pub struct SharedSequencerState {
pub beat: f64,
}
#[allow(dead_code)]
pub struct SequencerSnapshot {
pub active_patterns: Vec<ActivePatternState>,
step_traces: Arc<StepTracesMap>,