Audio sucks

This commit is contained in:
Rolf Martin Glomsrud 2023-03-04 23:36:25 +01:00
parent d81a1a5167
commit b9c6fd24d7
2 changed files with 3 additions and 3 deletions

View file

@ -68,6 +68,7 @@ impl SortingList for GuiVec{
let colorStep = 360./length as f32;
let mut list:Vec<Bar> = vec!();
let freqStep = 50. + ((2000.-50.)/length as f32);
for i in 1..length+1 {
let frequency = i as f32 * freqStep;
list.push(Bar::new(i, (colorStep*i as f32)/360., frequency).await);

View file

@ -1,6 +1,6 @@
use std::f32::consts::PI;
use macroquad::{audio::{Sound, load_sound_from_bytes}, window::{next_frame, screen_width, screen_height}, text::draw_text, prelude::BLACK};
use macroquad::{audio::{Sound, load_sound_from_bytes}, window::{next_frame, screen_width, screen_height, clear_background}, text::draw_text, prelude::{BLACK, WHITE}};
const CHUNK_ID:&str = "RIFF";
@ -71,8 +71,7 @@ pub async fn generateTone(frequency: f32, duration:f32) -> Sound{
collect.push(channel);
soundFileBytes.append(&mut (channel as i16).to_le_bytes().to_vec());
draw_text("Processing Audio beeps!", (screen_width() / 2.)-170.0, screen_height()*0.1, 100.0, BLACK);
next_frame().await
}
let endAudio = soundFileBytes.len();