Add ScaleFactorX/Y control CLI arguments
This commit is contained in:
parent
9d2590e7c8
commit
85dce8acec
3 changed files with 30 additions and 0 deletions
|
@ -10,5 +10,7 @@ Options:
|
||||||
-h --help Shows this help message.
|
-h --help Shows this help message.
|
||||||
-i --input {filename} Specifies the input midi file to convert.
|
-i --input {filename} Specifies the input midi file to convert.
|
||||||
-o --output {filename} Specifies the file path to output the SVG music box strip to.
|
-o --output {filename} Specifies the file path to output the SVG music box strip to.
|
||||||
|
-sx --scale-factor-x Sets the X scale factor. Defaults to 0.03.
|
||||||
|
-sy --scale-factor-y Sets the Y scale factor. Defaults to 0.03.
|
||||||
--box {Note30|Note30Corrected} The music box schema to use when rendering. Default: Note30Corrected.
|
--box {Note30|Note30Corrected} The music box schema to use when rendering. Default: Note30Corrected.
|
||||||
--debug Activates additional debugging output.
|
--debug Activates additional debugging output.
|
||||||
|
|
|
@ -66,8 +66,21 @@ namespace MusicBoxConverter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetScaleFactorX(float scaleFactorX) {
|
||||||
|
Vector2 newScaleFactor = ScaleFactor;
|
||||||
|
newScaleFactor.X = scaleFactorX;
|
||||||
|
ScaleFactor = newScaleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetScaleFactorY(float scaleFactorY) {
|
||||||
|
Vector2 newScaleFactor = ScaleFactor;
|
||||||
|
newScaleFactor.Y = scaleFactorY;
|
||||||
|
ScaleFactor = newScaleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
public void Output(string destinationFilename)
|
public void Output(string destinationFilename)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"DEBUG SF {ScaleFactor}");
|
||||||
Vector2 area = new Vector2(TrackLength, SelectedMusicBox.NoteCount-1).Multiply(ScaleFactor);
|
Vector2 area = new Vector2(TrackLength, SelectedMusicBox.NoteCount-1).Multiply(ScaleFactor);
|
||||||
Vector2 size = area.Add(Offset.Multiply(2));
|
Vector2 size = area.Add(Offset.Multiply(2));
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@ namespace MusicBoxConverter
|
||||||
string outputFilename = "";
|
string outputFilename = "";
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
MusicBox targetMusicBox = MusicBox.Note30Corrected;
|
MusicBox targetMusicBox = MusicBox.Note30Corrected;
|
||||||
|
float scaleFactorX = 0.03f;
|
||||||
|
float scaleFactorY = 4.0f;
|
||||||
|
|
||||||
for(int i = 0; i < args.Length; i++)
|
for(int i = 0; i < args.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -52,6 +54,16 @@ namespace MusicBoxConverter
|
||||||
).GetValue(null);
|
).GetValue(null);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "-sx":
|
||||||
|
case "--scale-factor-x":
|
||||||
|
scaleFactorX = float.Parse(args[++i], CultureInfo.InvariantCulture);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "-sy":
|
||||||
|
case "--scale-factor-y":
|
||||||
|
scaleFactorY = float.Parse(args[++i], CultureInfo.InvariantCulture);
|
||||||
|
break;
|
||||||
|
|
||||||
case "-h":
|
case "-h":
|
||||||
case "--help":
|
case "--help":
|
||||||
Console.Error.WriteLine(EmbeddedFiles.ReadAllText("MusicBoxConverter.Help.txt"));
|
Console.Error.WriteLine(EmbeddedFiles.ReadAllText("MusicBoxConverter.Help.txt"));
|
||||||
|
@ -78,6 +90,9 @@ namespace MusicBoxConverter
|
||||||
) {
|
) {
|
||||||
Debug = debug
|
Debug = debug
|
||||||
};
|
};
|
||||||
|
|
||||||
|
converter.SetScaleFactorX(scaleFactorX);
|
||||||
|
converter.SetScaleFactorY(scaleFactorY);
|
||||||
converter.Output(outputFilename);
|
converter.Output(outputFilename);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue