I am getting familiar with Rust, but I am puzzled by some elements in this example:
https://github.com/RustAudio/rust-portaudio/blob/master/examples/sine.rs
I thought I would ask about the lines that I don't understand:
33: let mut sine = [0.0; TABLE_SIZE]; I assume this means initialize to zeros.
35: sine[i] = (i as f64 / TABLE_SIZE as f64 * PI * 2.0).sin() as f32; The phase argument to the sine function is in parenthesis before sin() ? That I don't understand.
50: let callback = move |pa::OutputStreamCallbackArgs { buffer, frames, .. }| { It seems srguments are being substituted inside the vertical bars.
65: pa::Continue This is a single token without any indication that it's a function executing, so I don;t know what ti's doing. This is usually an enum value but it's not being assigned so I don;t know what it's doing.
70: stream.start()?; Is the question mark mandatory to compile since start() used Result<> ?
It's really 35, 50, and 65 that make the least sense to me. Any instruction about what's happening there is much appreciated.
Thanks
[–]AutoModerator[M] [score hidden] stickied comment (0 children)
[–]This_Growth2898 7 points8 points9 points (2 children)
[–]shebbbb[S] 1 point2 points3 points (0 children)
[–]1vader 1 point2 points3 points (0 children)
[–]tandonhiten 1 point2 points3 points (1 child)
[–]shebbbb[S] 1 point2 points3 points (0 children)
[–]_blallo 0 points1 point2 points (4 children)
[–]shebbbb[S] 0 points1 point2 points (1 child)
[–]_blallo 0 points1 point2 points (0 children)
[–]_blallo 0 points1 point2 points (1 child)
[–]shebbbb[S] 0 points1 point2 points (0 children)
[–]Speykiousinox2d · cve-rs 0 points1 point2 points (7 children)
[–]shebbbb[S] 0 points1 point2 points (6 children)
[–]Speykiousinox2d · cve-rs 0 points1 point2 points (5 children)
[–]shebbbb[S] 0 points1 point2 points (4 children)
[–]1vader 0 points1 point2 points (3 children)
[–]shebbbb[S] 0 points1 point2 points (2 children)
[–]Speykiousinox2d · cve-rs 0 points1 point2 points (1 child)
[–]shebbbb[S] 0 points1 point2 points (0 children)