Package jm.midi

Examples of jm.midi.MidiSynth


        if (e.getSource() == saveXML) saveXMLFile();
        if (e.getSource() == openXML) openXMLFile();
    }

    private void playScore() {
        MidiSynth ms = new MidiSynth();
        try {
            ms.play(score);
        } catch (Exception e) {
            System.err.println("MIDI Playback Error:" + e);
            return;
        }
    }
View Full Code Here


    @SuppressWarnings("unused")
    private static void initJMusicSynthesizer() {
        try {
            Field fld = ReflectionUtils.findField(Play.class, "ms");
            ReflectionUtils.makeAccessible(fld);
            MidiSynth synth = (MidiSynth) fld.get(null);
            // playing for the first time initializes the synthesizer
            try {
                synth.play(null);
            } catch (Exception ex){};
            Field synthField = ReflectionUtils.findField(MidiSynth.class, "m_synth");
            ReflectionUtils.makeAccessible(synthField);
            Synthesizer synthsizer = (Synthesizer) synthField.get(synth);
            loadSoundbankInstruments(synthsizer);
View Full Code Here

    }

    private static void msFill(int numb) {
        if (ms.size() < numb) {
            for (int i = ms.size(); i < numb; i++) {
                ms.add(new MidiSynth());
            }
        }
    }
View Full Code Here

     * @param synths The number of the MidiSynths to use - default is 1.
     */
    public static void midi(Score score, boolean exit, boolean wait, int synths, int decayAllowance) {
        System.out.println("jMusic Play: Playing score " + score.getTitle() + " using JavaSound General MIDI soundbank.");
        msFill(synths); // add instances of MidSynths if required
        MidiSynth currentMidiSynth = (MidiSynth) ms.elementAt(msCnt);
        if (currentMidiSynth.isPlaying()) currentMidiSynth.stop();
        try {
            currentMidiSynth.play(score);
            if (wait) {
                System.out.println("jMusic Play: Waiting for the end of " + score.getTitle() + ".");
                if (exit && decayAllowance == 0) { // allow reverb trail to end
                    waitCycle(score, 200);
                } else waitCycle(score, decayAllowance);
View Full Code Here

     * @param score The score to played back repeatedly.
     */
    public static void midiCycle(Score score, int index) {
        if (ms.size() < index + 1) {
            for (int i = ms.size(); i < index + 1; i++) {
                ms.addElement(new MidiSynth());
            }
            //ms.add(index, new MidiSynth());
        }
        if (cyclePlaying.size() < index + 1) {
            for (int i = cyclePlaying.size(); i < index + 1; i++) {
View Full Code Here

  public Play() {  }
 
  private static void msFill(int numb){
    if(ms.size() < numb) {
      for(int i=ms.size(); i<numb; i++){
        ms.add(new MidiSynth());
      }
    }
  }
View Full Code Here

  * @param synths The number of the MidiSynths to use - default is 1.
     */
  public static void midi(Score score, boolean exit, boolean wait, int synths, int decayAllowance) {
    System.out.println("jMusic Play: Playing score " + score.getTitle() + " using JavaSound General MIDI soundbank.");
    msFill(synths); // add instances of MidSynths if required
    MidiSynth currentMidiSynth = (MidiSynth) ms.elementAt(msCnt);
    if (currentMidiSynth.isPlaying()) currentMidiSynth.stop();
    try {
      currentMidiSynth.play(score);
      if (wait) {
        System.out.println("jMusic Play: Waiting for the end of "+ score.getTitle() + ".");
        if (exit && decayAllowance == 0) { // allow reverb trail to end
          waitCycle(score, 200);
        } else waitCycle(score, decayAllowance);
View Full Code Here

  * @param score The score to played back repeatedly.
     */
  public static void midiCycle(Score score, int index){
    if (ms.size() < index + 1) {
      for(int i=ms.size(); i < index + 1; i++) {
        ms.addElement(new MidiSynth());
      }
      //ms.add(index, new MidiSynth());
    }
    if (cyclePlaying.size() < index + 1) {
      for(int i=cyclePlaying.size(); i < index + 1; i++) {
View Full Code Here

TOP

Related Classes of jm.midi.MidiSynth

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.