Skip to content

Commit

Permalink
Some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AldaronLau committed Oct 6, 2024
1 parent 8ab6bcd commit 17c26e8
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
//! Depending on the platform, it may run on a separate thread. When dealing
//! with real-time audio, it is important to make your code real-time safe
//! (avoid unbounded-time operations, such as syscalls). Communicating between
//! threads is often not real-time safe, but can be using [`DualQueue`].
//! threads is often not real-time safe, but can be using [`QueueSender`] and
//! [`QueueReceiver`].
//!
//! # Getting Started

use std::future::Future;

use event_iterator::EventIterator;

Check warning on line 25 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, stable, aarch64-linux-android)

unused import: `event_iterator::EventIterator`

Check warning on line 25 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `event_iterator::EventIterator`

Check warning on line 25 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `event_iterator::EventIterator`

Check warning on line 25 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

unused import: `event_iterator::EventIterator`

Check warning on line 25 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, beta, aarch64-linux-android)

unused import: `event_iterator::EventIterator`

Check warning on line 25 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

unused import: `event_iterator::EventIterator`

Check warning on line 25 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

unused import: `event_iterator::EventIterator`

Check warning on line 25 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

unused import: `event_iterator::EventIterator`

Check warning on line 25 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

unused import: `event_iterator::EventIterator`

Check warning on line 25 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

unused import: `event_iterator::EventIterator`
use fon::{Audio, Frame};

Check warning on line 26 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, stable, aarch64-linux-android)

unused imports: `Audio` and `Frame`

Check warning on line 26 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused imports: `Audio` and `Frame`

Check warning on line 26 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused imports: `Audio` and `Frame`

Check warning on line 26 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

unused imports: `Audio` and `Frame`

Check warning on line 26 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, beta, aarch64-linux-android)

unused imports: `Audio` and `Frame`

Check warning on line 26 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

unused imports: `Audio` and `Frame`

Check warning on line 26 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

unused imports: `Audio` and `Frame`

Check warning on line 26 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

unused imports: `Audio` and `Frame`

Check warning on line 26 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

unused imports: `Audio` and `Frame`

Check warning on line 26 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

unused imports: `Audio` and `Frame`

Expand Down Expand Up @@ -56,16 +59,27 @@ pub struct MicrophoneStream {}
pub struct SpeakersSink {}

/// [`EventIterator`] of [`Microphone`]
pub struct MicrophoneSearcher<T = DefaultAudioConfig> {
pub struct MicrophoneFinder<T = DefaultAudioConfig> {
audio_config: T,

Check warning on line 63 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, stable, aarch64-linux-android)

field `audio_config` is never read

Check warning on line 63 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `audio_config` is never read

Check warning on line 63 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `audio_config` is never read

Check warning on line 63 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

field `audio_config` is never read

Check warning on line 63 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, beta, aarch64-linux-android)

field `audio_config` is never read

Check warning on line 63 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

field `audio_config` is never read

Check warning on line 63 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

field `audio_config` is never read

Check warning on line 63 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

field `audio_config` is never read

Check warning on line 63 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

field `audio_config` is never read

Check warning on line 63 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

field `audio_config` is never read
}

/// [`EventIterator`] of [`Speakers`]
pub struct SpeakersSearcher<T = DefaultAudioConfig> {
pub struct SpeakersFinder<T = DefaultAudioConfig> {
audio_config: T,

Check warning on line 68 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, stable, aarch64-linux-android)

field `audio_config` is never read

Check warning on line 68 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `audio_config` is never read

Check warning on line 68 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `audio_config` is never read

Check warning on line 68 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

field `audio_config` is never read

Check warning on line 68 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, beta, aarch64-linux-android)

field `audio_config` is never read

Check warning on line 68 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

field `audio_config` is never read

Check warning on line 68 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

field `audio_config` is never read

Check warning on line 68 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

field `audio_config` is never read

Check warning on line 68 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

field `audio_config` is never read

Check warning on line 68 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

field `audio_config` is never read
}

/// [`EventIterator`] to real-time share data between async executors
pub struct DualQueue<T> {
/// [`EventIterator`] to send data to another async executor
pub struct QueueSender<T, const N: usize = DEFAULT_CHUNKS> {
t: T

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, stable, aarch64-linux-android)

field `t` is never read

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `t` is never read

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `t` is never read

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

field `t` is never read

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, beta, aarch64-linux-android)

field `t` is never read

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

field `t` is never read

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

field `t` is never read

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

field `t` is never read

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

field `t` is never read

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

field `t` is never read
}

/// [`EventIterator`] to receive data from another async executor
pub struct QueueReceiver<T, const N: usize = DEFAULT_CHUNKS> {
t: T

Check warning on line 78 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, stable, aarch64-linux-android)

field `t` is never read

Check warning on line 78 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `t` is never read

Check warning on line 78 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `t` is never read

Check warning on line 78 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

field `t` is never read

Check warning on line 78 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, beta, aarch64-linux-android)

field `t` is never read

Check warning on line 78 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

field `t` is never read

Check warning on line 78 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

field `t` is never read

Check warning on line 78 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

field `t` is never read

Check warning on line 78 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

field `t` is never read

Check warning on line 78 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

field `t` is never read
}

/// Send a single-threaded future to the audio executor
pub fn spawn_audio_task<F>(f: impl FnOnce() -> F + Send)

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, stable, aarch64-linux-android)

unused variable: `f`

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused variable: `f`

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused variable: `f`

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

unused variable: `f`

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile (ubuntu-latest, beta, aarch64-linux-android)

unused variable: `f`

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

unused variable: `f`

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

unused variable: `f`

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, stable, aarch64-apple-ios)

unused variable: `f`

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, beta, aarch64-apple-ios)

unused variable: `f`

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / cross-compile-ios (macos-latest, nightly, aarch64-apple-ios)

unused variable: `f`
where F: Future<Output = ()>
{
}

0 comments on commit 17c26e8

Please sign in to comment.