### Write audio data to a wave file Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveWriter.html Example showing how to initialize a WaveWriter with a cursor and write audio frames to it. ```rust use bwavfile::{WaveWriter,WaveFmt}; // Write a three-sample wave file to a cursor let mut cursor = Cursor::new(vec![0u8;0]); let format = WaveFmt::new_pcm_mono(48000, 24); let w = WaveWriter::new(&mut cursor, format).unwrap(); let mut frame_writer = w.audio_frame_writer().unwrap(); frame_writer.write_frames(&[0i32]).unwrap(); frame_writer.write_frames(&[0i32]).unwrap(); frame_writer.write_frames(&[0i32]).unwrap(); frame_writer.end().unwrap(); ``` -------------------------------- ### Get Common Audio Format Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveFmt.html Determines the format or codec of the file's audio data by unifying the format tag and format extension GUID. ```rust pub fn common_format(&self) -> CommonFormat ``` -------------------------------- ### WaveReader::new Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Wraps a `Read` struct in a new `WaveReader`. This is the primary entry point into the `WaveReader` interface. The stream passed as `inner` must be at the beginning of the header of the WAVE data. For a .wav file, this means it must be at the start of the file. This function does a minimal validation on the provided stream and will return an `Err(errors::Error)` immediately if there is a structural inconsistency that makes the stream unreadable or if it’s missing essential components that make interpreting the audio data impossible. ```APIDOC ## POST /api/users ### Description Creates a new user in the system. ### Method POST ### Endpoint /api/users ### Parameters #### Request Body - **username** (string) - Required - The desired username for the new user. - **email** (string) - Required - The email address of the new user. - **password** (string) - Required - The password for the new user. ### Request Example ```json { "username": "johndoe", "email": "john.doe@example.com", "password": "securepassword123" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the newly created user. - **username** (string) - The username of the created user. - **email** (string) - The email address of the created user. #### Response Example ```json { "id": "user-12345", "username": "johndoe", "email": "john.doe@example.com" } ``` ``` -------------------------------- ### Get Internal Value of I24 Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Returns the internal i32 representation of the I24 sample. ```rust pub fn inner(self) -> i32 ``` -------------------------------- ### Struct WaveFmtExtended Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveFmtExtended.html Represents the extended wave format, including details about sample bits, channel mask, and codec GUID. ```APIDOC ## Struct WaveFmtExtended ### Description Extended Wave Format ### Fields - **valid_bits_per_sample** (u16) - Valid bits per sample. - **channel_mask** (u32) - Channel mask. Identifies the speaker assignment for each channel in the file. - **type_guid** (Uuid) - Codec GUID. Identifies the codec of the audio stream. ### Request Example ```json { "valid_bits_per_sample": 16, "channel_mask": 3, "type_guid": "00000000-0000-0000-0000-000000000000" } ``` ### Response Example ```json { "valid_bits_per_sample": 16, "channel_mask": 3, "type_guid": "00000000-0000-0000-0000-000000000000" } ``` ``` -------------------------------- ### Get Valid Bits Per Sample Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveFmt.html Returns the number of bits stored in the file per sample. For Broadcast-Wave files, this is typically a multiple of 8. ```rust pub fn valid_bits_per_sample(&self) -> u16 ``` -------------------------------- ### Initialize WaveReader with error handling Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Shows how to wrap a file in a WaveReader and handle potential parsing errors. ```rust use std::fs::File; use std::io::{Error,ErrorKind}; use bwavfile::{WaveReader, Error as WavError}; let f = File::open("tests/media/error.wav").unwrap(); let reader = WaveReader::new(f); match reader { Ok(_) => panic!("error.wav should not be openable"), Err( WavError::IOError( e ) ) => { assert_eq!(e.kind(), ErrorKind::UnexpectedEof) } Err(e) => panic!("Unexpected error was returned {:?}", e) } ``` -------------------------------- ### Type Information Methods Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Methods related to type information, such as getting the TypeId. ```APIDOC ## type_id(&self) -> TypeId ### Description Gets the `TypeId` of `self`. ### Method `type_id` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (TypeId) - **TypeId** - The unique identifier for the type of `self`. #### Response Example `TypeId::of::()` ``` -------------------------------- ### WaveWriter Initialization Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveWriter.html Methods for initializing a new WaveWriter instance, either by creating a new file on disk or wrapping an existing writer. ```APIDOC ## WaveWriter::create ### Description Creates a new Wave file at the specified path. ### Parameters - **path** (AsRef) - Required - The file system path where the wave file will be created. - **format** (WaveFmt) - Required - The audio format configuration. ## WaveWriter::create_unbuffered ### Description Creates a new Wave file at the specified path using unbuffered IO. ### Parameters - **path** (AsRef) - Required - The file system path. - **format** (WaveFmt) - Required - The audio format configuration. ## WaveWriter::new ### Description Wraps an existing writer that implements Write and Seek traits into a Wave writer. ### Parameters - **inner** (W) - Required - The writer instance. - **format** (WaveFmt) - Required - The audio format configuration. ``` -------------------------------- ### Get Type ID Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.AudioFrameWriter.html Retrieves the TypeId of the current instance. This is part of the Any trait implementation. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### WaveFmt Methods Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveFmt.html Provides methods for creating and querying WAV audio format details, including creating PCM formats for mono, stereo, ambisonic, and multichannel audio, as well as determining the common format and creating frame buffers. ```APIDOC ## impl WaveFmt ### Methods #### pub fn valid_bits_per_sample(&self) -> u16 Returns the number of valid bits per sample. #### pub fn new_pcm_mono(sample_rate: u32, bits_per_sample: u16) -> Self Create a new integer PCM format for a monoaural audio stream. #### pub fn new_pcm_stereo(sample_rate: u32, bits_per_sample: u16) -> Self Create a new integer PCM format for a standard Left-Right stereo audio stream. #### pub fn new_pcm_ambisonic( sample_rate: u32, bits_per_sample: u16, channel_count: u16, ) -> Self Create a new integer PCM format for ambisonic b-format. #### pub fn new_pcm_multichannel( sample_rate: u32, bits_per_sample: u16, channel_bitmap: u32, ) -> Self Create a new integer PCM format WaveFmt with a custom channel bitmap. The order of channels is not important. When reading or writing audio frames you must use the standard multichannel order for Wave files, the numerical order of the cases of ChannelMask. #### pub fn common_format(&self) -> CommonFormat Format or codec of the file’s audio data. The CommonFormat unifies the format tag and the format extension GUID. Use this method to determine the codec. #### pub fn create_frame_buffer(&self, length: usize) -> Vec Create a frame buffer sized to hold `length` frames for a reader or writer. This is a convenience method that creates a `Vec` with as many elements as there are channels in the underlying stream. ``` -------------------------------- ### Writing Metadata and Audio Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveWriter.html Methods for writing various metadata chunks and initializing the audio data stream. ```APIDOC ## WaveWriter::write_broadcast_metadata ### Description Writes Broadcast-Wave metadata (Bext) to the file. ### Parameters - **bext** (&Bext) - Required - The broadcast metadata structure. ## WaveWriter::write_ixml ### Description Writes iXML metadata to the file. ### Parameters - **ixml** (&[u8]) - Required - The iXML data as a byte slice. ## WaveWriter::write_axml ### Description Writes axml/ADM metadata to the file. ### Parameters - **axml** (&[u8]) - Required - The axml data as a byte slice. ## WaveWriter::audio_frame_writer ### Description Creates an audio frame writer, consuming the WaveWriter to begin writing audio data chunks. ``` -------------------------------- ### Sample Conversion (FromSample) Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.AudioFrameWriter.html Converts a sample from one type to another. This is the implementation for the FromSample for S trait. ```rust fn from_sample_(s: S) -> S ``` -------------------------------- ### Read Cue Points from WAV File Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Opens a WAV file and reads its cue points. Asserts the number of cue points and details of the first three. ```rust use bwavfile::WaveReader; use bwavfile::Cue; let mut f = WaveReader::open("tests/media/izotope_test.wav").unwrap(); let cue_points = f.cue_points().unwrap(); assert_eq!(cue_points.len(), 3); assert_eq!(cue_points[0].frame, 12532); assert_eq!(cue_points[0].length, None); assert_eq!(cue_points[0].label, Some(String::from("Marker 1"))); assert_eq!(cue_points[0].note, Some(String::from("Marker 1 Comment"))); assert_eq!(cue_points[1].frame, 20997); assert_eq!(cue_points[1].length, None); assert_eq!(cue_points[1].label, Some(String::from("Marker 2"))); assert_eq!(cue_points[1].note, Some(String::from("Marker 2 Comment"))); assert_eq!(cue_points[2].frame, 26711); assert_eq!(cue_points[2].length, Some(6465)); assert_eq!(cue_points[2].label, Some(String::from("Timed Region"))); assert_eq!(cue_points[2].note, Some(String::from("Region Comment"))); ``` -------------------------------- ### Read audio frames from a file Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Demonstrates opening a file, retrieving format information, and reading audio frames into a buffer. ```rust use bwavfile::WaveReader; let mut r = WaveReader::open("tests/media/ff_silence.wav").unwrap(); let format = r.format().unwrap(); assert_eq!(format.sample_rate, 44100); assert_eq!(format.channel_count, 1); let mut frame_reader = r.audio_frame_reader().unwrap(); let mut buffer = format.create_frame_buffer::(1); let read = frame_reader.read_frames(&mut buffer).unwrap(); assert_eq!(buffer, [0i32]); assert_eq!(read, 1); ``` -------------------------------- ### Sample Conversion Traits Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveWriter.html Documentation for custom sample conversion traits used for audio data processing. ```APIDOC ## Sample Conversion Traits ### FromSample - **fn from_sample_(s: S) -> S**: Converts a sample type. ### ToSample - **fn to_sample_(self) -> U**: Converts the current type to a target sample type. ### Duplex - **Constraint**: Requires `T: FromSample + ToSample`. ``` -------------------------------- ### Create Multichannel PCM WaveFmt with Bitmap Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveFmt.html Creates a new integer PCM format WaveFmt with a custom channel bitmap. The order of channels is not important for creation, but standard multichannel order must be used for reading/writing frames. ```rust pub fn new_pcm_multichannel( sample_rate: u32, bits_per_sample: u16, channel_bitmap: u32, ) -> Self ``` -------------------------------- ### WaveReader::open Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Opens a file at the given path and creates a new `WaveReader` instance. This is a convenience function that handles file opening and buffering. ```APIDOC ## GET /api/users/{id} ### Description Retrieves the details of a specific user by their ID. ### Method GET ### Endpoint /api/users/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the user to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the user. - **username** (string) - The username of the user. - **email** (string) - The email address of the user. #### Response Example ```json { "id": "user-12345", "username": "johndoe", "email": "john.doe@example.com" } ``` ``` -------------------------------- ### AudioFrameReader Methods Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.AudioFrameReader.html Methods for initializing, reading, and navigating audio frames within the AudioFrameReader. ```APIDOC ## new(inner, format, start, length) ### Description Creates a new AudioFrameReader instance. Performs sanity checks on the format parameter, specifically requiring block_alignment and format tag 0x01. ### Parameters - **inner** (R: Read + Seek) - Required - The underlying reader. - **format** (WaveFmt) - Required - The audio format specification. - **start** (u64) - Required - Start position in the stream. - **length** (u64) - Required - Length of the audio data. ## into_inner() ### Description Unwraps the AudioFrameReader to return the inner reader. ## locate(to) ### Description Seeks to a different frame position within the audio stream. ### Parameters - **to** (u64) - Required - The target frame position. ### Response - **u64** - The new read position. ## read_frames(buffer) ### Description Reads frames from the file into the provided buffer, performing sample type conversion if necessary. ### Parameters - **buffer** (&mut [S]) - Required - The buffer to store read frames. ### Response - **u64** - The number of frames successfully read. ``` -------------------------------- ### validate_prepared_for_append Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Verifies if audio data can be appended. ```APIDOC ## validate_prepared_for_append ### Description Verifies that the file is readable, has sufficient space for a ds64 chunk, and that data is the final chunk. ``` -------------------------------- ### BWAVFile Core Methods Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveFmt.html Methods for managing raw byte buffers and frame data conversion. ```APIDOC ## create_raw_buffer ### Description Create a raw byte buffer to hold a specified number of blocks from a reader or writer. ### Parameters - **length** (usize) - Required - The number of blocks to hold in the buffer. ### Response - **Vec** - A vector containing the raw byte buffer. ## unpack_frames ### Description Read bytes into frames. ### Parameters - **from_bytes** (&[u8]) - Required - The source byte slice. - **into_frames** (&mut [i32]) - Required - The destination frame slice. ## channels ### Description Retrieve channel descriptors for each channel. ### Response - **Vec** - A list of channel descriptors. ``` -------------------------------- ### Sample Conversion (ToSample) Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.AudioFrameWriter.html Converts a sample to another type. This is the implementation for the ToSample for T trait. ```rust fn to_sample_(self) -> U ``` -------------------------------- ### Create Stereo PCM WaveFmt Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveFmt.html Creates a new integer PCM format for a standard Left-Right stereo audio stream. Requires sample rate and bits per sample. ```rust pub fn new_pcm_stereo(sample_rate: u32, bits_per_sample: u16) -> Self ``` -------------------------------- ### Create Ambisonic PCM WaveFmt Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveFmt.html Creates a new integer PCM format for ambisonic b-format. Requires sample rate, bits per sample, and channel count. ```rust pub fn new_pcm_ambisonic( sample_rate: u32, bits_per_sample: u16, channel_count: u16, ) -> Self ``` -------------------------------- ### Clone an I24 sample Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Creates a duplicate of an I24 sample. ```rust fn clone(&self) -> I24 ``` -------------------------------- ### Clone from another I24 sample Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Copies the value from a source I24 sample into the current one. ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Create Mono PCM WaveFmt Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveFmt.html Creates a new integer PCM format for a monoaural audio stream. Requires sample rate and bits per sample. ```rust pub fn new_pcm_mono(sample_rate: u32, bits_per_sample: u16) -> Self ``` -------------------------------- ### WaveReader::format Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Returns the sample and frame format of this wave file. ```APIDOC ## POST /api/orders ### Description Creates a new order. ### Method POST ### Endpoint /api/orders ### Parameters #### Request Body - **userId** (string) - Required - The ID of the user placing the order. - **items** (array) - Required - A list of items to include in the order. - **itemId** (string) - Required - The ID of the item. - **quantity** (integer) - Required - The quantity of the item. ### Request Example ```json { "userId": "user-12345", "items": [ { "itemId": "item-abc", "quantity": 2 }, { "itemId": "item-def", "quantity": 1 } ] } ``` ### Response #### Success Response (200) - **orderId** (string) - The unique identifier for the newly created order. - **status** (string) - The current status of the order (e.g., "pending", "processing", "shipped"). #### Response Example ```json { "orderId": "order-98765", "status": "pending" } ``` ``` -------------------------------- ### Metadata Structures Source: https://docs.rs/bwavfile/2.0.1/bwavfile/index.html The crate includes structures for handling various metadata formats commonly found in WAV files, such as Broadcast-WAV (BEXT) and ADM Audio ID. ```APIDOC ## Struct ADMAudioID ADM Audio ID record. ## Struct Bext Broadcast-WAV metadata record. ## Struct Cue A cue point recorded in the `cue` and `adtl` metadata. ``` -------------------------------- ### WaveReader::audio_frame_reader Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Creates an `AudioFrameReader` for reading each audio frame and consumes the `WaveReader`. ```APIDOC ## GET /api/files/{fileId}/download ### Description Initiates the download of a file. ### Method GET ### Endpoint /api/files/{fileId}/download ### Parameters #### Path Parameters - **fileId** (string) - Required - The unique identifier of the file to download. ### Response #### Success Response (200) - **downloadUrl** (string) - A URL from which the file can be downloaded. #### Response Example ```json { "downloadUrl": "https://example.com/downloads/file123.zip" } ``` ``` -------------------------------- ### Bwavfile Crate Overview Source: https://docs.rs/bwavfile/2.0.1/bwavfile/index.html The bwavfile crate provides functionality to read and write WAV files, including Broadcast-WAV, MBWF, and RF64 formats. It is designed to support a wide range of professional audio, motion picture production, broadcast, and music production use cases. ```APIDOC ## Crate bwavfile Rust Wave File Reader/Writer with Broadcast-WAV, MBWF and RF64 Support This package aims to support read and writing any kind of WAV file you are likely to encounter in a professional audio, motion picture production, broadcast, or music production. ### Key Components: * **Structs**: `WaveReader`, `WaveWriter`, `Bext`, `ADMAudioID`, `AudioFrameReader`, `AudioFrameWriter`, `ChannelDescriptor`, `Cue`, `I24`, `WaveFmt`, `WaveFmtExtended`. * **Enums**: `ChannelMask`, `CommonFormat`, `Error`. * **Constants**: Various `WAVE_TAG_` and `WAVE_UUID_` constants for format identification. * **Traits**: `ReadWavAudioData`, `Sample`. ``` -------------------------------- ### Construct I24 with Range Check Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Creates a new I24 sample, returning None if the provided i32 value is out of the valid range for a 24-bit signed integer. ```rust pub fn new(val: i32) -> Option ``` -------------------------------- ### collect_from Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.Cue.html Parses cue and adtl chunks to extract a list of Cue objects. ```APIDOC ## collect_from ### Description Parses the provided cue and adtl chunks to return a collection of Cue objects. ### Method Static Function ### Parameters #### Arguments - **cue_chunk** (&[u8]) - Required - The raw byte data from the cue chunk. - **adtl_chunk** (Option<&[u8]>) - Optional - The raw byte data from the adtl chunk. ### Response - **Result, Error>** - A vector of parsed Cue objects or an error if parsing fails. ``` -------------------------------- ### AudioFrameWriter Methods Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.AudioFrameWriter.html Methods for writing audio frames and finalizing the audio data stream. ```APIDOC ## write_frames(buffer: &[S]) ### Description Writes interleaved samples from the provided buffer into the audio file. The writer automatically converts the buffer's sample type to the file's internal sample type. ### Parameters - **buffer** (&[S]) - Required - A slice of samples to be written to the file. ### Response - **Result<(), Error>** - Returns Ok(()) on success, or an Error if the write operation fails. --- ## end() ### Description Finalizes the audio data chunk and finishes the writing process. This method must be called to ensure the file is correctly closed and the data is flushed. ### Response - **Result, Error>** - Returns the original WaveWriter instance on success, or an Error if finalization fails. ``` -------------------------------- ### Borrowing Method for I24 Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Provides immutable borrowing functionality. ```APIDOC ## borrow(&self) -> &T ### Description Immutably borrows from an owned value. ### Method `borrow` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (&T) - **&T** - An immutable reference to the borrowed value. #### Response Example `&self` ``` -------------------------------- ### From and Into Trait Implementations Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Handles conversions between types using From and Into traits. ```APIDOC ## impl From for T ### Description Returns the argument unchanged. ### Method `from` ### Endpoint N/A (Trait implementation) ### Parameters - **t** (T) - Required - The value to convert. ### Request Body None ### Response #### Success Response (200) - **T** (T) - The unchanged input value. ### Response Example N/A (Trait method) ## impl FromSample for S ### Description Converts a sample into itself. ### Method `from_sample_` ### Endpoint N/A (Trait implementation) ### Parameters - **s** (S) - Required - The sample value. ### Request Body None ### Response #### Success Response (200) - **S** (S) - The converted sample value. ### Response Example N/A (Trait method) ## impl Into for T ### Description Calls `U::from(self)`. This conversion is whatever the implementation of `From for U` chooses to do. ### Method `into` ### Endpoint N/A (Trait implementation) ### Parameters None ### Request Body None ### Response #### Success Response (200) - **U** (U) - The converted value. ### Response Example N/A (Trait method) ``` -------------------------------- ### Standard Conversion Traits Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveWriter.html Documentation for standard Rust conversion traits implemented for types within the project. ```APIDOC ## Trait Implementations ### From - **fn from(t: T) -> T**: Returns the argument unchanged. ### Into - **fn into(self) -> U**: Calls `U::from(self)`. ### TryFrom - **type Error**: Infallible - **fn try_from(value: U) -> Result>::Error>**: Performs the conversion. ### TryInto - **type Error**: >::Error - **fn try_into(self) -> Result>::Error>**: Performs the conversion. ``` -------------------------------- ### Format Structures Source: https://docs.rs/bwavfile/2.0.1/bwavfile/index.html Structures for defining and describing the format of WAV files, including standard formats and extended formats. ```APIDOC ## Struct WaveFmt WAV file data format record. ## Struct WaveFmtExtended Extended Wave Format ``` -------------------------------- ### WaveReader::open_unbuffered Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Opens a file for reading with unbuffered I/O. A convenience that opens `path` and calls `Self::new()`. ```APIDOC ## PUT /api/users/{id} ### Description Updates an existing user's information. ### Method PUT ### Endpoint /api/users/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the user to update. #### Request Body - **email** (string) - Optional - The new email address for the user. - **password** (string) - Optional - The new password for the user. ### Request Example ```json { "email": "john.doe.updated@example.com" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the updated user. - **username** (string) - The username of the updated user. - **email** (string) - The updated email address of the user. #### Response Example ```json { "id": "user-12345", "username": "johndoe", "email": "john.doe.updated@example.com" } ``` ``` -------------------------------- ### cue_points Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Reads cue points from the WAVE file. ```APIDOC ## cue_points ### Description Reads cue points from the WAVE file and returns a vector of Cue objects. ### Response - **Result, ParserError>>** - A list of cue points found in the file. ``` -------------------------------- ### Format I24 for Debugging Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Formats the I24 sample for debugging output. This implementation is part of the Debug trait. ```rust fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> ``` -------------------------------- ### Convert I20 to I24 Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Converts an I20 sample into an I24 sample. This is part of the From trait implementation. ```rust fn from(other: I20) -> I24 ``` -------------------------------- ### Trait: Sample Source: https://docs.rs/bwavfile/2.0.1/bwavfile/trait.Sample.html The Sample trait acts as a marker trait for types that implement Duplex for various audio sample formats. ```APIDOC ## Trait: Sample ### Description A trait representing valid audio sample types. It requires the implementation of the Duplex trait for u8, i16, I24, i32, and f32. ### Definition ```rust pub trait Sample: Sample + Duplex + Duplex + Duplex + Duplex + Duplex { } ``` ### Compatibility - **Dyn Compatibility**: This trait is not dyn compatible (not object safe). ### Implementations - **f32** - **i16** - **i32** - **u8** - **I24** ``` -------------------------------- ### ToSample Trait Implementation Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Converts a value into a sample type. ```APIDOC ## impl ToSample for T ### Description Converts a value into a sample type. ### Method `to_sample_` ### Endpoint N/A (Trait implementation) ### Parameters None ### Request Body None ### Response #### Success Response (200) - **U** (U) - The converted sample value. ### Response Example N/A (Trait method) ``` -------------------------------- ### Equality and Inequality for I24 Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Methods for testing equality and inequality between I24 values. ```APIDOC ## eq(&self, other: &I24) -> bool ### Description Tests for `self` and `other` values to be equal, and is used by `==`. ### Method `eq` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - **bool** - `true` if the values are equal, `false` otherwise. #### Response Example `true` ``` ```APIDOC ## ne(&self, other: &Rhs) -> bool ### Description Tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. ### Method `ne` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - **bool** - `true` if the values are not equal, `false` otherwise. #### Response Example `false` ``` -------------------------------- ### WAVE_UUID_MPEG Constant Source: https://docs.rs/bwavfile/2.0.1/bwavfile/constant.WAVE_UUID_MPEG.html Documentation for the WAVE_UUID_MPEG constant used in the bwavfile crate. ```APIDOC ## Constant WAVE_UUID_MPEG ### Description Extended format UUID for MPEG1 data. ### Definition `pub const WAVE_UUID_MPEG: Uuid;` ``` -------------------------------- ### Convert i8 to I24 via FromSample Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Converts an i8 integer into an I24 sample using the FromSample trait. ```rust fn from_sample_(s: i8) -> I24 ``` -------------------------------- ### WAVE_TAG_PCM Constant Source: https://docs.rs/bwavfile/2.0.1/bwavfile/constant.WAVE_TAG_PCM.html Documentation for the WAVE_TAG_PCM constant used to identify integer LPCM audio formats. ```APIDOC ## WAVE_TAG_PCM ### Description Format tag for integer LPCM. ### Constant Value `0x0001` (u16) ``` -------------------------------- ### Convert i32 to I24 via FromSample Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Converts an i32 integer into an I24 sample using the FromSample trait. ```rust fn from_sample_(s: i32) -> I24 ``` -------------------------------- ### Sample Related Methods for I24 Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Methods related to sample processing, including conversions and amplitude adjustments. ```APIDOC ## to_sample(self) -> S ### Description Convert `self` to any type that implements `FromSample`. ### Method `to_sample` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (S) - **S** - The converted sample in the target type `S`. #### Response Example `SampleType::from(5)` ``` ```APIDOC ## from_sample(s: S) -> Self ### Description Create a `Self` from any type that implements `ToSample`. ### Method `from_sample` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Self) - **Self** (I24) - The created I24 value from the input sample. #### Response Example `I24::from_sample(5.0)` ``` ```APIDOC ## to_signed_sample(self) -> Self::Signed ### Description Converts `self` to the equivalent `Sample` in the associated `Signed` format. ### Method `to_signed_sample` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Self::Signed) - **Self::Signed** (I24) - The signed sample representation. #### Response Example `signed_value` ``` ```APIDOC ## to_float_sample(self) -> Self::Float ### Description Converts `self` to the equivalent `Sample` in the associated `Float` format. ### Method `to_float_sample` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Self::Float) - **Self::Float** (f32) - The floating-point sample representation. #### Response Example `float_value` ``` ```APIDOC ## add_amp(self, amp: Self::Signed) -> Self ### Description Adds (or “offsets”) the amplitude of the `Sample` by the given signed amplitude. ### Method `add_amp` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Self) - **Self** (I24) - The sample with adjusted amplitude. #### Response Example `adjusted_value` ``` ```APIDOC ## mul_amp(self, amp: Self::Float) -> Self ### Description Multiplies (or “scales”) the amplitude of the `Sample` by the given float amplitude. ### Method `mul_amp` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Self) - **Self** (I24) - The sample with scaled amplitude. #### Response Example `scaled_value` ``` -------------------------------- ### Convert i16 to I24 via FromSample Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Converts an i16 integer into an I24 sample using the FromSample trait. ```rust fn from_sample_(s: i16) -> I24 ``` -------------------------------- ### WAVE_TAG_MPEG Constant Source: https://docs.rs/bwavfile/2.0.1/bwavfile/constant.WAVE_TAG_MPEG.html Defines the format tag for MPEG1 audio within the bwavfile crate. ```APIDOC ## Constant WAVE_TAG_MPEG ### Description Format tag for MPEG1 audio. ### Value ```rust pub const WAVE_TAG_MPEG: u16 = 0x0050; ``` ``` -------------------------------- ### WaveFmt Struct Definition Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveFmt.html Defines the structure for WAV file data format. Includes fields for tag, channel count, sample rate, bytes per second, block alignment, bits per sample, and an optional extended format. ```rust pub struct WaveFmt { pub tag: u16, pub channel_count: u16, pub sample_rate: u32, pub bytes_per_second: u32, pub block_alignment: u16, pub bits_per_sample: u16, pub extended_format: Option, } ``` -------------------------------- ### FromSample for S Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Implementation of the `FromSample` trait for type `S`, allowing conversion from a sample type to itself. ```APIDOC ## impl FromSample for S ### Description Provides a way to convert a sample type `S` into itself. ### Method N/A (trait implementation) ### Endpoint N/A ``` -------------------------------- ### CloneToUninit Trait Implementation Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Performs copy-assignment from self to a mutable pointer. This is a nightly-only experimental API. ```APIDOC ## unsafe fn clone_to_uninit(&self, dest: *mut u8) ### Description Performs copy-assignment from `self` to `dest`. This is a nightly-only experimental API. ### Method `clone_to_uninit` ### Endpoint N/A (Trait implementation) ### Parameters - **dest** (*mut u8) - Required - A mutable pointer to the destination memory location. ### Request Body None ### Response #### Success Response (200) None (operation is unsafe and modifies memory directly). ### Response Example N/A (Trait method) ``` -------------------------------- ### Partial Ordering for I24 Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Methods for partial ordering comparisons between I24 values. ```APIDOC ## partial_cmp(&self, other: &I24) -> Option ### Description This method returns an ordering between `self` and `other` values if one exists. ### Method `partial_cmp` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Option) - **Option** - An `Option` containing the `Ordering` if comparable, otherwise `None`. #### Response Example `Some(Ordering::Greater)` ``` ```APIDOC ## lt(&self, other: &Rhs) -> bool ### Description Tests less than (for `self` and `other`) and is used by the `<` operator. ### Method `lt` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - **bool** - `true` if `self` is less than `other`, `false` otherwise. #### Response Example `true` ``` ```APIDOC ## le(&self, other: &Rhs) -> bool ### Description Tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. ### Method `le` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - **bool** - `true` if `self` is less than or equal to `other`, `false` otherwise. #### Response Example `true` ``` ```APIDOC ## gt(&self, other: &Rhs) -> bool ### Description Tests greater than (for `self` and `other`) and is used by the `>` operator. ### Method `gt` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - **bool** - `true` if `self` is greater than `other`, `false` otherwise. #### Response Example `false` ``` ```APIDOC ## ge(&self, other: &Rhs) -> bool ### Description Tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. ### Method `ge` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (bool) - **bool** - `true` if `self` is greater than or equal to `other`, `false` otherwise. #### Response Example `true` ``` -------------------------------- ### From for T Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html The `from` function returns the argument unchanged. This is a fundamental identity conversion. ```APIDOC ## fn from(t: T) -> T ### Description Returns the argument unchanged. ### Method N/A (associated function) ### Endpoint N/A ``` -------------------------------- ### WaveReader and WaveWriter Source: https://docs.rs/bwavfile/2.0.1/bwavfile/index.html The `WaveReader` struct is used for parsing and reading WAV, Broadcast-WAV, and RF64/BW64 files. The `WaveWriter` struct is used for writing these same file formats. ```APIDOC ## Struct WaveReader Wave, Broadcast-WAV and RF64/BW64 parser/reader. ### Usage To open and read files, begin with `WaveReader`. ## Struct WaveWriter Wave, Broadcast-WAV and RF64/BW64 writer. ### Usage To open and write files, begin with `WaveWriter`. ``` -------------------------------- ### WaveReader::channels Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html Describes the channels in this file. Returns a vector of channel descriptors, one for each channel. ```APIDOC ## POST /api/reviews ### Description Submits a new review for a product. ### Method POST ### Endpoint /api/reviews ### Parameters #### Request Body - **productId** (string) - Required - The ID of the product being reviewed. - **userId** (string) - Required - The ID of the user submitting the review. - **rating** (integer) - Required - The rating given to the product (1-5). - **comment** (string) - Optional - The text comment for the review. ### Request Example ```json { "productId": "prod-xyz", "userId": "user-12345", "rating": 5, "comment": "Excellent product, highly recommended!" } ``` ### Response #### Success Response (200) - **reviewId** (string) - The unique identifier for the newly created review. - **message** (string) - A confirmation message indicating the review was submitted. #### Response Example ```json { "reviewId": "review-789", "message": "Review submitted successfully." } ``` ``` -------------------------------- ### Convert u16 to I24 via FromSample Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Converts a u16 integer into an I24 sample using the FromSample trait. ```rust fn from_sample_(s: u16) -> I24 ``` -------------------------------- ### Convert u8 to I24 via FromSample Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Converts a u8 integer into an I24 sample using the FromSample trait. ```rust fn from_sample_(s: u8) -> I24 ``` -------------------------------- ### Into for T Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.WaveReader.html The `into` function calls `U::from(self)`, performing a conversion based on the `From for U` implementation. ```APIDOC ## impl Into for T where U: From, ### Description Calls `U::from(self)`. This conversion is determined by the `From for U` implementation. ### Method N/A (trait implementation) ### Endpoint N/A ``` -------------------------------- ### Convert u64 to I24 Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Converts a u64 integer into an I24 sample using the FromSample trait. ```rust fn from_sample_(s: u64) -> I24 ``` -------------------------------- ### Define ADMAudioID struct Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.ADMAudioID.html Represents an ADM Audio ID record with fields for track UID, channel format reference, and pack reference. ```rust pub struct ADMAudioID { pub track_uid: [char; 12], pub channel_format_ref: [char; 14], pub pack_ref: [char; 11], } ``` -------------------------------- ### Comparison Methods for I24 Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Methods for comparing I24 values with other I24 values or different types. ```APIDOC ## cmp(&self, other: &I24) -> Ordering ### Description This method returns an `Ordering` between `self` and `other`. ### Method `cmp` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Ordering) - **Ordering** (enum) - The ordering between `self` and `other` (Less, Equal, Greater). #### Response Example `Ordering::Less` ``` ```APIDOC ## max(self, other: Self) -> Self ### Description Compares and returns the maximum of two values. ### Method `max` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Self) - **Self** (I24) - The maximum of the two input values. #### Response Example `5` ``` ```APIDOC ## min(self, other: Self) -> Self ### Description Compares and returns the minimum of two values. ### Method `min` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Self) - **Self** (I24) - The minimum of the two input values. #### Response Example `2` ``` ```APIDOC ## clamp(self, min: Self, max: Self) -> Self ### Description Restrict a value to a certain interval. ### Method `clamp` ### Endpoint N/A (Method implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Self) - **Self** (I24) - The clamped value within the specified interval. #### Response Example `3` ``` -------------------------------- ### Convert i64 to I24 Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Converts an i64 integer into an I24 sample using the FromSample trait. ```rust fn from_sample_(s: i64) -> I24 ``` -------------------------------- ### Define WAVE_TAG_MPEG constant Source: https://docs.rs/bwavfile/2.0.1/bwavfile/constant.WAVE_TAG_MPEG.html Represents the format tag for MPEG1 audio files. ```rust pub const WAVE_TAG_MPEG: u16 = 0x0050; ``` -------------------------------- ### Convert i32 to I24 Source: https://docs.rs/bwavfile/2.0.1/bwavfile/struct.I24.html Converts an i32 integer into an I24 sample. This is part of the From trait implementation. ```rust fn from(val: i32) -> I24 ``` -------------------------------- ### WAVE_TAG_EXTENDED Constant Source: https://docs.rs/bwavfile/2.0.1/bwavfile/constant.WAVE_TAG_EXTENDED.html Documentation for the WAVE_TAG_EXTENDED constant, which indicates an extended format tag. ```APIDOC ## Constant WAVE_TAG_EXTENDED ### Description Format tag indicating extended format ### Source ```rust pub const WAVE_TAG_EXTENDED: u16 = 0xFFFE; ``` ```