Browse Source

Add MusicBox class for note validation, but it doesn't work yet

main
Starbeamrainbowlabs 4 years ago
parent
commit
f71e215b61
Signed by: sbrl GPG Key ID: 1BE5172E637709C2
  1. 34
      MusicBoxConverter/MusicBox.cs
  2. 1
      MusicBoxConverter/MusicBoxConverter.csproj
  3. 3
      MusicBoxConverter/MusicBoxScoreGenerator.cs

34
MusicBoxConverter/MusicBox.cs

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
namespace MusicBoxConverter
{
public class MusicBox
{
public List<string> ValidNotes { get; private set; }
private MusicBox(List<string> inValidNotes)
{
ValidNotes = inValidNotes;
}
public bool IsValidNote(string noteName)
{
throw new NotImplementedException();
}
/// <summary>
/// A 30 note music box.
/// @Starbeamrainbowlabs has one of these - it was the part of the
/// inspiration for the whole project!
/// </summary>
public static MusicBox Note30 = new MusicBox(
new List<string>() {
"G3",
"C4", "D4", "E4", "F4", "G4", "A4", "A#4", "B4",
"C5", "C#5", "D5", "D#5", "E5", "F5", "F#5", "G5", "G#5", "A5", "A#5", "B5",
"C6", "C#6", "D6", "D#6", "E6", "F6", "F#6", "G6", "A6"
}
);
}
}

1
MusicBoxConverter/MusicBoxConverter.csproj

@ -41,6 +41,7 @@
<Compile Include="MusicBoxScoreGenerator.cs" />
<Compile Include="SvgWriter.cs" />
<Compile Include="Utilities\Vector2.cs" />
<Compile Include="MusicBox.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

3
MusicBoxConverter/MusicBoxScoreGenerator.cs

@ -38,7 +38,6 @@ namespace MusicBoxConverter
Vector2 size = area.Add(offset.Multiply(2));
SvgWriter svg = new SvgWriter(destinationFilename, size.X.ToString(), size.Y.ToString());
Console.WriteLine(0b1111111);
for(int i = 0; i < 127; i += 5)
{
Vector2 start = offset.Add(new Vector2(0, i * scaleFactor.Y));
@ -48,7 +47,7 @@ namespace MusicBoxConverter
foreach(Note note in AllNotes())
{
Console.WriteLine("[{0}] {1}/{2}", note.Time, note.NoteName, note.NoteNumber);
Console.WriteLine("[{0}] {1}{2}/{3}", note.Time, note.NoteName, note.Octave, note.NoteNumber);
svg.WriteCircle(
new Vector2(
offset.X + note.Time * scaleFactor.X,

Loading…
Cancel
Save