commit 981cc7b86c00004ac29e8cd057658ae813f48098
parent 2ade437953b082928300c04b476853cf620aafdc
Author: Daveed9 <21017248+Daveed9@users.noreply.github.com>
Date: Thu, 21 Feb 2019 08:28:09 -0500
Added viola tuning
Diffstat:
1 file changed, 58 insertions(+), 0 deletions(-)
diff --git a/app/src/main/java/com/github/cythara/tuning/ViolaTuning.java b/app/src/main/java/com/github/cythara/tuning/ViolaTuning.java
@@ -0,0 +1,58 @@
+package com.github.cythara.tuning;
+
+import com.github.cythara.Note;
+import com.github.cythara.NoteName;
+import com.github.cythara.Tuning;
+
+import static com.github.cythara.NoteName.*;
+
+public class ViolaTuning implements Tuning {
+
+ @Override
+ public Note[] getNotes() {
+ return Pitch.values();
+ }
+
+ @Override
+ public Note findNote(String name) {
+ return Pitch.valueOf(name);
+ }
+
+ private enum Pitch implements Note {
+
+ C3(C, 3, 130.81f),
+ G3(G, 3, 196.00f),
+ D4(D, 4, 293.66f),
+ A4(A, 4, 440.00f);
+
+ private final String sign;
+ private final int octave;
+ private final float frequency;
+ private NoteName name;
+
+ Pitch(NoteName name, int octave, float frequency) {
+ this.name = name;
+ this.octave = octave;
+ this.sign = "";
+ this.frequency = frequency;
+ }
+
+ public NoteName getName() {
+ return name;
+ }
+
+ public float getFrequency() {
+ return frequency;
+ }
+
+ @Override
+ public int getOctave() {
+ return octave;
+ }
+
+ @Override
+ public String getSign() {
+ return sign;
+ }
+ }
+}