本文整理汇总了Java中com.sun.media.sound.ModelChannelMixer类的典型用法代码示例。如果您正苦于以下问题:Java ModelChannelMixer类的具体用法?Java ModelChannelMixer怎么用?Java ModelChannelMixer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelChannelMixer类属于com.sun.media.sound包,在下文中一共展示了ModelChannelMixer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTestSoundbankWithChannelMixer
import com.sun.media.sound.ModelChannelMixer; //导入依赖的package包/类
public static Soundbank createTestSoundbankWithChannelMixer() {
SF2Soundbank soundbank = createTestSoundbank();
SimpleSoundbank simplesoundbank = new SimpleSoundbank();
SimpleInstrument simpleinstrument = new SimpleInstrument() {
public ModelChannelMixer getChannelMixer(MidiChannel channel,
AudioFormat format) {
return new ModelAbstractChannelMixer() {
boolean active = true;
public boolean process(float[][] buffer, int offset, int len) {
for (int i = 0; i < buffer.length; i++) {
float[] cbuffer = buffer[i];
for (int j = 0; j < cbuffer.length; j++) {
cbuffer[j] = -cbuffer[j];
}
}
return active;
}
public void stop() {
active = false;
}
};
}
};
simpleinstrument.add(soundbank.getInstruments()[0]);
simplesoundbank.addInstrument(simpleinstrument);
return simplesoundbank;
}
示例2: stopMixer
import com.sun.media.sound.ModelChannelMixer; //导入依赖的package包/类
public void stopMixer(ModelChannelMixer mixer) {
if (stoppedMixers == null)
stoppedMixers = new HashSet<ModelChannelMixer>();
stoppedMixers.add(mixer);
}
示例3: registerMixer
import com.sun.media.sound.ModelChannelMixer; //导入依赖的package包/类
public void registerMixer(ModelChannelMixer mixer) {
if (registeredMixers == null)
registeredMixers = new HashSet<ModelChannelMixer>();
registeredMixers.add(mixer);
cur_registeredMixers = null;
}
示例4: initVoice
import com.sun.media.sound.ModelChannelMixer; //导入依赖的package包/类
protected void initVoice(SoftVoice voice, SoftPerformer p, int voiceID,
int noteNumber, int velocity, ModelConnectionBlock[] connectionBlocks,
ModelChannelMixer channelmixer, boolean releaseTriggered) {
if (voice.active) {
// Voice is active , we must steal the voice
voice.stealer_channel = this;
voice.stealer_performer = p;
voice.stealer_voiceID = voiceID;
voice.stealer_noteNumber = noteNumber;
voice.stealer_velocity = velocity;
voice.stealer_extendedConnectionBlocks = connectionBlocks;
voice.stealer_channelmixer = channelmixer;
voice.stealer_releaseTriggered = releaseTriggered;
for (int i = 0; i < voices.length; i++)
if (voices[i].active && voices[i].voiceID == voice.voiceID)
voices[i].soundOff();
return;
}
voice.extendedConnectionBlocks = connectionBlocks;
voice.channelmixer = channelmixer;
voice.releaseTriggered = releaseTriggered;
voice.voiceID = voiceID;
voice.tuning = tuning;
voice.exclusiveClass = p.exclusiveClass;
voice.softchannel = this;
voice.channel = channel;
voice.bank = bank;
voice.program = program;
voice.instrument = current_instrument;
voice.performer = p;
voice.objects.clear();
voice.objects.put("midi", co_midi[noteNumber]);
voice.objects.put("midi_cc", co_midi_cc);
voice.objects.put("midi_rpn", co_midi_rpn);
voice.objects.put("midi_nrpn", co_midi_nrpn);
voice.noteOn(noteNumber, velocity);
voice.setMute(mute);
voice.setSoloMute(solomute);
if (releaseTriggered)
return;
if (portamento_control_note != -1) {
voice.co_noteon_keynumber[0]
= (tuning.getTuning(portamento_control_note) / 100.0)
* (1f / 128f);
voice.portamento = true;
portamento_control_note = -1;
} else if (portamento) {
if (mono) {
if (portamento_lastnote[0] != -1) {
voice.co_noteon_keynumber[0]
= (tuning.getTuning(portamento_lastnote[0]) / 100.0)
* (1f / 128f);
voice.portamento = true;
portamento_control_note = -1;
}
portamento_lastnote[0] = noteNumber;
} else {
if (portamento_lastnote_ix != 0) {
portamento_lastnote_ix--;
voice.co_noteon_keynumber[0]
= (tuning.getTuning(
portamento_lastnote[portamento_lastnote_ix])
/ 100.0)
* (1f / 128f);
voice.portamento = true;
}
}
}
}