Expand Audacity

Effects, Recipes, Interfacing with other software, etc.
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
Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Expand Audacity

Post by Edgar » Thu Oct 06, 2011 5:07 pm

Well done!

klimmbimm
Posts: 14
Joined: Thu Sep 22, 2011 9:25 am
Operating System: Please select

Re: Expand Audacity

Post by klimmbimm » Wed Oct 12, 2011 10:13 am

There is one "bug" I see in my Audacity version: If I open Audacity twice and a second Audycity (and third and so on...) instance should open with parameters, it fails:
Image

It seems as if Audacity tries to open the file "-saveAs", which is my renamed "-output" flag.

I don't see, why a second instance of Audacity does this. Any hints?

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

Re: Expand Audacity

Post by Edgar » Wed Oct 12, 2011 6:04 pm

It may be an OS or shell/CLI problem. I get something similar if I create something like this in a text file:
audacity.exe -doSomething file1.wav
audacity.exe -doSomething file2.wav
audacity.exe -doSomething file3.wav

then select all and copy then paste from the clipboard into a CLI (on Win7 using the built-in shell). However, if I save the text file with a .bat extension (instead of .txt) and execute the resulting file as a batch process it works as planned. The difference is that pasting text into the CLI from the clipboard runs all the commands simultaneously while running as a batch processes the commands on-at-a-time.

If that does not get you going, create and send me a patch (or just send me the changed files) and I will install the code here and see what I can do. I will PM you right now with my @dress so you may send me code which might not be attachable here.

Oh, and as to your point about using wxT(), have you tried it? My personal choice is to use very plain names which would not require this but seeing your pic with (what looks like) German I understand your thought!

klimmbimm
Posts: 14
Joined: Thu Sep 22, 2011 9:25 am
Operating System: Please select

Re: Expand Audacity

Post by klimmbimm » Fri Oct 14, 2011 12:50 pm

To avoid the bug I now just commented out the "DDE connection to an already active Audacity" (ca. line 1683 to line 1700 in AudacityApp.cpp):

Code: Select all

	  /* //mytry start
      wxClient client;
      wxConnectionBase *conn;

      // We try up to 10 times since there's a small window
      // where the DDE server may not have been fully initialized
      // yet.
      for (int i = 0; i < 10; i++) {
         conn = client.MakeConnection(wxEmptyString,
                                      IPC_APPL,
                                      IPC_TOPIC);
         if (conn) {
            if (conn->Execute(argv[1])) {
               // Command was successfully queued so exit quietly
               delete mChecker;
               return false;
            }
         }
         wxMilliSleep(100);
      }
	  */ //mytry end
Last edited by klimmbimm on Mon Oct 17, 2011 8:11 am, edited 1 time in total.

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

Re: Expand Audacity

Post by Edgar » Fri Oct 14, 2011 1:41 pm

klimmbimm wrote:To avoid the bug I now just uncommented the "DDE connection to an already active Audacity" (ca. line 1683 to line 1700 in AudacityApp.cpp)
This is a dangerous solution as most of Audacity's code is NOT re-entrant--it is just not designed for multiple simultaneous instances.

klimmbimm
Posts: 14
Joined: Thu Sep 22, 2011 9:25 am
Operating System: Please select

Re: Expand Audacity

Post by klimmbimm » Mon Oct 17, 2011 8:10 am

klimmbimm wrote:To avoid the bug I now just uncommented the "DDE connection to an already active Audacity" (ca. line 1683 to line 1700 in AudacityApp.cpp):
Edgar wrote:...it is just not designed for multiple simultaneous instances.
Sorry, I chose the wrong english word: I meant "commented out the DDE connection" (it was "uncommented" before). So my Audacity is now less able to be opened more than once.
Trying to open Audacity twice now, gets me a message box with an error and no second project.
This was the quickest solution I could find.

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

Re: Expand Audacity

Post by Edgar » Mon Oct 17, 2011 5:23 pm

klimmbimm wrote: Sorry, I chose the wrong english word: I meant "commented out the DDE connection" (it was "uncommented" before).
I was aware of the (un)comment "typo" but my concern remains about commenting out those lines. There are serious but subtle problems when multiple copies of Audacity run at the same time.

There is a race condition bug in the code you comment out, reported here:
http://bugzilla.audacityteam.org/show_bug.cgi?id=219
which can lead to multiple copies of Audacity running at the same time. There is a thread (on -devel I think--the Audacity mailing list) with some discussion with pictures of TaskManager showing two Audacity running.

klimmbimm
Posts: 14
Joined: Thu Sep 22, 2011 9:25 am
Operating System: Please select

Re: Expand Audacity

Post by klimmbimm » Wed Oct 26, 2011 11:22 am

Thank you, Edgar. I'll keep that in mind and perhaps I'll try to fix this later.

Meanwhile I found another bug:
If the -saveAs and -open parameters are the same (which means that the opened file is saved under its own name), the replaced file seems to be empty.

Surprisingly I can avoid emptyness of the saved file by normalizing on load.

For that, I built in another CLI switch. It has to be called after -saveAs and -open:

Code: Select all

if (!handled && !wxString(wxT("-normalize")).CmpNoCase(argv[option])) {
    if (!project)
       project = CreateNewAudacityProject();
    project->SelectNone();
    project->SelectAllIfNone();
    project->OnEffect(ALL_EFFECTS | CONFIGURED_EFFECT,
              EffectManager::Get().GetEffectByIdentifier(wxT("Normalize")));
    handled = true;
}
Any idea?

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

Re: Expand Audacity

Post by Edgar » Wed Oct 26, 2011 6:04 pm

klimmbimm wrote: Meanwhile I found another bug:
If the -saveAs and -open parameters are the same (which means that the opened file is saved under its own name), the replaced file seems to be empty.

Surprisingly I can avoid emptyness of the saved file by normalizing on load.
I thought that problem had been addressed/fixed a couple of months ago. Are you working with a recent SVN HEAD? If not, You should go ahead and grab the most recent and port your changes. I just tested it here on SVN HEAD (but not via your CLI code) and do not experience this. If the problem persists for you let me know and I will try to test it here.
klimmbimm wrote:

Code: Select all

    project->OnEffect(ALL_EFFECTS | CONFIGURED_EFFECT,
              EffectManager::Get().GetEffectByIdentifier(wxT("Normalize")));
Thanks for pointing out GetEffectByIdentifier! I have been using a hard-coded numeric ID which could change if the Plug-ins folder's content changed. This may help me with some fine tuning I am currently doing on my "Personal Audacity".

klimmbimm
Posts: 14
Joined: Thu Sep 22, 2011 9:25 am
Operating System: Please select

Re: Expand Audacity

Post by klimmbimm » Fri Oct 28, 2011 7:01 am

Edgar wrote: I thought that problem had been addressed/fixed a couple of months ago. Are you working with a recent SVN HEAD?
No, I wasn't working with a recent SVN HEAD, but with the Audacity 1.3 release, I think. I'll try porting our changes next week and report my result.
Edgar wrote: Thanks for pointing out GetEffectByIdentifier! I have been using a hard-coded numeric ID which could change if the Plug-ins folder's content changed. This may help me with some fine tuning I am currently doing on my "Personal Audacity".
Nice to hear, that I could contribute at last. :D

Post Reply