support custom Beep

Audio software developers forum.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

support custom Beep

Post by Edgar » Thu Oct 07, 2010 8:06 pm

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

Code: Select all

void
ProgressDialog::Beep()
{
   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 {
         s.Create(name);
      }

      if (s.IsOk())
      {
         s.Play(wxSOUND_SYNC);
      }
   }
}
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.
Last edited by Edgar on Fri Oct 08, 2010 11:18 pm, edited 1 time in total.

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: support custom Beep

Post by Gale Andrews » Fri Oct 08, 2010 10:09 pm

Thanks, Ed. I now have a pleasant little 5 second snippet of Mozart to announce task completion :). 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.



Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: support custom Beep

Post by Edgar » Fri Oct 08, 2010 11:17 pm

Gale Andrews wrote: 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?
I also find that to be true; what I did was shorten up my audio file.

Post Reply