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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use super::Source as Audio;
use amethyst_assets::*;
#[derive(Clone)]
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))
}
}
#[derive(Clone)]
pub struct Mp3Format;
impl SimpleFormat<Audio> for Mp3Format {
const NAME: &'static str = "MP3";
type Options = ();
fn import(&self, bytes: Vec<u8>, _: ()) -> Result<AudioData> {
Ok(AudioData(bytes))
}
}