Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosprint committed May 22, 2024
1 parent 76823c7 commit 1d3e32a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Rust

on:
push:
branches:
- main
pull_request:
env:
CARGO_TERM_COLOR: always

jobs:
fmt:
name: stable / fmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run cargo fmt
run: cargo fmt -- --check
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
clippy_check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust stable with Clippy
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Run Clippy
run: cargo clippy --all-features -- -D warnings
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn main() {
let path = file.path().clone();
let path = path.to_str().unwrap();
if path.ends_with(".wav") {
options.push(format!("{}", path));
options.push(path.into());
}
}
if options.is_empty() {
Expand Down
4 changes: 2 additions & 2 deletions src/playback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn play_audio(file_path: &str, device: &str, jack: bool) -> Result<()> {
};
let sample = sample / (1 << 23) as f32;
let channel = sample_count % num_channels;
file_data[channel].push(sample as f32);
file_data[channel].push(sample);
sample_count += 1;
}
}
Expand Down Expand Up @@ -344,7 +344,7 @@ pub fn play_audio(file_path: &str, device: &str, jack: bool) -> Result<()> {
);
f.render_widget(chart, chunks[1]);
let label = Span::styled(
format!("press ENTER to exit tui and stop playback."),
"press ENTER to exit tui and stop playback.",
Style::default()
.fg(Color::Yellow)
.add_modifier(Modifier::ITALIC | Modifier::BOLD),
Expand Down
9 changes: 3 additions & 6 deletions src/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,8 @@ fn record_tui(
let duration = now.duration_since(start_time);
let recording_time = format!("Recording Time: {:.2}s", duration.as_secs_f32());

match *recording_state.lock() {
RecordingState::Recording => {
draw_rec_waveform(&mut terminal, shared_waveform_data.clone(), recording_time)?;
}
_ => {}
if let RecordingState::Recording = *recording_state.lock() {
draw_rec_waveform(&mut terminal, shared_waveform_data.clone(), recording_time)?;
}

if event::poll(refresh_interval)? {
Expand Down Expand Up @@ -135,7 +132,7 @@ fn draw_rec_waveform(
f.render_widget(time_paragraph, chunks[0]);

let label = Span::styled(
format!("press ENTER to exit tui and finish recording..."),
"press ENTER to exit tui and finish recording...",
Style::default()
.fg(Color::Yellow)
.add_modifier(Modifier::ITALIC | Modifier::BOLD),
Expand Down

0 comments on commit 1d3e32a

Please sign in to comment.