commit 9edcefc1488054c01b1cc3643054210ef64d89f7
parent 47d7f67159fcccf5465162ebdfcf8109ba76bc93
Author: gstraube <gstraube@mailbox.org>
Date: Sun, 15 Oct 2017 13:16:52 +0200
Add Drop D tuning
Diffstat:
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/com/github/cythara/DropDTuning.java b/app/src/main/java/com/github/cythara/DropDTuning.java
@@ -0,0 +1,38 @@
+package com.github.cythara;
+
+class DropDTuning implements Tuning {
+
+ private enum Pitch implements com.github.cythara.Note {
+
+ D2(73.416f),
+ A2(110f),
+ D3(146.832f),
+ G3(195.998f),
+ B3(246.942f),
+ E4(329.628f);
+
+ private final float frequency;
+
+ Pitch(float frequency) {
+ this.frequency = frequency;
+ }
+
+ public String getName() {
+ return this.name();
+ }
+
+ public float getFrequency() {
+ return frequency;
+ }
+ }
+
+ @Override
+ public com.github.cythara.Note[] getNotes() {
+ return Pitch.values();
+ }
+
+ @Override
+ public com.github.cythara.Note findNote(String name) {
+ return Pitch.valueOf(name);
+ }
+}
diff --git a/app/src/main/java/com/github/cythara/TuningMapper.java b/app/src/main/java/com/github/cythara/TuningMapper.java
@@ -5,12 +5,15 @@ import android.util.Log;
class TuningMapper {
private static final int GUITAR_TUNING_POSITION = 0;
- private static final int UKULELE_TUNING_POSITION = 1;
+ private static final int DROP_D_TUNING_POSITION = 1;
+ private static final int UKULELE_TUNING_POSITION = 2;
static Tuning getTuningFromPosition(int position) {
switch (position) {
case GUITAR_TUNING_POSITION:
return new StandardTuning();
+ case DROP_D_TUNING_POSITION:
+ return new DropDTuning();
case UKULELE_TUNING_POSITION:
return new UkuleleTuning();
default:
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
@@ -1,7 +1,8 @@
<resources>
<string name="app_name">Cythara</string>
<string-array name="tunings">
- <item>Guitar</item>
+ <item>Guitar (standard)</item>
+ <item>Guitar (Drop D)</item>
<item>Ukulele</item>
</string-array>