[Audacity-devel] Patch: Named tracks
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Nick L. <nj...@ec...> - 2002-06-27 02:30:18
|
Small patch at the bottom of this text to make track names persistent across saved sessions. Previously it worked in 1.0 but not in 1.1 diff -u -r1.10 LabelTrack.cpp --- LabelTrack.cpp 2 May 2002 09:55:17 -0000 1.10 +++ LabelTrack.cpp 27 Jun 2002 02:22:49 -0000 @@ -344,7 +344,9 @@ if (!value) return true; - if (!strcmp(attr, "numlabels")) { + if (!strcmp(attr, "name")) + name = value; + else if (!strcmp(attr, "numlabels")) { int len = atoi(value); mLabels.Clear(); mLabels.Alloc(len); @@ -373,6 +375,7 @@ for(j=0; j<depth; j++) fprintf(fp, "\t"); fprintf(fp, "<labeltrack "); + fprintf(fp, "name=\"%s\" ", name.c_str()); fprintf(fp, "numlabels=\"%d\">\n", len); for (i = 0; i < len; i++) { diff -u -r1.25 WaveTrack.cpp --- WaveTrack.cpp 13 Jun 2002 09:02:40 -0000 1.25 +++ WaveTrack.cpp 27 Jun 2002 02:22:49 -0000 @@ -778,6 +778,8 @@ wxString(value).ToDouble(&mRate); else if (!strcmp(attr, "offset")) wxString(value).ToDouble(&tOffset); + else if (!strcmp(attr, "name")) + name = value; else if (!strcmp(attr, "channel")) channel = atoi(value); else if (!strcmp(attr, "linked")) @@ -807,6 +809,7 @@ for(i=0; i<depth; i++) fprintf(fp, "\t"); fprintf(fp, "<wavetrack "); + fprintf(fp, "name=\"%s\" ", name.c_str()); fprintf(fp, "channel=\"%d\" ", channel); fprintf(fp, "linked=\"%d\" ", linked); fprintf(fp, "offset=\"%.8g\" ", tOffset); |