Add some Trait doc comments
Added comments to Audio(System|Player)Interface traits.
This commit is contained in:
@@ -6,10 +6,6 @@ use mumble_web2_common::{ClientConfig, ServerStatus};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// Platform Struct
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
/// Desktop platform implementation using Tokio and native audio.
|
/// Desktop platform implementation using Tokio and native audio.
|
||||||
pub struct DesktopPlatform;
|
pub struct DesktopPlatform;
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ impl super::PlatformInterface for MobilePlatform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn get_status(client: &reqwest::Client) -> color_eyre::Result<ServerStatus> {
|
async fn get_status(client: &reqwest::Client) -> color_eyre::Result<ServerStatus> {
|
||||||
get_status(client).await
|
super::connect::get_status(client).await
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_logging() {
|
fn init_logging() {
|
||||||
|
|||||||
+12
-2
@@ -15,10 +15,15 @@ use std::time::Duration;
|
|||||||
// Trait Definitions
|
// Trait Definitions
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
/// Platform-specific audio subsystem for capturing microphone input and creating playback streams.
|
||||||
|
///
|
||||||
|
/// The audio system handles Opus encoding internally - callers receive encoded frames
|
||||||
|
/// ready for network transmission.
|
||||||
pub trait AudioSystemInterface: Sized {
|
pub trait AudioSystemInterface: Sized {
|
||||||
|
/// The player type returned by [`create_player`](Self::create_player).
|
||||||
type AudioPlayer: AudioPlayerInterface;
|
type AudioPlayer: AudioPlayerInterface;
|
||||||
|
|
||||||
/// Initialize the audio system, including relevant state
|
/// Initialize the audio system.
|
||||||
async fn new() -> Result<Self, Error>;
|
async fn new() -> Result<Self, Error>;
|
||||||
|
|
||||||
/// Set the processor for the microphone input, mainly noise cancellation settings.
|
/// Set the processor for the microphone input, mainly noise cancellation settings.
|
||||||
@@ -35,8 +40,13 @@ pub trait AudioSystemInterface: Sized {
|
|||||||
fn create_player(&mut self) -> Result<Self::AudioPlayer, Error>;
|
fn create_player(&mut self) -> Result<Self::AudioPlayer, Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A handle to an active audio playback stream for a single remote user.
|
||||||
|
///
|
||||||
|
/// Each connected user gets their own `AudioPlayer` instance, which decodes
|
||||||
|
/// incoming Opus frames and outputs PCM audio to the platform's audio device.
|
||||||
|
/// The player manages its own decoder state and output buffer.
|
||||||
pub trait AudioPlayerInterface {
|
pub trait AudioPlayerInterface {
|
||||||
/// Playback an opus frame.
|
/// Decode and play an Opus-encoded audio frame.
|
||||||
fn play_opus(&mut self, payload: &[u8]);
|
fn play_opus(&mut self, payload: &[u8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user