12
12
Third aspect (not yet implemented) will be the conversion from VMEM to VCED and vice-versa.
13
13
14
14
ToDo:
15
- - get voice list
16
15
- conversion VMEM <> VCED
17
16
- duplicate finder along a collection of files
18
17
}
24
23
uses
25
24
{ $IFDEF UNIX}
26
25
cthreads,
27
- { $ENDIF}
26
+ { $ENDIF}
28
27
Classes,
29
28
SysUtils,
30
29
CustApp,
31
- untUtils, untDXUtils,
30
+ untUtils,
31
+ untDXUtils,
32
32
untDXObjInterface;
33
33
34
34
type
@@ -55,10 +55,12 @@ TMDX_Tool = class(TCustomApplication)
55
55
msInputFile: TMemoryStream;
56
56
i: integer;
57
57
iStartPos: integer;
58
+ iDmpPos: integer;
58
59
begin
59
60
fInput := ' ' ;
60
61
// quick check parameters
61
- ErrorMsg := CheckOptions(' hirvcsxjf:d:' , ' help info repair voices crop split xsplit join file: dir:' );
62
+ ErrorMsg := CheckOptions(' himnrvcsxjf:d:' ,
63
+ ' help info hname vname repair voices crop split xsplit join file: dir:' );
62
64
63
65
if ErrorMsg <> ' ' then
64
66
begin
@@ -117,20 +119,56 @@ TMDX_Tool = class(TCustomApplication)
117
119
msInputFile := TMemoryStream.Create;
118
120
msInputFile.LoadFromFile(fInput);
119
121
iStartPos := 0 ;
122
+ iDmpPos := 0 ;
120
123
121
124
if ContainsDX_SixOP_Data_New(msInputFile, iStartPos, slReport) then
122
125
begin
123
-
126
+ for i := 0 to slReport.Count - 1 do
127
+ WriteLn(slReport[i]);
128
+ iStartPos := 0 ;
129
+ if ContainsDX7BankDump(msInputFile, iStartPos, iDmpPos) then
130
+ if CheckIntegrity(msInputFile, iDmpPos) then
131
+ WriteLn(' VMEM data integrity is OK' );
132
+ end
133
+ else
134
+ begin
135
+ for i := 0 to slReport.Count - 1 do
136
+ WriteLn(slReport[i]);
124
137
end ;
125
138
126
- for i := 0 to slReport.Count - 1 do
127
- WriteLn(slReport[i]);
128
-
129
139
msInputFile.Free;
130
140
slReport.Free;
131
141
end ;
132
142
end ;
133
143
144
+ if HasOption(' m' , ' hname' ) then
145
+ begin
146
+ if not FileExists(fInput) then
147
+ begin
148
+ WriteLn(' Parameter -f {filename} is missing or the file {filename} could not be found' );
149
+ Terminate;
150
+ Exit;
151
+ end
152
+ else
153
+ begin
154
+ Hash2Name(fInput);
155
+ end ;
156
+ end ;
157
+
158
+ if HasOption(' n' , ' vname' ) then
159
+ begin
160
+ if not FileExists(fInput) then
161
+ begin
162
+ WriteLn(' Parameter -f {filename} is missing or the file {filename} could not be found' );
163
+ Terminate;
164
+ Exit;
165
+ end
166
+ else
167
+ begin
168
+ Voice2Name(fInput);
169
+ end ;
170
+ end ;
171
+
134
172
if HasOption(' v' , ' voices' ) then
135
173
begin
136
174
if not FileExists(fInput) then
@@ -192,10 +230,11 @@ TMDX_Tool = class(TCustomApplication)
192
230
end
193
231
else
194
232
begin
195
- fOutputDir :=IncludeTrailingPathDelimiter(GetOptionValue(' d' , ' outdir' ));
196
- if pos(' :\' , fOutputDir) = 0 then fOutputDir := IncludeTrailingPathDelimiter(GetCurrentDir) + fOutputDir;
233
+ fOutputDir := IncludeTrailingPathDelimiter(GetOptionValue(' d' , ' outdir' ));
234
+ if pos(' :\' , fOutputDir) = 0 then
235
+ fOutputDir := IncludeTrailingPathDelimiter(GetCurrentDir) + fOutputDir;
197
236
if not DirectoryExists(fOutputDir) then
198
- ForceDirectories(fOutputDir);
237
+ ForceDirectories(fOutputDir);
199
238
msInputFile := TMemoryStream.Create;
200
239
msInputFile.LoadFromFile(fInput);
201
240
@@ -225,10 +264,11 @@ TMDX_Tool = class(TCustomApplication)
225
264
end
226
265
else
227
266
begin
228
- fOutputDir :=IncludeTrailingPathDelimiter(GetOptionValue(' d' , ' outdir' ));
229
- if pos(' :\' , fOutputDir) = 0 then fOutputDir := IncludeTrailingPathDelimiter(GetCurrentDir) + fOutputDir;
267
+ fOutputDir := IncludeTrailingPathDelimiter(GetOptionValue(' d' , ' outdir' ));
268
+ if pos(' :\' , fOutputDir) = 0 then
269
+ fOutputDir := IncludeTrailingPathDelimiter(GetCurrentDir) + fOutputDir;
230
270
if not DirectoryExists(fOutputDir) then
231
- ForceDirectories(fOutputDir);
271
+ ForceDirectories(fOutputDir);
232
272
msInputFile := TMemoryStream.Create;
233
273
msInputFile.LoadFromFile(fInput);
234
274
@@ -240,10 +280,11 @@ TMDX_Tool = class(TCustomApplication)
240
280
end ;
241
281
end ;
242
282
243
- if HasOption(' j' , ' join' ) then
283
+ if HasOption(' j' , ' join' ) then
244
284
begin
245
- fOutputDir :=IncludeTrailingPathDelimiter(GetOptionValue(' d' , ' dir' ));
246
- if pos(' :\' , fOutputDir) = 0 then fOutputDir := IncludeTrailingPathDelimiter(GetCurrentDir) + fOutputDir;
285
+ fOutputDir := IncludeTrailingPathDelimiter(GetOptionValue(' d' , ' dir' ));
286
+ if pos(' :\' , fOutputDir) = 0 then
287
+ fOutputDir := IncludeTrailingPathDelimiter(GetCurrentDir) + fOutputDir;
247
288
if not DirectoryExists(fOutputDir) then
248
289
begin
249
290
WriteLn(' Parameter -d {directory} is missing or the directory could not be found' );
@@ -284,14 +325,16 @@ TMDX_Tool = class(TCustomApplication)
284
325
begin
285
326
writeln(' ' );
286
327
writeln(' ' );
287
- writeln(' MDX_Tool 1.2 - tool for various manipulation of DX7 VMEM and VCED SysEx files' );
328
+ writeln(' MDX_Tool 1.4 - tool for various manipulation of DX7 VMEM and VCED SysEx files' );
288
329
writeln(' Author: Boban Spasic' );
289
330
writeln(' https://github.com/BobanSpasic/MDX_Tool' );
290
331
writeln(' ' );
291
332
writeln(' Usage: ' , ExtractFileName(ExeName), ' -parameters' );
292
333
writeln(' Parameters (short and long form):' );
293
334
writeln(' -h --help This help message' );
294
335
writeln(' -i --info Information' );
336
+ writeln(' -n --vname Rename file to the name of the contained voice' );
337
+ writeln(' -m --hname Rename file to the SHA2-256 hash of the file' );
295
338
writeln(' -r --repair Repair/extract DX7 VMEM data from files' );
296
339
writeln(' -c --crop Crop headers from the VMEM/VCED files' );
297
340
writeln(' -s --split Split bank (VMEM) into single voices (VCED)' );
0 commit comments