auditory.described
Class Note

java.lang.Object
  extended by auditory.described.AbstractContent
      extended by auditory.described.Note
All Implemented Interfaces:
Content

public class Note
extends AbstractContent

An encapsulation of a single note in a song

See Also:
"The Design and Implementation of Multimedia Software © 2011"

Field Summary
 
Fields inherited from class auditory.described.AbstractContent
audible, dotted, playing, type
 
Constructor Summary
Note()
          Default Constructor Constructs a whole note at middle C
Note(char pitch, boolean sharp, int octave, int type, boolean dotted)
          Explicit Value Constructor
 
Method Summary
 int getMIDI()
          Get the MIDI number associated with this Note
protected  void startPlaying(javax.sound.midi.MidiChannel channel)
          Start playing this Note on the given MidiChannel
protected  void stopPlaying(javax.sound.midi.MidiChannel channel)
          Start playing this Note on the given MidiChannel
 
Methods inherited from class auditory.described.AbstractContent
getType, isDotted, render, setAudible, setDotted, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Note

public Note()
Default Constructor Constructs a whole note at middle C


Note

public Note(char pitch,
            boolean sharp,
            int octave,
            int type,
            boolean dotted)
Explicit Value Constructor

Parameters:
pitch - The pitch ('A','B','C','D','E','F', 'G' or 'R')
sharp - true for a sharp and false for a natural
octave - The octave (relative to middle C)
type - 1 for whole notes, 2 for half notes, etc...
dotted - Whether the note is dotted
Method Detail

getMIDI

public int getMIDI()
Get the MIDI number associated with this Note

Returns:
The MIDI number

startPlaying

protected void startPlaying(javax.sound.midi.MidiChannel channel)
Start playing this Note on the given MidiChannel

Specified by:
startPlaying in class AbstractContent
Parameters:
channel - The MIDI channel to use

stopPlaying

protected void stopPlaying(javax.sound.midi.MidiChannel channel)
Start playing this Note on the given MidiChannel

Specified by:
stopPlaying in class AbstractContent
Parameters:
channel - The MIDI channel to use


Design and Implementation of Multimedia Software, Jones and Bartlett Publishers