Skip to content

Commit

Permalink
Addin -o and -s parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
BobanSpasic committed Nov 20, 2023
1 parent 07b79c2 commit 1235394
Show file tree
Hide file tree
Showing 9 changed files with 343 additions and 199 deletions.
3 changes: 1 addition & 2 deletions MDX_PerfConv.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<VersionInfo>
<UseVersionInfo Value="True"/>
<MajorVersionNr Value="1"/>
<MinorVersionNr Value="2"/>
<MinorVersionNr Value="3"/>
<StringTable FileDescription="Performance converter from DX7II, TX7, DX5 to MiniDexed" LegalCopyright="Boban Spasic" ProductName="MDX Performance Converter"/>
</VersionInfo>
<BuildModes>
Expand Down Expand Up @@ -103,7 +103,6 @@
<Unit>
<Filename Value="untDispatcher.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="untDispatcher_new"/>
</Unit>
<Unit>
<Filename Value="untConverter.pas"/>
Expand Down
40 changes: 33 additions & 7 deletions MDX_PerfConv.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ TMDX_PerfConv = class(TCustomApplication)
fVoiceB1: string;
fVoiceA2: string;
fVoiceB2: string;
fOutput: string;
fSettings: string;
iNumbering: integer;
fPerf: string;
slReport: TStringList;
Expand All @@ -64,8 +66,8 @@ TMDX_PerfConv = class(TCustomApplication)
bVerbose := False;
// quick check parameters
CaseSensitiveOptions := True;
ErrorMsg := CheckOptions('hica:b:A:B:p:n:v',
'help info convert voiceA1: voiceB1: voiceA2: voiceB2: perf: numbering: verbose');
ErrorMsg := CheckOptions('hica:b:A:B:p:n:vo:s:',
'help info convert voiceA1: voiceB1: voiceA2: voiceB2: perf: numbering: verbose output: settings:');

if ErrorMsg <> '' then
begin
Expand All @@ -84,6 +86,28 @@ TMDX_PerfConv = class(TCustomApplication)

if HasOption('v', 'verbose') then bVerbose := True;

if HasOption('o', 'output') then
begin
fOutput := GetOptionValue('o', 'output');
fOutput := IncludeTrailingPathDelimiter(fOutput);
fOutput := ExpandFileName(fOutput);
if bVerbose then WriteLn('Output directory: ' + fOutput);
if not DirectoryExists(fOutput) then CreateDir(fOutput);
end
else
begin
fOutput := GetOptionValue('a', 'voicea1');
fOutput := ExpandFileName(fOutput);
if bVerbose then WriteLn('Output directory: ' + fOutput);
fOutput := IncludeTrailingPathDelimiter(ExtractFileDir(fOutput));
end;

if HasOption('s', 'settings') then
begin
fSettings := GetOptionValue('s', 'settings');
fSettings := ExpandFileName(fSettings);
end;

if HasOption('n', 'numbering') then
iNumbering := (StrToIntDef(GetOptionValue('n', 'numbering'), 1) -1) else iNumbering := 0;
//The convert functions are already adding 1 for the first number
Expand Down Expand Up @@ -253,22 +277,22 @@ TMDX_PerfConv = class(TCustomApplication)
if FileExists(fVoiceA1) and FileExists(fVoiceB1) and
FileExists(fVoiceA2) and FileExists(fVoiceB2) and FileExists(fPerf) then
begin
DispatchCheck(fVoiceA1, fVoiceB1, fVoiceA2, fVoiceB2, fPerf, iNumbering, bVerbose);
DispatchCheck(fVoiceA1, fVoiceB1, fVoiceA2, fVoiceB2, fPerf, iNumbering, bVerbose, fOutput, fSettings);
end
else
if FileExists(fVoiceA1) and FileExists(fVoiceB1) and FileExists(fPerf) then
begin
DispatchCheck(fVoiceA1, fVoiceB1, fPerf, iNumbering, bVerbose);
DispatchCheck(fVoiceA1, fVoiceB1, fPerf, iNumbering, bVerbose, fOutput, fSettings);
end
else
if FileExists(fVoiceA1) and FileExists(fVoiceB1) then
begin
DispatchCheck(fVoiceA1, fVoiceB1, iNumbering, bVerbose);
DispatchCheck(fVoiceA1, fVoiceB1, iNumbering, bVerbose, fOutput, fSettings);
end
else
if FileExists(fVoiceA1) then
begin
DispatchCheck(fVoiceA1, iNumbering, bVerbose);
DispatchCheck(fVoiceA1, iNumbering, bVerbose, fOutput, fSettings);
end;
end;
end;
Expand Down Expand Up @@ -300,7 +324,7 @@ TMDX_PerfConv = class(TCustomApplication)
writeln(' -h --help This help message');
writeln(' -i --info Information');
writeln(' -c --convert Convert to MiniDexed INI file');
writeln(' -v --verbose more info while converting');
writeln(' -v --verbose Detailed info');
writeln('');
writeln(' -a (filename) --voiceA1=(filename) Path to voice bank A1');
writeln(' -b (filename) --voiceB1=(filename) Path to voice bank B1');
Expand All @@ -309,6 +333,8 @@ TMDX_PerfConv = class(TCustomApplication)
writeln(' -p (filename) --perf=(filename) Path to performance file');
writeln(' -n (number) --numbering=(number) First number for filenames');
writeln(' of the output performances');
writeln(' -o (path) --output=(path) Output directory');
writeln(' -s (filename) --settings=(filename) Use settings file (see separate doc.)');
writeLn('');
writeLn(' Parameters are CASE-SENSITIVE');
writeLn('');
Expand Down
Loading

0 comments on commit 1235394

Please sign in to comment.