]> git.cworth.org Git - scherzo/blobdiff - scherzo-key.h
Move key-signature code to new scherzo-key.c and scherzo-key.h
[scherzo] / scherzo-key.h
diff --git a/scherzo-key.h b/scherzo-key.h
new file mode 100644 (file)
index 0000000..07cdd70
--- /dev/null
@@ -0,0 +1,44 @@
+/* scherzo - Music notation training
+ *
+ *     key.h - Common structures and functions for keys
+ *
+ * Copyright © 2013 Carl Worth
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/ .
+ */
+
+#include <stdbool.h>
+
+#ifndef SCHERZO_KEY_H
+#define SCHERZO_KEY_H
+
+#include "pitch.h"
+
+typedef struct scherzo_key
+{
+    /* Pitch class (diatonic) */
+    pitch_t pitch;
+
+    /* Number of sharps/flats in key (if any) */
+    int num_sharps;
+    int num_flats;
+} scherzo_key_t;
+
+void
+scherzo_key_init (scherzo_key_t *key, pitch_t pitch);
+
+bool
+scherzo_key_contains_pitch (scherzo_key_t *key, pitch_t pitch);
+
+#endif /* KEY_H */