1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use super::Source as Audio;
use amethyst_assets::*;
pub struct AudioData(pub Vec<u8>);
#[derive(Clone)]
pub struct WavFormat;
impl SimpleFormat<Audio> for WavFormat {
const NAME: &'static str = "WAV";
type Options = ();
fn import(&self, bytes: Vec<u8>, _: ()) -> Result<AudioData> {
Ok(AudioData(bytes))
}
}
#[derive(Clone)]
pub struct OggFormat;
impl SimpleFormat<Audio> for OggFormat {
const NAME: &'static str = "OGG";
type Options = ();
fn import(&self, bytes: Vec<u8>, _: ()) -> Result<AudioData> {
Ok(AudioData(bytes))
}
}
#[derive(Clone)]
pub struct FlacFormat;
impl SimpleFormat<Audio> for FlacFormat {
const NAME: &'static str = "FLAC";
type Options = ();
fn import(&self, bytes: Vec<u8>, _: ()) -> Result<AudioData> {
Ok(AudioData(bytes))
}
}