Skip to main content

AudioStream

Struct AudioStream 

Source
pub struct AudioStream;

Implementations§

Source§

impl AudioStream

Source

pub fn start(sample_rate: u32, channels: u32)

連続再生を始める(既に同じ形式で動いていれば何もしない)。

Source

pub fn push(pcm: &[i16])

復号済みの PCM(交互配置)を足す。

Source

pub fn buffered_ms() -> u64

溜まっている時間 [ms](連続再生していなければ 0)。

Source

pub fn set_paused(paused: bool)

一時停止(無音を流し、待ち行列は保つ)・再開。

Source

pub fn flush()

待ち行列を捨てる(シーク時)。

Source

pub fn played_ms() -> Option<u64>

実際に再生された経過時間 [ms](A/V同期用)。

Source

pub fn set_played_ms(ms: u64)

再生時刻の基準を設定(シーク時用)。

Source

pub fn is_active() -> bool

Source

pub fn set_volume(vol: u32)

音量を設定する(0..=256。256 が 100%、128 が 50%、0 が無音)。

Source

pub fn volume() -> u32

現在の音量を取得する(初期値 256)。

Source

pub fn set_muted(muted: bool)

ミュート状態を設定する。

Source

pub fn is_muted() -> bool

ミュート状態かを取得する。

Source

pub fn peak_level() -> i16

ピーク振幅レベル(0..=32767)を取得する。

Source

pub fn reset_peak()

ピーク振幅レベルをリセットする。

Source

pub fn set_max_frames(max: usize)

最大許容フレーム数を設定する(0 なら無制限)。

Source

pub fn stats() -> (u64, u64, u64)

オーディオストリームの統計情報(アンダーラン累積フレーム数, アンダーラン発生回数, ドロップ累積フレーム数)を取得する。

Source

pub fn stop()

連続再生を止め、PWM を効果音(単音)用の設定へ戻す。

Source

fn delay()

Source

unsafe fn hw_start(range: u32)

PWM のクロック(PLLD/2)・周期・FIFO・DREQ を設定し、DMA のリングを始める。

Source

unsafe fn fill_half(half: usize)

面 half(0/1)を待ち行列から埋め、DMA から見えるようにキャッシュを書き出す。

Source

fn feeder_thread()

補給スレッド: DMA が読み終えた面を埋め直す(QEMU では USB Audio が無ければ実時間で消費する)。

Source

unsafe fn restore_tone_mode()

PWM を init() と同じ効果音(単音)用の設定へ戻す(OSC 19.2MHz / 16、M/S 方式)。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.