1 /**
2 * Copyright © Underground Rekordz 2019
3 * License: MIT (https://github.com/UndergroundRekordz/Musicpulator/blob/master/LICENSE)
4 * Author: Jacob Jensen (bausshf)
5 */
6 module musicpulator.musicalnote;
7 
8 /// Enumeration around music notes.
9 enum MusicalNote : string
10 {
11   /// The Cb note.
12   cFlat = "Cb",
13   /// The C note.
14   c = "C",
15   /// The C# note.
16   cSharp = "C#",
17   /// The Db note.
18   dFlat = "Db",
19   /// The D note.
20   d = "D",
21   /// The D# note.
22   dSharp = "D#",
23   /// The Eb note.
24   eFlat = "Eb",
25   /// The E note.
26   e = "E",
27   /// The F note.
28   f = "F",
29   /// The F# note.
30   fSharp = "F#",
31   /// The Gb note.
32   gFlat = "Gb",
33   /// The G note.
34   g = "G",
35   /// The G# note.
36   gSharp = "G#",
37   /// The Ab note.
38   aFlat = "Ab",
39   /// The A note.
40   a = "A",
41   /// The A# note.
42   aSharp = "A#",
43   /// The Bb note.
44   bFlat = "Bb",
45   /// The B note.
46   b = "B"
47 }
48 
49 /// Converts a note to json.
50 string toJson(MusicalNote note)
51 {
52   import std.string : format;
53 
54   return `"%s"`.format(cast(string)note);
55 }
56 
57 /// Converts a note to xml.
58 string toXml(MusicalNote note)
59 {
60   return note;
61 }