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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//! # ww2ogg
//!
//! Convert Wwise RIFF/RIFX Vorbis audio files (.wem) to standard Ogg Vorbis format.
//!
//! This is a Rust port of ww2ogg, which converts Wwise audio containers back to
//! standard Ogg Vorbis streams by rebuilding the Vorbis headers and converting
//! the audio packets.
//!
//! ## Overview
//!
//! Wwise (by Audiokinetic) is a popular audio middleware used in games. It stores
//! audio in a modified Vorbis format that strips the standard headers and references
//! external codebook libraries. This crate converts these files back to standard
//! Ogg Vorbis that can be played by any audio player.
//!
//! ## Quick Start
//!
//! ```no_run
//! use std::fs::File;
//! use std::io::{BufReader, BufWriter};
//! use ww2ogg::{WwiseRiffVorbis, CodebookLibrary};
//!
//! fn main() -> Result<(), ww2ogg::WemError> {
//! // Open input .wem file
//! let input = BufReader::new(File::open("input.wem")?);
//!
//! // Load the default codebook library
//! let codebooks = CodebookLibrary::default_codebooks()?;
//!
//! // Create converter and parse the input
//! let mut converter = WwiseRiffVorbis::new(input, codebooks)?;
//!
//! // Convert to Ogg Vorbis
//! let mut output = BufWriter::new(File::create("output.ogg")?);
//! converter.generate_ogg(&mut output)?;
//!
//! Ok(())
//! }
//! ```
//!
//! ## Codebook Libraries
//!
//! Wwise audio files reference external codebook libraries. Two are provided:
//!
//! - [`CodebookLibrary::default_codebooks()`] - Standard codebooks (try this first)
//! - [`CodebookLibrary::aotuv_codebooks()`] - aoTuV 6.03 codebooks (for some games)
//!
//! If conversion produces garbled audio, try the other codebook library.
//!
//! ## Validation
//!
//! Use [`validate()`] to verify the converted audio is valid:
//!
//! ```no_run
//! use ww2ogg::validate;
//!
//! fn check_output(ogg_data: &[u8]) -> Result<(), ww2ogg::WemError> {
//! validate(ogg_data)?;
//! println!("Audio is valid!");
//! Ok(())
//! }
//! ```
//!
//! ## Builder Pattern
//!
//! For advanced configuration, use the builder pattern:
//!
//! ```no_run
//! use std::fs::File;
//! use ww2ogg::{WwiseRiffVorbis, CodebookLibrary, ForcePacketFormat};
//!
//! # fn main() -> Result<(), ww2ogg::WemError> {
//! let input = File::open("input.wem")?;
//! let codebooks = CodebookLibrary::aotuv_codebooks()?;
//!
//! let mut converter = WwiseRiffVorbis::builder(input, codebooks)
//! .inline_codebooks(false)
//! .full_setup(false)
//! .force_packet_format(ForcePacketFormat::NoForce)
//! .build()?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Error Handling
//!
//! All operations return [`WemResult<T>`], which is an alias for `Result<T, WemError>`.
//! Common errors include:
//!
//! - [`WemError::Parse`] - Invalid or corrupted input file
//! - [`WemError::SizeMismatch`] - Wrong codebook library (try the other one)
//! - [`WemError::InvalidCodebookId`] - Try `--inline-codebooks` option
//! - [`WemError::Codebook`] - Validation failed, likely wrong codebook
pub use CodebookLibrary;
pub use ;
pub use validate;
pub use ;