Skip to content

Commit

Permalink
Address Jen review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
strohel authored and goodhoko committed Apr 28, 2023
1 parent 8cae2fd commit 70df76e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ pub(crate) struct AudioOutput {
_stream: cpal::Stream,
}

/// Abstraction to actually produce sound using the [AudioOutput::play()] method.
/// Uses `cpal` and `rodio` behind the curtains. Great care is taken to position played samples
/// precisely in time so that sound superposition works well even at high frequencies.
/// Playback stops when this struct is dropped.
impl AudioOutput {
pub(crate) fn new(play_delay: Duration) -> Result<Self> {
let cpal_device = cpal::default_host()
Expand Down
2 changes: 1 addition & 1 deletion crates/composer/src/jukebox.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::sound::AudioOutput;
use crate::audio_output::AudioOutput;
use eyre::{Context, Result};
use rodio::{
source::{Buffered, SamplesConverter},
Expand Down
4 changes: 2 additions & 2 deletions crates/composer/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![warn(clippy::all, clippy::clone_on_ref_ptr)]

use crate::{
audio_output::AudioOutput,
jukebox::{Jukebox, Sample},
sound::AudioOutput,
};
use clap::Parser;
use composer_api::{Event, DEFAULT_SERVER_ADDRESS};
Expand All @@ -12,8 +12,8 @@ use std::{
time::{Duration, Instant},
};

mod audio_output;
mod jukebox;
mod sound;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
Expand Down

0 comments on commit 70df76e

Please sign in to comment.