Re: [Audacity-devel] Scripting for Opening/Saving projects and bug 137
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Martyn S. <mar...@gm...> - 2011-12-24 01:05:36
|
Hi Michael On 22/12/2011 15:06, Michael Chinen wrote: > Hi Martyn, > > On Thu, Dec 22, 2011 at 9:50 AM, Martyn Shaw<mar...@gm...> wrote: >> Hi Michael >> >> Sounds good but I applied the patch and have problems, having removed your >> previous patch(es). Can you supply one against HEAD please? Even when I >> replaced OpenFileCommand.* files from a previous version I am getting linker >> errors relating to SetCurrentProjectCommandType > > Sorry for the troubles, and thanks for trying to use it. > It actually is against HEAD, but I forgot to say that for windows you > will need to add the new files created by the patch > SetCurrentProjectCommand.cpp/h to the solution (and likewise to the > Makefile for linux). Thanks, I have it going now. I have made it go from one project to another, copying a bit from near the end of one and pasting it randomly into the other, then copying from the end of that and pasting back to the first, trying to replicate the problems reported in 137. The only time I had a problem was when my disk was full. I'd like to replicate the processes involved in making 137 show, but of course nobody knows what they are. Code I'm using below, probably not the neatest perl, but it's a while since I did any. TTFN Martyn > Michael if ($ARGV[0] eq '') { print "usage: ./orphantest_multiproj.pl </path/to/some.aup> </path/to/some/other.aup> <number of iterations>\n"; print "eg:\n./orphantest_multiproj.pl ~/Documents/someproj.aup ~/Documents/someproj2.aup 10000"; print "note: killing the perl script will probably crash audacity so pick a reasonable numberof iterations (start small)."; } else { my $projname0; my $projname1; my @resp; my $startTime; my $endTime; my $len; my $startT; my $endT; openProject($ARGV[1]); # get the projectname $projname1 = $ARGV[1];#getCurrentProjectName(); openProject($ARGV[0]); #this puts the first project on top. $projname0 = $ARGV[0]; #getCurrentProjectName(); for (my $i = 1; $i <= $iters; $i++) { print "iteration $i of $iters\n"; # Copy a random bit of the last 5% of the first project and paste into the second. switchToProject($projname0); sendCommand("GetTrackInfo: Type=StartTime TrackIndex=0"); @resp = getResponses(); $startTime = shift(@resp); sendCommand("GetTrackInfo: Type=EndTime TrackIndex=0"); @resp = getResponses(); $endTime = shift(@resp); $len = $endTime - $startTime; $len *= 95.0/100.0; # 5% of track $startT = ($startTime + $len) + rand($endTime - ($startTime + $len)); #start at random in last 5% of track $endT = $startT + rand($endTime - $startT); #end sometime after start doCommand("Select: Mode=Range StartTime=$startT EndTime=$endT FirstTrack=0 LastTrack=0"); doCommand("MenuCommand: CommandName=Copy"); #copy a bit from the end of the track # Paste into somewhere in the other track switchToProject($projname1); sendCommand("GetTrackInfo: Type=StartTime TrackIndex=0"); @resp = getResponses(); $startTime = shift(@resp); sendCommand("GetTrackInfo: Type=EndTime TrackIndex=0"); @resp = getResponses(); $endTime = shift(@resp); $startT = $startTime + rand($endTime - $startTime); doCommand("Select: Mode=Range StartTime=$startT EndTime=$startT FirstTrack=0 LastTrack=0"); #select a random point to paste doCommand("MenuCommand: CommandName=Paste"); saveProject(); # Now do the same in the other direction. We already know the startTime, but it will now be longer sendCommand("GetTrackInfo: Type=EndTime TrackIndex=0"); @resp = getResponses(); $endTime = shift(@resp); $len = $endTime - $startTime; $len *= 95.0/100.0; # 5% of track $startT = ($startTime + $len) + rand($endTime - ($startTime + $len)); #start at random in last 5% of track $endT = $startT + rand($endTime - $startT); #end sometime after start doCommand("Select: Mode=Range StartTime=$startT EndTime=$endT FirstTrack=0 LastTrack=0"); doCommand("MenuCommand: CommandName=Copy"); #copy a bit from the end of the track switchToProject($projname0); sendCommand("GetTrackInfo: Type=StartTime TrackIndex=0"); $startTime = getResponses(); sendCommand("GetTrackInfo: Type=EndTime TrackIndex=0"); @resp = getResponses(); $endTime = shift(@resp); $startT = $startTime + rand($endTime - $startTime); doCommand("Select: Mode=Range StartTime=$startT EndTime=$startT FirstTrack=0 LastTrack=0"); doCommand("MenuCommand: CommandName=Paste"); saveProject(); } #clean up by closing the projects so this script can be run again error free. closeProject(); closeProject(); } |