Example #1
0
//---------------------------------------------------------------------------
void __fastcall TScpExplorerForm::RemoteDirViewUpdateStatusBar(
  TObject * /*Sender*/, const TStatusFileInfo & FileInfo)
{
  FStatusBarFileText = FileStatusBarText(FileInfo);
  if (!CancelNote(false))
  {
    // if there's no note to cancel, we need to update status bar explicitly
    UpdateStatusBar();
  }
}
 // returns true if voice ended
 double ProcessSample()
 {
     double sampleValue=0;
     
     // update amplitude
     currentAmplitude+=amplitudeCoeff*(amplitude-currentAmplitude);
     if(amplitude==0 && currentAmplitude<.0001)
     {
         // value below threshold => the voice ended
         
         // if not the last voice in the list
         if(!(voices[activeVoicesCount-1]==*this))
         {
             // swap with last voice in the list
             *this=voices[activeVoicesCount-1];
             voices[activeVoicesCount-1].CancelNote();
             
             // decrease voices count
             activeVoicesCount--;
             
             // process swaped voice instead of this one
             return ProcessSample();
         }
         else
         {
             // cancel current note
             CancelNote();
             
             // decrease voices count
             activeVoicesCount--;
             return 0;
         }
     }
     
     // compute sample value
     sampleValue=currentAmplitude*(bar1Level*sin(currentPhase*.5)+bar2Level*sin(currentPhase)+bar3Level*sin(currentPhase*1.5)+bar4Level*sin(currentPhase*2)+bar5Level*sin(currentPhase*3));
     
     // update phase
     currentPhase+=omega;
     return sampleValue;
 }