Use note names rather then numbers
authorJelmer Vernooij <jelmer@samba.org>
Sun, 6 Mar 2005 19:30:04 +0000 (20:30 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 6 Mar 2005 19:30:04 +0000 (20:30 +0100)
ptb-tuning.c
ptb.h
ptbdict.c

index 3b297b4b3beb361815de770d9a1e671fa4475d5c..17a37e13a2abd761f08cacb53149fe83d6f50fb5 100644 (file)
@@ -120,6 +120,12 @@ int ptb_write_tuning_dict(const char *f, struct ptb_tuning_dict *t)
        return 0;
 }
 
+const char *ptb_tuning_get_note(char n)
+{
+       const char *notes[] = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
+       return notes[n%12];
+}
+
 void ptb_free_tuning_dict(struct ptb_tuning_dict *t)
 {
        int i;
diff --git a/ptb.h b/ptb.h
index 0daa459af54643e6d1d9bfd03c1cf0a15de43087..fce680a2f755e89e1e0f23427d6452f43fc1bee9 100644 (file)
--- a/ptb.h
+++ b/ptb.h
@@ -402,6 +402,7 @@ struct ptb_tuning_dict {
 extern struct ptb_tuning_dict *ptb_read_tuning_dict(const char *);
 extern int ptb_write_tuning_dict(const char *, struct ptb_tuning_dict *);
 extern void ptb_free_tuning_dict(struct ptb_tuning_dict *);
+extern const char *ptb_tuning_get_note(char);
 
 #ifdef __cplusplus
 }
index a398f8a3925b2d89687fa59de8c397efc60637ed..023ad09b5d6b4347b076aeb59a611283b21ba0ee 100644 (file)
--- a/ptbdict.c
+++ b/ptbdict.c
@@ -38,7 +38,7 @@ static void print_tuning(struct ptb_tuning *t, void *userdata)
        int j;
        printf("%s: ", t->name);
        for (j = 0; j < t->nr_strings; j++) {
-               printf("%d ", t->strings[j]);
+               printf("%s ", ptb_tuning_get_note(t->strings[j]));
        }
        printf("\n");
 }