-Fixed metronome bar / beat different tick sounds

This commit is contained in:
Harry van Haaren 2013-11-02 13:49:47 +00:00
parent b1566046fc
commit 6f64f64abd
3 changed files with 8 additions and 6 deletions

View file

@ -40,7 +40,7 @@ void Metronome::setActive(bool a)
playPoint = endPoint + 1; playPoint = endPoint + 1;
} }
void Metronome::bar(int) void Metronome::bar()
{ {
playPoint = 0; playPoint = 0;
playBar = true; playBar = true;
@ -49,6 +49,7 @@ void Metronome::bar(int)
void Metronome::beat() void Metronome::beat()
{ {
playPoint = 0; playPoint = 0;
playBar = false;
} }
void Metronome::setFpb(int f) void Metronome::setFpb(int f)
@ -68,7 +69,10 @@ void Metronome::process(int nframes, Buffers* buffers)
float* outR = buffers->audio[Buffers::MASTER_OUT_R]; float* outR = buffers->audio[Buffers::MASTER_OUT_R];
float* sample = &beatSample[0]; float* sample = &beatSample[0];
if( playBar ) { sample = &barSample[0]; playBar = false; } if( playBar )
{
sample = &barSample[0];
}
for(int i = 0; i < nframes; i++) for(int i = 0; i < nframes; i++)
{ {

View file

@ -19,8 +19,7 @@ class Metronome : public TimeObserver
void setActive(bool a); void setActive(bool a);
void bar(){}; // dummy override void bar();
void bar(int);
void beat(); void beat();
void setFpb(int f); void setFpb(int f);

View file

@ -158,14 +158,13 @@ void TimeManager::process(Buffers* buffers)
} }
// FIXME: 4 == beats in time sig // FIXME: 4 == beats in time sig
if ( beat % (int) 4 == 0 ) if ( beat % 4 == 0 )
{ {
// inform observers of new bar SECOND // inform observers of new bar SECOND
for(uint i = 0; i < observers.size(); i++) for(uint i = 0; i < observers.size(); i++)
{ {
observers.at(i)->bar(); observers.at(i)->bar();
} }
//buffers->transportPosition->bar++; //buffers->transportPosition->bar++;
} }