some bullshit

This commit is contained in:
Rph :3 2024-03-30 19:04:58 +01:00
parent 5fdbb8a208
commit 1aa12fa2dc
5 changed files with 847 additions and 98 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/target
.direnv
/src/song.ogg

905
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
symphonia = { version = "0.5.4", features = ["ogg", "vorbis"] }
rodio = { version = "0.17.3", features = ["vorbis"], default-features = false }
anyhow = "*"
[profile.release]
strip = true

View File

@ -12,13 +12,21 @@
pkgs = import nixpkgs {
inherit system overlays;
};
native-deps = with pkgs; [
pkg-config pipewire lld clang libclang alsa-lib
];
in
with pkgs;
{
devShells.default = mkShell {
buildInputs = [
rust-bin.stable.latest.default
];
buildInputs = with pkgs; [
(rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
targets = ["x86_64-unknown-linux-gnu"];
})
cargo-bloat
] ++ native-deps;
LD_LIBRARY_PATH = (lib.makeLibraryPath native-deps);
};
}
);

View File

@ -1,3 +1,19 @@
fn main() {
println!("Hello, world!");
use std::io::Cursor;
use rodio::{Decoder, OutputStream, Sink};
const SONG: &[u8] = include_bytes!("song.ogg");
fn main() -> anyhow::Result<()> {
let (_stream, stream_handle) = OutputStream::try_default()?;
let sink = Sink::try_new(&stream_handle)?;
let cursor = Cursor::new(SONG);
let source = Decoder::new(cursor)?;
sink.append(source);
sink.sleep_until_end();
Ok(())
}