src/java.desktop/share/classes/com/sun/media/sound/SoftMainMixer.java

Print this page




  36 import javax.sound.midi.Patch;
  37 import javax.sound.midi.ShortMessage;
  38 import javax.sound.sampled.AudioInputStream;
  39 import javax.sound.sampled.AudioSystem;
  40 
  41 /**
  42  * Software synthesizer main audio mixer.
  43  *
  44  * @author Karl Helgason
  45  */
  46 public final class SoftMainMixer {
  47 
  48     // A private class thats contains a ModelChannelMixer and it's private buffers.
  49     // This becomes necessary when we want to have separate delay buffers for each channel mixer.
  50     private class SoftChannelMixerContainer
  51     {
  52         ModelChannelMixer mixer;
  53         SoftAudioBuffer[] buffers;
  54     }
  55 
  56     public final static int CHANNEL_LEFT = 0;
  57     public final static int CHANNEL_RIGHT = 1;
  58     public final static int CHANNEL_MONO = 2;
  59     public final static int CHANNEL_DELAY_LEFT = 3;
  60     public final static int CHANNEL_DELAY_RIGHT = 4;
  61     public final static int CHANNEL_DELAY_MONO = 5;
  62     public final static int CHANNEL_EFFECT1 = 6;
  63     public final static int CHANNEL_EFFECT2 = 7;
  64     public final static int CHANNEL_DELAY_EFFECT1 = 8;
  65     public final static int CHANNEL_DELAY_EFFECT2 = 9;
  66     public final static int CHANNEL_LEFT_DRY = 10;
  67     public final static int CHANNEL_RIGHT_DRY = 11;
  68     public final static int CHANNEL_SCRATCH1 = 12;
  69     public final static int CHANNEL_SCRATCH2 = 13;
  70     boolean active_sensing_on = false;
  71     private long msec_last_activity = -1;
  72     private boolean pusher_silent = false;
  73     private int pusher_silent_count = 0;
  74     private long sample_pos = 0;
  75     boolean readfully = true;
  76     private final Object control_mutex;
  77     private SoftSynthesizer synth;
  78     private float samplerate = 44100;
  79     private int nrofchannels = 2;
  80     private SoftVoice[] voicestatus = null;
  81     private SoftAudioBuffer[] buffers;
  82     private SoftReverb reverb;
  83     private SoftAudioProcessor chorus;
  84     private SoftAudioProcessor agc;
  85     private long msec_buffer_len = 0;
  86     private int buffer_len = 0;
  87     TreeMap<Long, Object> midimessages = new TreeMap<Long, Object>();
  88     private int delay_midievent = 0;
  89     private int max_delay_midievent = 0;




  36 import javax.sound.midi.Patch;
  37 import javax.sound.midi.ShortMessage;
  38 import javax.sound.sampled.AudioInputStream;
  39 import javax.sound.sampled.AudioSystem;
  40 
  41 /**
  42  * Software synthesizer main audio mixer.
  43  *
  44  * @author Karl Helgason
  45  */
  46 public final class SoftMainMixer {
  47 
  48     // A private class thats contains a ModelChannelMixer and it's private buffers.
  49     // This becomes necessary when we want to have separate delay buffers for each channel mixer.
  50     private class SoftChannelMixerContainer
  51     {
  52         ModelChannelMixer mixer;
  53         SoftAudioBuffer[] buffers;
  54     }
  55 
  56     public static final int CHANNEL_LEFT = 0;
  57     public static final int CHANNEL_RIGHT = 1;
  58     public static final int CHANNEL_MONO = 2;
  59     public static final int CHANNEL_DELAY_LEFT = 3;
  60     public static final int CHANNEL_DELAY_RIGHT = 4;
  61     public static final int CHANNEL_DELAY_MONO = 5;
  62     public static final int CHANNEL_EFFECT1 = 6;
  63     public static final int CHANNEL_EFFECT2 = 7;
  64     public static final int CHANNEL_DELAY_EFFECT1 = 8;
  65     public static final int CHANNEL_DELAY_EFFECT2 = 9;
  66     public static final int CHANNEL_LEFT_DRY = 10;
  67     public static final int CHANNEL_RIGHT_DRY = 11;
  68     public static final int CHANNEL_SCRATCH1 = 12;
  69     public static final int CHANNEL_SCRATCH2 = 13;
  70     boolean active_sensing_on = false;
  71     private long msec_last_activity = -1;
  72     private boolean pusher_silent = false;
  73     private int pusher_silent_count = 0;
  74     private long sample_pos = 0;
  75     boolean readfully = true;
  76     private final Object control_mutex;
  77     private SoftSynthesizer synth;
  78     private float samplerate = 44100;
  79     private int nrofchannels = 2;
  80     private SoftVoice[] voicestatus = null;
  81     private SoftAudioBuffer[] buffers;
  82     private SoftReverb reverb;
  83     private SoftAudioProcessor chorus;
  84     private SoftAudioProcessor agc;
  85     private long msec_buffer_len = 0;
  86     private int buffer_len = 0;
  87     TreeMap<Long, Object> midimessages = new TreeMap<Long, Object>();
  88     private int delay_midievent = 0;
  89     private int max_delay_midievent = 0;