some bullshit
This commit is contained in:
		
							parent
							
								
									5fdbb8a208
								
							
						
					
					
						commit
						1aa12fa2dc
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,2 +1,3 @@
 | 
				
			|||||||
/target
 | 
					/target
 | 
				
			||||||
.direnv
 | 
					.direnv
 | 
				
			||||||
 | 
					/src/song.ogg
 | 
				
			||||||
							
								
								
									
										905
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										905
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -6,7 +6,8 @@ edition = "2021"
 | 
				
			|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 | 
					# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
symphonia = { version = "0.5.4", features = ["ogg", "vorbis"] }
 | 
					rodio = { version = "0.17.3", features = ["vorbis"],  default-features = false }
 | 
				
			||||||
 | 
					anyhow = "*"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[profile.release]
 | 
					[profile.release]
 | 
				
			||||||
strip = true 
 | 
					strip = true 
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										14
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								flake.nix
									
									
									
									
									
								
							@ -12,13 +12,21 @@
 | 
				
			|||||||
        pkgs = import nixpkgs {
 | 
					        pkgs = import nixpkgs {
 | 
				
			||||||
          inherit system overlays;
 | 
					          inherit system overlays;
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					        native-deps = with pkgs; [
 | 
				
			||||||
 | 
					          pkg-config pipewire lld clang libclang alsa-lib
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
      in 
 | 
					      in 
 | 
				
			||||||
      with pkgs;
 | 
					      with pkgs;
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        devShells.default = mkShell {
 | 
					        devShells.default = mkShell {
 | 
				
			||||||
          buildInputs = [
 | 
					          buildInputs = with pkgs; [
 | 
				
			||||||
            rust-bin.stable.latest.default
 | 
					            (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);
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										20
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								src/main.rs
									
									
									
									
									
								
							@ -1,3 +1,19 @@
 | 
				
			|||||||
fn main() {
 | 
					use std::io::Cursor;
 | 
				
			||||||
    println!("Hello, world!");
 | 
					
 | 
				
			||||||
 | 
					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(())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user