class Octave_key {
public:
- Array<int> accidental_i_arr_;
-
- Octave_key();
- void set (int i, int acc);
- int acc (int i) const { return accidental_i_arr_[i]; }
+ Array<int> accidental_i_arr_;
+ void clear ();
+ Octave_key();
+ void set (int i, int acc);
+ int acc (int i) const { return accidental_i_arr_[i]; }
+ void print () const;
};
/// administration of accidentals
class Key
{
- /** for each octave a key. Has to be private since octave 0 isn't member 0.
- */
- Array<Octave_key> octaves;
+ /** for each octave a key. Has to be private since octave 0 isn't member 0.
+ */
+ Array<Octave_key> octaves;
public:
- bool multi_octave_b_;
-
- Octave_key&oct (int);
- void set (int name, int acc);
- void set (int oct, int name, int acc);
- Key();
+ bool multi_octave_b_;
+
+ void clear ();
+ Octave_key&oct (int);
+ void set (int name, int acc);
+ void set (int oct, int name, int acc);
+ Key();
+ void print () const;
};
#endif // KEY_HH
*/
#include "key.hh"
+#include "debug.hh"
const int OCTAVES=14; // ugh..
const int ZEROOCTAVE=7;
+
+void
+Octave_key::print () const
+{
+ for (int i= 0; i < 7 ; i++)
+ DOUT << "note " << i << " acc: " << accidental_i_arr_[i] << "\n";
+}
+
+
+
Octave_key::Octave_key()
{
accidental_i_arr_.set_size (7);
+ clear ();
+}
+
+void
+Octave_key::clear ()
+{
for (int i= 0; i < 7 ; i++)
- accidental_i_arr_[i] = 0;
+ accidental_i_arr_[i] = 0;
}
Key::Key()
Key::set (int n, int a)
{
for (int i= 0; i < OCTAVES ; i++)
- octaves[i].set (n,a);
+ octaves[i].set (n,a);
+}
+void
+Key::clear ()
+{
+ for (int i= 0; i < OCTAVES ; i++)
+ octaves[i].clear ();
+}
+void
+Key::print () const
+{
+ for (int i= 0; i < OCTAVES ; i++)
+ {
+ DOUT << "octave " << i - ZEROOCTAVE << " Octave_key { ";
+ octaves[i].print ();
+ DOUT << "}\n";
+ }
}