Android Open Source - Music-Theory Clef






From Project

Back to project page Music-Theory.

License

The source code is released under:

GNU General Public License

If you think the Android project Music-Theory listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.mt.theory;
/*from   ww w.j a  v a 2s .com*/
import com.mt.R;

public enum Clef {
  ALTO("Alto", 4, Tone.C, R.drawable.clef_c, 0.50f, 28, 34, 26, 32),
  BASS("Bass", 3, Tone.D, R.drawable.clef_bass, 0.64f, 21, 27, 19, 25),
  TENOR("Tenor", 4, Tone.A, R.drawable.clef_c, 0.75f, 26, 32, 26, 32),
  TREBLE("Treble", 5, Tone.B, R.drawable.clef_treble, 0.49f, 35, 41, 33, 39);

  private int drawableResourceId;
  private String keySuffix;
  private int maxFlatKeyPosition;
  private int maxSharpKeyPosition;
  private int middleOctave;

  private Tone middleTone;
  private int minFlatKeyPosition;
  private int minSharpKeyPosition;
  private float ratioAboveMiddle;

  private Clef(String keySuffix, int middleOctave, Tone middleTone, int drawableResourceId, float ratioAboveMiddle,
      int minSharpKeyPosition, int maxSharpKeyPosition, int minFlatKeyPosition, int maxFlatKeyPosition) {
    this.keySuffix = keySuffix;
    this.middleOctave = middleOctave;
    this.middleTone = middleTone;
    this.drawableResourceId = drawableResourceId;
    this.ratioAboveMiddle = ratioAboveMiddle;
    this.minFlatKeyPosition = minFlatKeyPosition;
    this.minSharpKeyPosition = minSharpKeyPosition;
    this.maxFlatKeyPosition = maxFlatKeyPosition;
    this.maxSharpKeyPosition = maxSharpKeyPosition;
  }

  public String getKeySuffix() {
    return keySuffix;
  }

  public int getMaxFlatKeyPosition() {
    return maxFlatKeyPosition;
  }

  public int getMaxSharpKeyPosition() {
    return maxSharpKeyPosition;
  }

  /**
   * Gets the octave of the note situated on the center line of a staff in
   * this particular clef
   * 
   * @return
   */
  public int getMiddleOctave() {
    return middleOctave;
  }

  /**
   * Gets the tone of the note situated on the center line of a staff in this
   * particular clef
   * 
   * @return
   */
  public Tone getMiddleTone() {
    return middleTone;
  }

  public int getMinFlatKeyPosition() {
    return minFlatKeyPosition;
  }

  public int getMinSharpKeyPosition() {
    return minSharpKeyPosition;
  }

  /**
   * Gets the proportion of a clefs vertical height that should appear above
   * the middle line of the staff
   * 
   * @return
   */
  public float getRatioAboveMiddle() {
    return ratioAboveMiddle;
  }

  public int getResourceId() {
    return drawableResourceId;
  }

}




Java Source Code List

com.mt.HomeActivity.java
com.mt.QuizActivity.java
com.mt.audio.MidiTrack.java
com.mt.keys.KeySignatureQuizActivity.java
com.mt.keys.KeySignatureQuizPreferenceActivity.java
com.mt.notes.NoteQuizActivity.java
com.mt.notes.NoteQuizPreferenceActivity.java
com.mt.staff.ScoreView.java
com.mt.theory.Accidental.java
com.mt.theory.Clef.java
com.mt.theory.Duration.java
com.mt.theory.Interval.java
com.mt.theory.KeySignature.java
com.mt.theory.NoteGroup.java
com.mt.theory.Note.java
com.mt.theory.Quality.java
com.mt.theory.Score.java
com.mt.theory.TimeSignature.java
com.mt.theory.Tone.java
com.mt.utils.NoteUtil.java
com.mt.utils.QuizUtil.java