From b9c6fd24d730d456d0bfa109c98cfa75ced5d3b8 Mon Sep 17 00:00:00 2001 From: polsevev Date: Sat, 4 Mar 2023 23:36:25 +0100 Subject: [PATCH] Audio sucks --- src/GuiHookVec.rs | 1 + src/soundGenerator.rs | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GuiHookVec.rs b/src/GuiHookVec.rs index e784e2e..31c4e4d 100644 --- a/src/GuiHookVec.rs +++ b/src/GuiHookVec.rs @@ -68,6 +68,7 @@ impl SortingList for GuiVec{ let colorStep = 360./length as f32; let mut list:Vec = 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); diff --git a/src/soundGenerator.rs b/src/soundGenerator.rs index 3805e72..fe6eef4 100644 --- a/src/soundGenerator.rs +++ b/src/soundGenerator.rs @@ -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();