### Command Line Usage Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Provides examples of how to use the ww2ogg-rs command-line tool for converting .wem files to .ogg format, including options for specifying output files, codebooks, and packet formats. ```APIDOC ## Command Line Usage ### Description Examples of using the `ww2ogg` command-line tool for converting Wwise audio files (.wem) to Ogg Vorbis (.ogg) format. ### Usage Examples - **Basic conversion:** ```bash ww2ogg input.wem ``` (Auto-detects codebook, validates output) - **Specify output file:** ```bash ww2ogg input.wem -o output.ogg ``` - **Use aoTuV codebooks:** ```bash ww2ogg input.wem --pcb-aotuv ``` (For some games) - **Use custom codebook file:** ```bash ww2ogg input.wem --pcb path/to/codebooks.bin ``` - **Use inline codebooks:** ```bash ww2ogg input.wem --inline-codebooks ``` (Embedded in the .wem file) - **Force packet format:** ```bash ww2ogg input.wem --mod-packets ww2ogg input.wem --no-mod-packets ``` ``` -------------------------------- ### Advanced Configuration with Builder Pattern in Rust Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Configure the WwiseRiffVorbis converter using the builder pattern for advanced options like inline codebooks, full setup, and packet format. ```rust use ww2ogg::{WwiseRiffVorbis, CodebookLibrary, ForcePacketFormat}; 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()?; ``` -------------------------------- ### Build ww2ogg-rs from Source Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Clone the repository, navigate to the directory, and build the release version. The binary will be placed in the target/release directory. ```bash git clone https://github.com/coconutbird/ww2ogg-rs.git cd ww2ogg-rs cargo build --release ``` -------------------------------- ### Library API - Basic Usage Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Demonstrates the basic usage of the ww2ogg Rust library for converting a .wem file to .ogg format, including opening files, loading codebooks, and performing the conversion. ```APIDOC ## Library API - Basic Usage ### Description This example shows how to use the `ww2ogg` Rust library to convert a `.wem` file to `.ogg` format programmatically. ### Setup Add to your `Cargo.toml`: ```toml [dependencies] ww2ogg = { path = "ww2ogg" } ``` ### Code Example ```rust 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(()) } ``` ``` -------------------------------- ### Load Different Codebook Libraries in Rust Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Demonstrates how to load different codebook libraries, including default, aoTuV, and custom files, to resolve audio conversion issues. ```rust // Try default codebooks first (most common) let codebooks = CodebookLibrary::default_codebooks()?; // If that doesn't work, try aoTuV let codebooks = CodebookLibrary::aotuv_codebooks()?; // Or load custom codebooks from a file let codebooks = CodebookLibrary::from_file("custom_codebooks.bin")?; ``` -------------------------------- ### Library API - Codebook Selection Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Explains how to select different codebook libraries (default, aoTuV, custom) when using the ww2ogg Rust library, which is crucial for correct audio conversion. ```APIDOC ## Library API - Codebook Selection ### Description Different games may use different codebook libraries. This section details how to select the appropriate codebooks when using the `ww2ogg` Rust library to ensure correct audio conversion. If conversion produces garbled audio, try alternative codebook selections. ### Codebook Loading Methods - **Try default codebooks (most common):** ```rust let codebooks = CodebookLibrary::default_codebooks()?; ``` - **Try aoTuV codebooks:** ```rust let codebooks = CodebookLibrary::aotuv_codebooks()?; ``` - **Load custom codebooks from a file:** ```rust let codebooks = CodebookLibrary::from_file("custom_codebooks.bin")?; ``` ``` -------------------------------- ### Basic Conversion with ww2ogg CLI Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Perform a basic conversion of a .wem file to .ogg. The tool auto-detects the codebook and validates the output. ```bash ww2ogg input.wem ``` -------------------------------- ### Basic Ogg Conversion using ww2ogg Library Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Perform a basic conversion of a .wem file to .ogg using the ww2ogg library. This involves opening files, loading default codebooks, and using the converter. ```rust 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(()) } ``` -------------------------------- ### Specify Output File with ww2ogg CLI Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Convert a .wem file and specify the name for the output .ogg file. ```bash ww2ogg input.wem -o output.ogg ``` -------------------------------- ### Library API - Builder Pattern Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Illustrates the use of the builder pattern in the ww2ogg Rust library for advanced configuration of the WwiseRiffVorbis converter, allowing fine-grained control over conversion options. ```APIDOC ## Library API - Builder Pattern ### Description For advanced configuration scenarios, the `ww2ogg` library provides a builder pattern to construct the `WwiseRiffVorbis` converter with specific options. ### Code Example ```rust use ww2ogg::{WwiseRiffVorbis, CodebookLibrary, ForcePacketFormat}; 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()?; ``` ### Builder Options - **`inline_codebooks(bool)`**: Controls whether to use inline codebooks. - **`full_setup(bool)`**: Configures the full setup options. - **`force_packet_format(ForcePacketFormat)`**: Specifies the packet format to force (e.g., `ForcePacketFormat::NoForce`, `ForcePacketFormat::ModPackets`). ``` -------------------------------- ### Library API - Validation Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Shows how to use the `validate` function from the ww2ogg Rust library to verify the integrity and correctness of the converted Ogg Vorbis audio data. ```APIDOC ## Library API - Validation ### Description This function allows you to verify that the converted Ogg Vorbis audio data is valid and not corrupted. It's recommended to use this after conversion to ensure data integrity. ### Usage ```rust use ww2ogg::validate; let ogg_data: Vec = /* converted audio data */; validate(&ogg_data)?; // Returns an error if the audio data is corrupted. ``` ``` -------------------------------- ### Use Custom Codebook File with ww2ogg CLI Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Convert a .wem file using a custom codebook file specified by its path. ```bash ww2ogg input.wem --pcb path/to/codebooks.bin ``` -------------------------------- ### Use aoTuV Codebooks with ww2ogg CLI Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Convert a .wem file using the aoTuV codebooks, which are necessary for some games. ```bash ww2ogg input.wem --pcb-aotuv ``` -------------------------------- ### Add ww2ogg Dependency to Cargo.toml Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Include the ww2ogg library as a dependency in your project's Cargo.toml file by specifying its path. ```toml [dependencies] ww2ogg = { path = "ww2ogg" } ``` -------------------------------- ### Force Packet Format with ww2ogg CLI Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Control the packet format during conversion. Use '--mod-packets' or '--no-mod-packets' as needed. ```bash ww2ogg input.wem --mod-packets ``` ```bash ww2ogg input.wem --no-mod-packets ``` -------------------------------- ### Use Inline Codebooks with ww2ogg CLI Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Convert a .wem file when the codebooks are embedded directly within the .wem file. ```bash ww2ogg input.wem --inline-codebooks ``` -------------------------------- ### Validate Converted Ogg Audio Data in Rust Source: https://github.com/coconutbird/ww2ogg-rs/blob/main/README.md Use the `validate` function from the ww2ogg library to check if the converted Ogg audio data is corrupted. It returns an error if the data is invalid. ```rust use ww2ogg::validate; let ogg_data: Vec = /* converted audio */; validate(&ogg_data)?; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.