mirror of
https://github.com/RustAudio/rodio
synced 2024-11-10 14:14:21 +00:00
Improve stream docs
This commit is contained in:
parent
e8a6502e45
commit
4c96d3bd55
1 changed files with 4 additions and 1 deletions
|
@ -10,7 +10,8 @@ use std::io::{Read, Seek};
|
|||
use std::sync::{Arc, Weak};
|
||||
use std::{error, fmt};
|
||||
|
||||
/// Immovable `cpal::Stream` container.
|
||||
/// `cpal::Stream` container. Also see the more useful `OutputStreamHandle`.
|
||||
///
|
||||
/// If this is dropped playback will end & attached `OutputStreamHandle`s will no longer work.
|
||||
pub struct OutputStream {
|
||||
mixer: Arc<DynamicMixerController<f32>>,
|
||||
|
@ -24,6 +25,7 @@ pub struct OutputStreamHandle {
|
|||
}
|
||||
|
||||
impl OutputStream {
|
||||
/// Returns a new stream & handle using the given output device.
|
||||
pub fn try_from_device(
|
||||
device: &cpal::Device,
|
||||
) -> Result<(Self, OutputStreamHandle), StreamError> {
|
||||
|
@ -36,6 +38,7 @@ impl OutputStream {
|
|||
Ok((out, handle))
|
||||
}
|
||||
|
||||
/// Return a new stream & handle using the default output device.
|
||||
pub fn try_default() -> Result<(Self, OutputStreamHandle), StreamError> {
|
||||
let device = cpal::default_host()
|
||||
.default_output_device()
|
||||
|
|
Loading…
Reference in a new issue