world.sound.tunes
Class TuneCollection

java.lang.Object
  extended by world.sound.tunes.TuneCollection
All Implemented Interfaces:
SoundConstants

public class TuneCollection
extends java.lang.Object
implements SoundConstants

A collection of Notes/Tunes to be played on MIDI instruments, together with the MusicBox on which the Notes will be played. Based in part on a class originally designed by Viera K. Proulx.


Field Summary
 
Fields inherited from interface world.sound.tunes.SoundConstants
Accordion, AcousticBass, AcousticBassDrum, AcousticGrandPiano, AcousticGuitar_nylon, AcousticGuitar_steel, AcousticSnare, Agogo, AltoSax, Applause, APPLAUSE, Bagpipe, BAGPIPE, Banjo, BaritoneSax, BASS, BassDrum_1, Bassoon, BIRD_TWEET, BirdTweet, BlownBottle, BrassSection, BreathNoise, BrightAcousticPiano, Cabasa, Celesta, Cello, CELLO, ChineseCymbal, CHOIR, ChoirAahs, ChurchOrgan, Clarinet, Claves, Clavi, ClosedHiHat, Contrabass, Cowbell, CrashCymbal_1, CrashCymbal_2, DistortionGuitar, DrawbarOrgan, Dulcimer, ElectricBass_finger, ElectricBass_pick, ElectricGrandPiano, ElectricGuitar_clean, ElectricGuitar_jazz, ElectricGuitar_muted, ElectricPiano_1, ElectricPiano_2, ElectricSnare, EnglishHorn, Fiddle, Flute, FrenchHorn, FretlessBass, FX_1_rain, FX_2_soundtrack, FX_3_crystal, FX_4_atmosphere, FX_5_brightness, FX_6_goblins, FX_7_echoes, FX_8_scifi, Glockenspiel, GuitarFretNoise, GuitarHarmonics, Gunshot, HandClap, Harmonica, Harpsichord, Helicopter, HiBongo, HighAgogo, HighFloorTom, HighTimbale, HighTom, HiMidTom, HiWoodBlock, HonkyTonkPiano, INSTRUMENT_NAMES, INSTRUMENTS, Kalimba, Koto, Lead_1_square, Lead_2_sawtooth, Lead_3_calliope, Lead_4_chiff, Lead_5_charang, Lead_6_voice, Lead_7_fifths, Lead_8_basslead, LongGuiro, LongWhistle, LowAgogo, LowBongo, LowConga, LowFloorTom, LowMidTom, LowTimbale, LowTom, LowWoodBlock, Maracas, Marimba, MelodicTom, MusicBox, MuteCuica, MutedTrumpet, MuteHiConga, MuteTriangle, NoteA, NoteAp, NoteB, NoteC, NoteCp, NoteD, NoteDownA, NoteDownAp, NoteDownB, NoteDownC, NoteDownCp, NoteDownD, NoteDownDp, NoteDownE, NoteDownF, NoteDownFp, NoteDownG, NoteDownGp, NoteDp, NoteE, NoteF, NoteFp, NoteG, NoteGp, NoteUpA, NoteUpAp, NoteUpB, NoteUpC, NoteUpCp, NoteUpD, NoteUpDp, NoteUpE, NoteUpF, NoteUpFp, NoteUpG, NoteUpGp, Oboe, Ocarina, OpenCuica, OpenHiConga, OpenHiHat, OpenTriangle, OrchestraHit, OrchestralHarp, ORGAN, OverdrivenGuitar, Pad_1_newage, Pad_2_warm, Pad_3_polysynth, Pad_4_choir, Pad_5_bowed, Pad_6_metallic, Pad_7_halo, Pad_8_sweep, PanFlute, PedalHiHat, PERCUSSION, PercussiveOrgan, PIANO, Piccolo, PizzicatoStrings, Recorder, ReedOrgan, ReverseCymbal, RideBell, RideCymbal_2, RideCymbal1, RockOrgan, SAX, Seashore, SEASHORE, Shamisen, Shanai, ShortGuiro, ShortWhistle, SideStick, Sitar, Skakuhachi, SlapBass_1, SlapBass_2, SopranoSax, SplashCymbal, STEELDRUM, SteelDrums, StringEnsemble_1, StringEnsemble_2, SynthBass_1, SynthBass_2, SynthBrass_1, SynthBrass_2, SynthDrum, SynthStrings_1, SynthStrings_2, SynthVoice, TaikoDrum, Tambourine, TangoAccordion, TELEPHONE, TelephoneRing, TenorSax, Timpani, TinkleBell, TremoloStrings, Trombone, Trumpet, Tuba, TUBA, TubularBells, Vibraphone, Vibraslap, Viola, Violin, VIOLIN, VoiceOohs, Whistle, WOOD_BLOCK, Woodblock, Xylophone
 
