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
#![allow(dead_code)]
use std::io;
use std::io::Read;
use crate::binary_reader::BinaryReader;
#[non_exhaustive]
pub struct SoundFontVersion {
pub(crate) major: i16,
pub(crate) minor: i16,
}
impl SoundFontVersion {
pub(crate) fn default() -> Self {
Self { major: 0, minor: 0 }
}
pub(crate) fn new<R: Read>(reader: &mut R) -> Result<Self, io::Error> {
let major = BinaryReader::read_i16(reader)?;
let minor = BinaryReader::read_i16(reader)?;
Ok(Self {
major: major,
minor: minor,
})
}
pub fn get_major(&self) -> i32 {
self.major as i32
}
pub fn get_minor(&self) -> i32 {
self.minor as i32
}
}