From 02d952c6ff698902ac8ff94a9bcd06b4ccc90202 Mon Sep 17 00:00:00 2001 From: Resethel Date: Sun, 22 Oct 2017 02:51:13 +0200 Subject: [PATCH] v0.2 - Final Iteration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ~ Corrections de bug et erreurs: - Lors d'un son courbé descendant, step est corrigé - Correction des boucles for dans la fonction bendTones ~ Refactoring de code --- Kubot.cpp | 6 +++--- Kubot.hpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Kubot.cpp b/Kubot.cpp index d6c803f..c2b363b 100644 --- a/Kubot.cpp +++ b/Kubot.cpp @@ -254,7 +254,7 @@ void Kubot::_tone(float frequency, long noteDuration, long silenceDuration) // Permet au Kubot de jouer une note courbée // dans la première itération, le temps par note est fixé à 15ms -void Kubot::bendTones(float initFrequency, float finalFrequency, float step) +void Kubot::bendTones(float initFrequency, float finalFrequency, float _step) { bool ascending = (finalFrequency > initFrequency); @@ -263,12 +263,12 @@ void Kubot::bendTones(float initFrequency, float finalFrequency, float step) if (ascending) // Si la frequence final est supérieure { - for (int i(0) ; i <= 100 ; i += step); + for (int i(0) ; i <= 100 ; i += _step) _tone(initFrequency + slope*i, 15); } else { - (int i(100) ; i >= 0 ; i -= slope); + for (int i(100) ; i >= 0 ; i -= _step) _tone(initFrequency + slope*i, 15); } diff --git a/Kubot.hpp b/Kubot.hpp index af41161..099cc44 100644 --- a/Kubot.hpp +++ b/Kubot.hpp @@ -62,7 +62,7 @@ class Kubot //-- Son void _tone(float frequency, long noteDuration, long silenceDuration = 1); - void bendTones(float initFrequency, float finalFrequency, float step); + void bendTones(float initFrequency, float finalFrequency, float _step);