-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
XXX WIP massive refactoring for v0.2.0
- Loading branch information
Showing
29 changed files
with
1,166 additions
and
1,471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# https://doc.rust-lang.org/cargo/reference/config.html | ||
# | ||
# Compile for maximum performance. Only relevant for example binaries in this | ||
# repository. | ||
|
||
[build] | ||
rustflags = [ | ||
"-C", | ||
"target-cpu=native", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
max_line_length = 80 | ||
|
||
[*.yml] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Build | ||
|
||
# Triggers the workflow on push or pull request events (for any branch in a repository) | ||
on: [ push, pull_request ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
- nightly | ||
- 1.59.0 # MSRV | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Important preparation step: override the latest default Rust version in GitHub CI | ||
# with the current value of the iteration in the "strategy.matrix.rust"-array. | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: default | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
# required because of "cpal" | ||
- run: sudo apt update && sudo apt install libasound2-dev -y | ||
- run: cargo build --all-targets | ||
- run: cargo test | ||
|
||
build_nostd: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
- nightly | ||
- 1.59.0 # MSRV | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Important preparation step: override the latest default Rust version in GitHub CI | ||
# with the current value of the iteration in the "strategy.matrix.rust"-array. | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: default | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
# required because of "cpal" | ||
- run: sudo apt update && sudo apt install libasound2-dev -y | ||
# install some no_std target | ||
- run: rustup target add thumbv7em-none-eabihf | ||
# reset CPU=native | ||
- run: RUSTFLAGS="-C target-cpu=" cargo build --no-default-features --target thumbv7em-none-eabihf | ||
|
||
build_external_examples: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
- nightly | ||
- 1.59.0 # MSRV | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Important preparation step: override the latest default Rust version in GitHub CI | ||
# with the current value of the iteration in the "strategy.matrix.rust"-array. | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: default | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
# required because of "cpal" | ||
- run: sudo apt update && sudo apt install libasound2-dev -y | ||
- run: cd "external-examples" | ||
- run: cargo build | ||
|
||
style_checks: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Important preparation step: override the latest default Rust version in GitHub CI | ||
# with the current value of the iteration in the "strategy.matrix.rust"-array. | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: default | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
# required because of "cpal" | ||
- run: sudo apt update && sudo apt install libasound2-dev -y | ||
- name: Rustfmt (checks all source code/all features) | ||
run: cargo fmt -- --check | ||
- name: Clippy | ||
run: cargo clippy --all-targets | ||
- name: Rustdoc | ||
run: cargo doc |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,61 @@ | ||
[package] | ||
name = "beat-detector" | ||
description = """ | ||
Audio beat detection library, that supports different audio input devices as source. | ||
You can pass a callback for each found beat to the library. | ||
beat-detector is a `no_std`-compatible and alloc-free library written in Rust | ||
for detecting beats in audio. It can be used for both post- and live analysis. | ||
""" | ||
version = "0.1.2" | ||
version = "0.2.0" | ||
authors = ["Philipp Schuster <[email protected]>"] | ||
edition = "2018" | ||
edition = "2021" | ||
license = "MIT" | ||
keywords = ["audio", "beat", "beat-detection" ] | ||
categories = [ "multimedia::audio" ] | ||
keywords = ["audio", "beat", "beat-detection"] | ||
categories = ["multimedia::audio", "no-std"] | ||
readme = "README.md" | ||
homepage = "https://github.com/phip1611/beat-detector" | ||
repository = "https://github.com/phip1611/beat-detector" | ||
documentation = "https://docs.rs/beat-detector" | ||
exclude = [ | ||
".cargo", | ||
".editorconfig", | ||
".github", | ||
"check-build.sh", | ||
"demo.gif", | ||
"src/bin", # not supposed to be distributed+installable via cargo | ||
"res" | ||
] | ||
rust-version = "1.71.0" # TODO real MSRV | ||
|
||
[features] | ||
default = ["recording"] | ||
std = [] | ||
recording = ["std", "dep:cpal"] | ||
|
||
[dependencies] | ||
lowpass-filter = "0.2.4" | ||
spectrum-analyzer = "1.1.0" | ||
cpal = "0.13.3" | ||
ringbuffer = "0.7.1" | ||
# +++ NOSTD DEPENDENCIES +++ | ||
|
||
[dev-dependencies] | ||
minimp3 = "0.5.1" | ||
ctrlc = { version = "3.1.9", features = ["termination"] } # for examples | ||
ws2818-rgb-led-spi-driver = "2.0.0" # for examples | ||
rand = "0.8.3" # for examples | ||
biquad = "0.4" # lowpass filter | ||
log = { version = "0.4", default-features = false } | ||
libm = "0.2"# floating point operations | ||
ringbuffer = "0.15.0" | ||
|
||
# +++ STD DEPENDENCIES +++ | ||
cpal = { version = "0.15", optional = true } | ||
|
||
[dev-dependencies] | ||
# read .wav audio files in tests | ||
wav = "1.0" | ||
# for examples | ||
ctrlc = { version = "3.4", features = ["termination"] } | ||
|
||
# otherwise FFT and other code is too slow | ||
[profile.dev] | ||
opt-level = 1 | ||
# otherwise many code is too slow | ||
# remove when using the debugger | ||
# opt-level = 1 | ||
|
||
[profile.release] | ||
# Trimed to maximum performance. | ||
# | ||
# These changes only affects examples and tests build inside this crate but | ||
# (I think!) not libraries that include this. | ||
codegen-units = 1 | ||
lto = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
echo "checks that this builds on std+no_std + that all tests run" | ||
|
||
cargo build --all-targets # build works | ||
cargo test --all-targets # tests work | ||
# install some no_std target | ||
rustup target add thumbv7em-none-eabihf | ||
# test no_std-build | ||
RUSTFLAGS="-C target-cpu=" cargo build --no-default-features --target thumbv7em-none-eabihf | ||
|
||
cargo doc | ||
cargo fmt -- --check | ||
cargo clippy --all-targets |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.