Skip to content

Commit 7bba3fb

Browse files
committed
Make audio-visualizations an optional feature
1 parent 4d67b67 commit 7bba3fb

File tree

4 files changed

+32
-35
lines changed

4 files changed

+32
-35
lines changed

Cargo.lock

Lines changed: 13 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inputmodule-control/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@ image = "0.24.5"
1212
rand = "0.8.5"
1313
chrono = "0.4.23"
1414

15-
vis-core = { git = "https://github.com/Rahix/visualizer2.git", rev = '1fe908012a9c156695921f3b6bb47178e1332b92' }
15+
# For audio visualizations
16+
vis-core = {git = 'https://github.com/Rahix/visualizer2.git', rev = '1fe908012a9c156695921f3b6bb47178e1332b92', optional = true}
17+
[features]
18+
audio-visualizations = ["vis-core"]

inputmodule-control/src/inputmodule.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ pub fn serial_commands(args: &crate::ClapCli) {
242242
random_eq_cmd(&serialdevs);
243243
}
244244

245+
#[cfg(feature = "audio-visualizations")]
245246
if ledmatrix_args.input_eq {
246247
input_eq_cmd(&serialdevs);
247248
}
@@ -640,6 +641,7 @@ fn random_eq_cmd(serialdevs: &Vec<String>) {
640641
}
641642
}
642643

644+
#[cfg(feature = "audio-visualizations")]
643645
/// The data-type for storing analyzer results
644646
#[derive(Debug, Clone)]
645647
pub struct AnalyzerResult {
@@ -648,6 +650,7 @@ pub struct AnalyzerResult {
648650
beat: f32,
649651
}
650652

653+
#[cfg(feature = "audio-visualizations")]
651654
// Equalizer-like animation that expands as volume goes up and retracts as it goes down
652655
fn input_eq_cmd(serialdevs: &Vec<String>) {
653656
// Example from https://github.com/Rahix/visualizer2/blob/canon/README.md

ledmatrix/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ inputmodule-control led-matrix --random-eq
117117
inputmodule-control led-matrix --eq 1 2 3 4 5 4 3 2 1
118118
```
119119

120+
###### Input equalizer
121+
122+
This command generates an equalizer-like visualization of the current audio input. It has only been tested on Linux-based systems running `alsa` or equivalent.
123+
124+
You must compile the `inputmodule-control` binary with the `audio-visualization` feature on:
125+
`cargo clean && cargo build --features audio-visualizations --target x86_64-unknown-linux-gnu -p inputmodule-control`
126+
127+
Once compiled, you can use the `--input-eq` arg to try the visualizer:
128+
```sh
129+
inputmodule-control led-matrix --input-eq
130+
```
131+
120132
###### Custom string
121133

122134
Display a custom string of up to 5 characters.

0 commit comments

Comments
 (0)