void Synthesize()
{
BYTE t;
if ( noteCounter >= controls.Beat )
{
// Reset note counter
noteCounter = 0;
// Reset time counter
timeCounter = 0;
// Process buttons press events
...
// Read knob potentiometers
...
// Generate new musical score measure
GeneratePattern();
}
else
{
// Increase time counter
timeCounter++;
// Reset time counter
if ( timeCounter >= noteDuration )
{
timeCounter = 0;
noteCounter++;
}
}
// Synthesize actual music
doSynth();
}