Skip to content

Commit 32fd484

Browse files
committed
Config option to define middle C
Closes #74
1 parent 51e9b02 commit 32fd484

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

VG Music Studio/Config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PanpotIndicators: False # True or False
55
PlaylistMode: "Random" # "Random" or "Sequential" # The way the playlist will behave
66
PlaylistSongLoops: 0 # Loops >= 0 and Loops <= 9223372036854775807 # How many times a song should loop before fading out
77
PlaylistFadeOutMilliseconds: 10000 # Milliseconds >= 0 and Milliseconds <= 9223372036854775807 # How many milliseconds it should take to fade out of a song
8+
MiddleCOctave: 5 # Octave >= --128 and Octave <= 127 # The octave that holds middle C. Used in the visual and track viewer
89
Colors:
910
0: {H: 185, S: 240, L: 180}
1011
1: {H: 183, S: 240, L: 170}

VG Music Studio/Core/GlobalConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ internal sealed class GlobalConfig
2424
public readonly PlaylistMode PlaylistMode;
2525
public readonly long PlaylistSongLoops;
2626
public readonly long PlaylistFadeOutMilliseconds;
27+
public readonly sbyte MiddleCOctave;
2728
public readonly HSLColor[] Colors;
2829

2930
private GlobalConfig()
@@ -44,6 +45,7 @@ private GlobalConfig()
4445
PlaylistMode = mapping.GetValidEnum<PlaylistMode>(nameof(PlaylistMode));
4546
PlaylistSongLoops = mapping.GetValidValue(nameof(PlaylistSongLoops), 0, long.MaxValue);
4647
PlaylistFadeOutMilliseconds = mapping.GetValidValue(nameof(PlaylistFadeOutMilliseconds), 0, long.MaxValue);
48+
MiddleCOctave = (sbyte)mapping.GetValidValue(nameof(MiddleCOctave), sbyte.MinValue, sbyte.MaxValue);
4749

4850
var cmap = (YamlMappingNode)mapping.Children[nameof(Colors)];
4951
Colors = new HSLColor[256];

VG Music Studio/Util/Utils.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Kermalis.VGMusicStudio.Properties;
1+
using Kermalis.VGMusicStudio.Core;
2+
using Kermalis.VGMusicStudio.Properties;
23
using System;
34
using System.Collections.Generic;
45
using System.Globalization;
@@ -141,7 +142,7 @@ public static string GetPianoKeyName(int key)
141142
}
142143
public static string GetNoteName(int key)
143144
{
144-
return _notes[key % 12] + ((key / 12) - 2);
145+
return _notes[key % 12] + ((key / 12) + (GlobalConfig.Instance.MiddleCOctave - 5));
145146
}
146147

147148
public static string CombineWithBaseDirectory(string path)

0 commit comments

Comments
 (0)