OpenGGuitarTuning.java (1071B)
1 package com.github.cythara.tuning; 2 3 import com.github.cythara.Note; 4 import com.github.cythara.NoteName; 5 import com.github.cythara.Tuning; 6 7 import static com.github.cythara.NoteName.*; 8 9 public class OpenGGuitarTuning implements Tuning { 10 11 @Override 12 public Note[] getNotes() { 13 return Pitch.values(); 14 } 15 16 @Override 17 public Note findNote(String name) { 18 return Pitch.valueOf(name); 19 } 20 21 private enum Pitch implements Note { 22 23 D2(D, 2), 24 G2(G, 2), 25 D3(D, 3), 26 G3(G, 3), 27 B3(B, 3), 28 D4(D, 4); 29 30 private final String sign; 31 private final int octave; 32 private NoteName name; 33 34 Pitch(NoteName name, int octave) { 35 this.name = name; 36 this.octave = octave; 37 this.sign = ""; 38 } 39 40 public NoteName getName() { 41 return name; 42 } 43 44 @Override 45 public int getOctave() { 46 return octave; 47 } 48 49 @Override 50 public String getSign() { 51 return sign; 52 } 53 } 54 }