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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! # fsbex
//!
//! `fsbex` is a library for extracting audio from FMOD sound banks. Only FSB version 5 is supported for now.
//!
//! ## Example
//!
//! Parsing a sound bank, then writing streams to files:
//!
//! ```no_run
//! use fsbex::{Bank, AudioFormat};
//! use std::{
//! error::Error,
//! io::{BufReader, BufWriter},
//! fs::File,
//! };
//!
//! fn main() -> Result<(), Box<dyn Error>> {
//! // open file for reading sound bank
//! let file = BufReader::new(File::open("example.fsb")?);
//! let bank = Bank::new(file)?;
//!
//! // report number of streams contained within the sound bank
//! println!("{} streams within this sound bank", bank.num_streams());
//!
//! // check stream audio format
//! if bank.format() != AudioFormat::Vorbis {
//! return Err("expected Vorbis format".into());
//! }
//!
//! // iterate over streams
//! for (index, stream) in bank.into_iter().enumerate() {
//! // check stream name
//! let file_name = if let Some(name) = stream.name() {
//! format!("{name}.ogg")
//! } else {
//! format!("stream_{index}.ogg")
//! };
//!
//! // write stream data to file
//! let output_file = BufWriter::new(File::create(file_name)?);
//! stream.write(output_file)?;
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Supported formats
//!
//! `fsbex` supports encoding stream data for the following formats:
//! - PCM (8, 16, 24, 32-bit integer)
//! - PCM (32-bit float)
//! - Vorbis
pub use ;
pub use ;
pub use ;