Constructor Summary
TuneCollection(MusicBox musicBox)
          Create a TunCollection associated with the given MusicBox.
 
Method Summary
 void add(TuneCollection tb)
          Add all the Tunes/Chords form the given TuneCollection to this one.
 void addChord(int channel, Chord chord)
          Add the given Chord to the given Channel in this Collection.
 void addNote(int channel, int pitch)
          Add the Note represented by the given Pitch to the given Channel in this Collection.
 void addNote(int channel, Note note)
          Add the given Note to the given Channel in this Collection.
 void addNote(int channel, java.lang.String note)
          Add the Note represented by the given String to the given Channel in this Collection.
 void addTune(Tune tune)
          Add a given Tune/Chord to this Collection.
 void addTunes(java.lang.Iterable<Tune> tunes)
          Add a all given Tunes/Chords (Iterable) to this Collection.
 void clear()
          Stop playing notes and clear the Collection.
 void clearTunes()
          Clear all chords in this Collection
 boolean contains(int channel, int pitch)
          Does this TunCollection contain the given Pitch on the given Channel?
 boolean contains(int channel, Note note)
          Does this TunCollection contain the given Note on the given Channel?
 TuneCollection copy()
          Make a deep copy of this TuneCollection
 void initTunes()
          Initialize all the Channels to empty Tunes.
 void nextBeat()
          Stop playing the Notes/Chords when their duration has expired.
 void playTunes()
          Start playing all Tunes in this Collection
 int size()
          Computes the total number of Notes in this TuneCollection
 java.lang.String toString()
          Produce a String representation of this TunCollection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TuneCollection

public TuneCollection(MusicBox musicBox)
Create a TunCollection associated with the given MusicBox.

Method Detail

initTunes

public void initTunes()
Initialize all the Channels to empty Tunes.


add

public void add(TuneCollection tb)
Add all the Tunes/Chords form the given TuneCollection to this one.


addNote

public void addNote(int channel,
                    int pitch)
Add the Note represented by the given Pitch to the given Channel in this Collection.


addNote

public void addNote(int channel,
                    java.lang.String note)
Add the Note represented by the given String to the given Channel in this Collection.


addTunes

public void addTunes(java.lang.Iterable<Tune> tunes)
Add a all given Tunes/Chords (Iterable) to this Collection.


addTune

public void addTune(Tune tune)
Add a given Tune/Chord to this Collection.


addNote

public void addNote(int channel,
                    Note note)
Add the given Note to the given Channel in this Collection.


addChord

public void addChord(int channel,
                     Chord chord)
Add the given Chord to the given Channel in this Collection.


clear

public void clear()
Stop playing notes and clear the Collection.


clearTunes

public void clearTunes()
Clear all chords in this Collection


nextBeat

public void nextBeat()
Stop playing the Notes/Chords when their duration has expired.


playTunes

public void playTunes()
Start playing all Tunes in this Collection


copy

public TuneCollection copy()
Make a deep copy of this TuneCollection


size

public int size()
Computes the total number of Notes in this TuneCollection


contains

public boolean contains(int channel,
                        int pitch)
Does this TunCollection contain the given Pitch on the given Channel?


contains

public boolean contains(int channel,
                        Note note)
Does this TunCollection contain the given Note on the given Channel?


toString

public java.lang.String toString()
Produce a String representation of this TunCollection.

Overrides:
toString in class java.lang.Object