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

This commit is contained in:
Starbeamrainbowlabs 2017-12-02 16:59:52 +00:00
parent b80c5bba6c
commit f71e215b61
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
3 changed files with 36 additions and 2 deletions

View file

@ -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"
}
);
}
}

View file

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

View file

@ -38,7 +38,6 @@ namespace MusicBoxConverter
Vector2 size = area.Add(offset.Multiply(2)); Vector2 size = area.Add(offset.Multiply(2));
SvgWriter svg = new SvgWriter(destinationFilename, size.X.ToString(), size.Y.ToString()); SvgWriter svg = new SvgWriter(destinationFilename, size.X.ToString(), size.Y.ToString());
Console.WriteLine(0b1111111);
for(int i = 0; i < 127; i += 5) for(int i = 0; i < 127; i += 5)
{ {
Vector2 start = offset.Add(new Vector2(0, i * scaleFactor.Y)); Vector2 start = offset.Add(new Vector2(0, i * scaleFactor.Y));
@ -48,7 +47,7 @@ namespace MusicBoxConverter
foreach(Note note in AllNotes()) 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( svg.WriteCircle(
new Vector2( new Vector2(
offset.X + note.Time * scaleFactor.X, offset.X + note.Time * scaleFactor.X,