Interface MidiMixManager


public interface MidiMixManager
A service provider which manages the MidiMix instances associated to Songs and Rhythms.

  • Method Details

    • getDefault

      static MidiMixManager getDefault()
    • findRegisteredMix

      MidiMix findRegisteredMix(Song s)
      Find a mix previously registered.

      If you're not sure use createMix(org.jjazz.song.api.Song) instead.

      Parameters:
      s -
      Returns:
      Can't be null
      Throws:
      IllegalStateException - If no mix found
    • findMix

      Get a MidiMix for the specified song in the following order.

      1. If the mix for song s already exists, just return it
      2. Load mix from song mix file
      3. Create and register a new mix for s using createMix(org.jjazz.song.api.Song) for each song's rhythm

      Parameters:
      s -
      Returns:
      A valid MidiMix usable for the specified song.
      Throws:
      UnsupportedEditException - If there is not enough available channels to accomodate all song rhythms
    • findMix

      MidiMix findMix(Rhythm r)
      Try to get a MidiMix for the specified Rhythm in the following order:

      1. If the registered mix for rhythm r already exists, just return it
      2. Load mix from the default rhythm mix file
      3. Create and register a new mix for r using createMix(org.jjazz.rhythm.api.Rhythm)

      Parameters:
      r -
      Returns:
      Can't be null
    • createMix

      MidiMix createMix(Song sg) throws UnsupportedEditException
      Create and register a new MidiMix for the specified song.

      Use the default rhythm mix for each song's rhythm. Create UserRhythmVoices key if song as some user phrases.

      Parameters:
      sg -
      Returns:
      Throws:
      UnsupportedEditException - If there is not enough available channels to accomodate all song rhythms
    • createMix

      MidiMix createMix(Rhythm r)
      Create and register a MidiMix for the specified rhythm.

      Create one InstrumentMix per rhythm voice, using rhythm voice's preferred instrument and settings, and preferred channel (except if several voices share the same preferred channel) .

      Parameters:
      r - If r is
      Returns:
      A MidiMix associated to this rhythm. Rhythm voices are used as keys for InstrumentMixes.
    • getChannelsNeedingDrumsRerouting

      List<Integer> getChannelsNeedingDrumsRerouting(MidiMix midiMix, Map<Integer, Instrument> mapChannelNewIns)
      Get the midiMix channels which need drums rerouting.

      A channel needs rerouting if all the following conditions are met:
      0/ InsMix at MidiConst.CHANNEL_DRUMS has its instrument Midi message enabled
      1/ channel != MidiConst.CHANNEL_DRUMS
      2/ rv.isDrums() == true and rerouting is not already enabled
      3/ instrument (or new instrument if one is provided in the mapChannelNewIns parameter) is the VoidInstrument

      Parameters:
      midiMix -
      mapChannelNewIns - Optional channel instruments to be used for the exercise. Ignored if null. See OutputSynth.getNeedFixInstruments().
      Returns:
      Can be empty
    • importInstrumentMixes

      void importInstrumentMixes(MidiMix midiMixDest, MidiMix midiMixSrc)
      Import InstrumentMixes from mmSrc to mmDest.

      Import is first done on matching RhythmVoices from the same rhythm. Then import only when RvTypes match. For UserRhythmVoices import is done only if name matches.
      Create new copy instances of Instruments Mixes with solo OFF.

      Parameters:
      midiMixDest -
      midiMixSrc -
    • getRhythmMix

      MidiMix getRhythmMix(MidiMix midiMix, Rhythm r)
      Build a rhythm MidiMix from a song MidiMix.
      Parameters:
      midiMix -
      r -
      Returns:
      Can be empty if midiMix does not use r
    • getDeepCopy

      MidiMix getDeepCopy(MidiMix midiMix, Song song)
      Get a deep copy of midiMix.

      Parameters:
      midiMix -
      song - If not null, the returned instance is registered with this song (caller is responsible to provide a song consistent with midiMix).
      Returns: