plectrum

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

BanjoTuning.java (1047B)


      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 BanjoTuning 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         G4(G, 4),
     24         D3(D, 3),
     25         G3(G, 3),
     26         B3(B, 3),
     27         D4(D, 4);
     28 
     29         private final String sign;
     30         private final int octave;
     31         private NoteName name;
     32 
     33         Pitch(NoteName name, int octave) {
     34             this.name = name;
     35             this.octave = octave;
     36             this.sign = "";
     37         }
     38 
     39         public NoteName getName() {
     40             return name;
     41         }
     42 
     43         @Override
     44         public int getOctave() {
     45             return octave;
     46         }
     47 
     48         @Override
     49         public String getSign() {
     50             return sign;
     51         }
     52     }
     53 }