Updated comments and added getStreamMetaData() to StreamMgr()
This commit is contained in:
parent
622ece7486
commit
a905e58023
@ -42,6 +42,12 @@ static smgr_created: AtomicBool = AtomicBool::new(false);
|
||||
/// Configure and manage input / output streams. This method is supposed to be a
|
||||
/// SINGLETON. Runtime checks are performed to see whether this is true.
|
||||
///
|
||||
/// A stream manager provides the interaction layer for interacting with audio /
|
||||
/// data streams.
|
||||
///
|
||||
/// * See [Recording] for an example of starting a recording on an input stream.
|
||||
/// * See [Siggen] for an example of playing a signal to an output stream.
|
||||
///
|
||||
#[cfg_attr(feature = "python-bindings", pyclass(unsendable))]
|
||||
pub struct StreamMgr {
|
||||
// List of available devices
|
||||
@ -142,6 +148,25 @@ impl StreamMgr {
|
||||
smgr
|
||||
}
|
||||
|
||||
/// Returns the metadata for a given stream, when the stream type (see
|
||||
/// [StreamType]) is alive, i.e. (StreamMgr::getStatus) gives a 'Running'.
|
||||
///
|
||||
pub fn getStreamMetaData(&self, t: StreamType) -> Option<Arc<StreamMetaData>> {
|
||||
match t {
|
||||
StreamType::Input | StreamType::Duplex => {
|
||||
if let Some(s) = &self.input_stream {
|
||||
return Some(s.stream.metadata());
|
||||
}
|
||||
}
|
||||
StreamType::Output => {
|
||||
if let Some(s) = &self.output_stream {
|
||||
return Some(s.stream.metadata());
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Get stream status for given stream type.
|
||||
pub fn getStatus(&self, t: StreamType) -> StreamStatus {
|
||||
match t {
|
||||
|
12
src/lib.rs
12
src/lib.rs
@ -3,9 +3,9 @@
|
||||
//! This crate contains structures and functions to perform acoustic
|
||||
//! measurements, interact with data acquisition devices and apply common
|
||||
//! acoustic analysis operations on them.
|
||||
//!
|
||||
//!
|
||||
//! You will find the following stuff in this crate:
|
||||
//!
|
||||
//!
|
||||
//! - Data acquisition, recording, signal generation
|
||||
//! - Power spectra estimation, transfer function estimation tools.
|
||||
//! - Sound Level Meter implementation.
|
||||
@ -14,14 +14,16 @@
|
||||
//!
|
||||
//! ## Note to potential users
|
||||
//!
|
||||
//! ** This crate is still under heavy development. API changes happen on the
|
||||
//! fly. Documentation is not finished. Use with caution but except things to be
|
||||
//! **This crate is still under heavy development. API changes happen on the
|
||||
//! fly. Documentation is not finished. Use with caution and expect things to be
|
||||
//! broken and buggy. Use at your own risk and responsibility.**
|
||||
//!
|
||||
//! ## Author information
|
||||
//!
|
||||
//! The main developer is J.A. de Jong from [ASCEE](https://www.ascee.nl). In
|
||||
//! case of bug reports, please file them to info@ascee.nl.
|
||||
//! case of bug reports, please file them to [info@ascee.nl](info@ascee.nl).
|
||||
//!
|
||||
//! If you have particular interest in this library, please also contact us.
|
||||
//!
|
||||
#![warn(missing_docs)]
|
||||
#![allow(non_snake_case)]
|
||||
|
@ -1,12 +1,3 @@
|
||||
//! Window functions designed for Welch' method. Implementations are given for
|
||||
//! the 5 classical window functions:
|
||||
//!
|
||||
//! * Rect - rectangular
|
||||
//! * Hann - Von Hann window (sometimes wrongly called "Hanning")
|
||||
//! * Bartlett
|
||||
//! * Hamming
|
||||
//! * Blackman
|
||||
//!
|
||||
#![allow(non_snake_case)]
|
||||
use crate::config::*;
|
||||
|
||||
@ -70,6 +61,17 @@ fn hamming(N: usize) -> Dcol {
|
||||
|
||||
/// Window type descriptors. Used for computing the actual window with private
|
||||
/// functions. See [Window], for the actual window (taper).
|
||||
///
|
||||
/// Window functions designed for Welch' method. Implementations are given for
|
||||
/// the 5 classical window functions:
|
||||
///
|
||||
/// * Hann - Von Hann window (sometimes wrongly called "Hanning")
|
||||
/// * Rect - rectangular
|
||||
/// * Bartlett
|
||||
/// * Hamming
|
||||
/// * Blackman
|
||||
///
|
||||
/// The [WindowType::default] is [WindowType::Hann].
|
||||
#[derive(Display, Clone, Debug)]
|
||||
pub enum WindowType {
|
||||
/// Von Hann window
|
||||
|
@ -1,4 +1,5 @@
|
||||
//! This module provide signal generators.
|
||||
//! This module provide signal generators. The import struct defined here is
|
||||
//! [Siggen], which has several creation methods.
|
||||
//!
|
||||
//! # Examples
|
||||
//!
|
||||
@ -9,9 +10,13 @@
|
||||
//! let mut wn = Siggen::newWhiteNoise(1);
|
||||
//! // Set gains for all channels
|
||||
//! wn.setAllGains(0.1);
|
||||
//! // Unmute all channels
|
||||
//! wn.setAllMute(false);
|
||||
//! // Create a slice where data is stored.
|
||||
//! let mut sig = [0. ; 1024];
|
||||
//! // Fill `sig` with the signal data.
|
||||
//! wn.genSignal(&mut sig);
|
||||
//! // Print data.
|
||||
//! println!("{:?}", &sig);
|
||||
//!
|
||||
//! ```
|
||||
|
Loading…
Reference in New Issue
Block a user