From 725302c54573d1095d49d466ebda94abe9c13dd5 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Thu, 30 Dec 2010 17:32:08 +0100 Subject: Use NoteSkel wherever possible Notes are still created from the built-in Note class, but theoretically, other classes could be used, too. --- synth/channel.cpp | 23 +++++++++++++---------- synth/channel.h | 4 ++-- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'synth') diff --git a/synth/channel.cpp b/synth/channel.cpp index 35ee375..ddad9fe 100644 --- a/synth/channel.cpp +++ b/synth/channel.cpp @@ -3,6 +3,9 @@ #include "math.h" #include "globals.h" +#include "note.h" + + Channel::Channel() { volume=ONE; @@ -27,7 +30,7 @@ Channel::~Channel() void Channel::cleanup() { - list::iterator it; + list::iterator it; for (it=notes.begin(); it!=notes.end(); it++) if ((*it)->still_active()==false) { @@ -40,7 +43,7 @@ fixed_t Channel::get_sample() { fixed_t sum=0; - for (list::iterator it=notes.begin(); it!=notes.end(); it++) + for (list::iterator it=notes.begin(); it!=notes.end(); it++) sum+=(*it)->get_sample(); return sum*volume >>SCALE; @@ -70,13 +73,13 @@ void Channel::note_off(int note) void Channel::note_on(int note, int vel) { - list::iterator it; + list::iterator it; if (vel>0) //note on { if ( (n_voices==1) && (!notes.empty()) ) { //no need to create a new note; reuse the existing - Note *n; //i'm lazy + NoteSkel *n; //i'm lazy n= *(notes.begin()); if (n->get_program() != program) @@ -153,7 +156,7 @@ void Channel::apply_voice_limit() int diff=notes.size()-n_voices; if (diff>0) { - list::iterator it=notes.begin(); + list::iterator it=notes.begin(); if (quick_release) for (int i=0;i::iterator it=notes.begin(); it!=notes.end(); it++) + for (list::iterator it=notes.begin(); it!=notes.end(); it++) (*it)->set_param(par, val); curr_prg.set_param(par, val); @@ -300,14 +303,14 @@ void Channel::set_real_portamento_frames() else portamento_frames=0; - list::iterator it; + list::iterator it; for (it=notes.begin(); it!=notes.end(); it++) (*it)->set_portamento_frames(portamento_frames); } void Channel::panic() { - list::iterator it; + list::iterator it; for (it=notes.begin(); it!=notes.end();) { delete *it; @@ -317,7 +320,7 @@ void Channel::panic() void Channel::release_all() { - list::iterator it; + list::iterator it; for (it=notes.begin(); it!=notes.end(); it++) (*it)->release(); } @@ -332,7 +335,7 @@ void Channel::set_pitch_bend(float val) { pitchbend=pow(2.0,val/12.0)*ONE; - list::iterator it; + list::iterator it; for (it=notes.begin(); it!=notes.end(); it++) (*it)->set_pitchbend(pitchbend); } diff --git a/synth/channel.h b/synth/channel.h index ead3a67..2668bc4 100644 --- a/synth/channel.h +++ b/synth/channel.h @@ -7,7 +7,7 @@ #include "fixed.h" #include "programs.h" -#include "note.h" +#include "note_skel.h" #include "defines.h" #include "util.h" @@ -50,7 +50,7 @@ class Channel fixed_t pitchbend; float max_pitchbend; - std::list notes; + std::list notes; bool always_reattack; bool do_portamento; -- cgit v1.2.3