music; load palettes
This commit is contained in:
18
src/music.rs
Normal file
18
src/music.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// an XM music file.
|
||||
/// name is derived from the file stem.
|
||||
pub struct Music {
|
||||
pub name: String,
|
||||
pub bytes: Vec<u8>,
|
||||
}
|
||||
|
||||
impl Music {
|
||||
pub fn from_file(path: PathBuf) -> Self {
|
||||
Self {
|
||||
name: path.file_stem().unwrap().to_str().unwrap().into(),
|
||||
bytes: fs::read(path).unwrap()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user