plectrum

Plectrum: instrument tuner for Android
Log | Files | Refs | README | LICENSE

GuitarTuning.java (1065B)


      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 GuitarTuning 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     public enum Pitch implements Note {
     22 
     23         E4(E, 4),
     24         B3(B, 3),
     25         G3(G, 3),
     26         D3(D, 3),
     27         A2(A, 2),
     28         E2(E, 2);
     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 }