[][src]Trait simple_tones::Play

pub trait Play {
    pub fn play(
        &self,
        stream_handle: &OutputStreamHandle,
        bar_duration: Duration
    ); }

Is implemented by all playable types. (e.g. Note, Rest)

Required methods

pub fn play(&self, stream_handle: &OutputStreamHandle, bar_duration: Duration)[src]

Plays on the given stream_handle for duration time.

Loading content...

Implementations on Foreign Types

impl<'a, T> Play for &'a T where
    T: Play
[src]

Loading content...

Implementors

impl Play for Note[src]

pub fn play(&self, stream_handle: &OutputStreamHandle, bar_duration: Duration)[src]

Plays this note on the given stream_handle for duration time. The sound is generated by a sine wave.

Example

use std::time;
use simple_tones::{Note, NoteType, NotePitch, Play};

let (_stream, stream_handle) = rodio::OutputStream::try_default().unwrap();
let note = Note::new(NotePitch::new(NoteType::A, 4), 1);
note.play(&stream_handle, time::Duration::from_secs(2));

impl Play for Rest[src]

Loading content...