45{
46 wxString line;
47 wxString kind;
48
49 kind = (*f)[f->GetCurrentLine()];
50
51 if (kind ==
wxT(
"WaveTrack")) {
54
55 wxString channel = f->GetNextLine();
56 if (channel ==
wxT(
"left")) {
58 line = f->GetNextLine();
59 }
60 else if (channel ==
wxT(
"right")) {
62 line = f->GetNextLine();
63 }
64 else if (channel ==
wxT(
"mono")) {
66 line = f->GetNextLine();
67 }
68 else {
70 line = channel;
71 }
72
73 if (line ==
wxT(
"linked")) {
75 line = f->GetNextLine();
76 }
77
78 if (line !=
wxT(
"offset"))
79 return false;
81
82 long envLen;
83
84 if (f->GetNextLine() !=
wxT(
"EnvNumPoints"))
85 return false;
86 line = f->GetNextLine();
87 line.ToLong(&envLen);
88 if (envLen < 0 || envLen > 10000)
89 return false;
90
91 size_t envStart = f->GetCurrentLine();
92 if (f->GetLineCount() < envStart+(2*envLen)+1)
93 return false;
94
95 f->GoToLine(envStart+(2*envLen));
96 if (f->GetNextLine() !=
wxT(
"EnvEnd"))
97 return false;
98 if (f->GetNextLine() !=
wxT(
"numSamples"))
99 return false;
100
101 wxString numSamples = f->GetNextLine();
102
103 if (f->GetNextLine() !=
wxT(
"rate"))
104 return false;
105
107
108 if (envLen > 0) {
111
112 long i;
113 for(i=0; i<envLen; i++) {
115 xmlFile.
WriteAttr(
wxT(
"t"), f->GetLine(envStart + 2*i + 1));
116 xmlFile.
WriteAttr(
wxT(
"val"), f->GetLine(envStart + 2*i + 2));
118 }
119
121 }
122
123 if (f->GetNextLine() !=
wxT(
"numBlocks"))
124 return false;
125 long numBlocks;
126 line = f->GetNextLine();
127 line.ToLong(&numBlocks);
128
129 if (numBlocks < 0 || numBlocks > 131072)
130 return false;
131
136
137 long b;
138 for(b=0; b<numBlocks; b++) {
139 wxString start;
140 wxString len;
142
143 if (f->GetNextLine() !=
wxT(
"Block start"))
144 return false;
145 start = f->GetNextLine();
146 if (f->GetNextLine() !=
wxT(
"Block len"))
147 return false;
148 len = f->GetNextLine();
149 if (f->GetNextLine() !=
wxT(
"Block info"))
150 return false;
151 name = f->GetNextLine();
152
155
158 wxString aliasPath = f->GetNextLine();
159 wxString localLen = f->GetNextLine();
160 wxString aliasStart = f->GetNextLine();
161 wxString aliasLen = f->GetNextLine();
162 wxString aliasChannel = f->GetNextLine();
163 wxString localName = f->GetNextLine();
164
168
169
171
176 }
177 else {
182 }
184
186 }
187
190
191 return true;
192 }
193 else if (kind ==
wxT(
"LabelTrack")) {
194 line = f->GetNextLine();
195 if (line !=
wxT(
"NumMLabels"))
196 return false;
197
198 long numLabels, l;
199
200 line = f->GetNextLine();
201 line.ToLong(&numLabels);
202 if (numLabels < 0 || numLabels > 1000000)
203 return false;
204
208
209 for(l=0; l<numLabels; l++) {
211
212 t = f->GetNextLine();
213 title = f->GetNextLine();
214
219 }
220
222
223 line = f->GetNextLine();
224 if (line !=
wxT(
"MLabelsEnd"))
225 return false;
226
227 return true;
228 }
229 else if (kind ==
wxT(
"NoteTrack")) {
230
231
232 do {
233 line = f->GetNextLine();
234 if (line ==
wxT(
"WaveTrack") ||
235 line ==
wxT(
"NoteTrack") ||
236 line ==
wxT(
"LabelTrack") ||
237 line ==
wxT(
"EndTracks")) {
238 f->GoToLine(f->GetCurrentLine()-1);
239 return true;
240 }
241 } while (f->GetCurrentLine() < f->GetLineCount());
242
243 return false;
244 }
245 else
246 return false;
247}
virtual void StartTag(const wxString &name)
void WriteAttr(const wxString &name, const Identifier &value)
virtual void EndTag(const wxString &name)