support custom Beep

While stumbling about in the code I came across this in srcwidgetsProgressDialog.cpp:

   int after;
   bool should;
   wxString name;

   gPrefs->Read(wxT("/GUI/BeepOnCompletion"), &should, false);
   gPrefs->Read(wxT("/GUI/BeepAfterDuration"), &after, 60);
   gPrefs->Read(wxT("/GUI/BeepFileName"), &name, wxEmptyString);

   if (should && wxGetLocalTimeMillis().GetValue() - mStartTime > after * 1000)
      wxBusyCursor busy;
      wxSound s;

      if (name.IsEmpty()) {
         s.Create(sizeof(beep), beep);
      else {

      if (s.IsOk())

Just to try it out I used Audacity to record “export multiple has completed successfully” with my microphone and then saved it as a WAV file. At first, I just copied this code and the data that " beep" entails and ran it without a sound file just to hear what the beep sounded like – it was an almost instantaneous chirp; this was not adequate so I made it chirp five times– this was okay but the volume was less than useful. Next I tried it with my WAV file, it worked perfectly!

Unfortunately, this relies on a member variable which is specific to this ProgressDialog, and no other dialogs seem to have it – a minor hassle. The real problem is that only BeepOnCompletion is exposed to the user (via Preferences); neither BeepAfterDuration nor BeepFileName are exposed and can only be manipulated by using a text editor on the configuration file.

Thanks, Ed. I now have a pleasant little 5 second snippet of Mozart to announce task completion :slight_smile:. Interestingly if something has to be done after the task completes, such as remove the progress bar and draw the waveform, these seem to have to wait until the file completes playing. Do you find that?

@ Peter, I’ll add this suggestion to add beep sound and delay time in Preferences to the Wiki FR’s.


I also find that to be true; what I did was shorten up my audio file.