plectrum

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

ViolaTuning.java (1029B)


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