[−][src]Struct simple_tones::Note
Represents a musical note.
Implementations
impl Note
[src]
pub fn new<D: Into<f64>>(pitch: NotePitch, duration: D) -> Self
[src]
Constructs a new Note with a given NotePitch
and a duration which represents the value of the note as a fraction.
NoteDuration
can be used as a helper enum.
Example
use simple_tones::{Note, NoteDuration}; let note = Note::new("A4".parse().unwrap(), NoteDuration::Whole);
Trait Implementations
impl Debug for Note
[src]
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));
Auto Trait Implementations
impl RefUnwindSafe for Note
[src]
impl Send for Note
[src]
impl Sync for Note
[src]
impl Unpin for Note
[src]
impl UnwindSafe for Note
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,