Add to_file() to VocFile
This commit is contained in:
parent
d6f620dfd8
commit
33484bfa97
11
src/voc.rs
11
src/voc.rs
|
|
@ -1,6 +1,6 @@
|
|||
use std::fmt;
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Seek, SeekFrom};
|
||||
use std::io::{Read, Seek, SeekFrom, Write};
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum Codec {
|
||||
|
|
@ -33,8 +33,7 @@ pub struct VocFile {
|
|||
}
|
||||
|
||||
impl VocFile {
|
||||
pub(crate) fn from_file(file_name: &str) -> Self {
|
||||
println!("Parsing {} ...", file_name);
|
||||
pub fn from_file(file_name: &str) -> Self {
|
||||
let mut fp = File::open(file_name).unwrap();
|
||||
|
||||
// Signature - Creative Voice File
|
||||
|
|
@ -184,6 +183,12 @@ impl VocFile {
|
|||
|
||||
result
|
||||
}
|
||||
|
||||
pub fn to_file(&self, filename: &str) {
|
||||
let mut fp = File::create(filename).unwrap();
|
||||
drop(fp.write(&self.to_bytes()));
|
||||
drop(fp.flush());
|
||||
}
|
||||
}
|
||||
|
||||
type BlockT = Box<dyn Block>;
|
||||
|
|
|
|||
Loading…
Reference in New Issue