Here are the examples of the java api org.zmpp.media.SoundSystem.play() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
Source : VariableInstruction.java
with Mozilla Public License 2.0
from sblendorio
with Mozilla Public License 2.0
from sblendorio
/**
* Implements the sound_effect instruction.
*/
private void sound_effect() {
// Choose some default values
int soundnum = SoundSystem.BLEEP_HIGH;
int effect = SoundSystem.EFFECT_START;
int volume = SoundSystem.VOLUME_DEFAULT;
int repeats = 0;
int routine = 0;
// Truly variable
// If no operands are set, this function will still try to send something
if (getNumOperands() >= 1) {
soundnum = getUnsignedValue(0);
}
if (getNumOperands() >= 2) {
effect = getUnsignedValue(1);
}
if (getNumOperands() >= 3) {
final int volumeRepeats = getUnsignedValue(2);
volume = volumeRepeats & 0xff;
repeats = (volumeRepeats >>> 8) & 0xff;
if (repeats <= 0) {
repeats = 1;
}
}
if (getNumOperands() == 4) {
routine = getUnsignedValue(3);
}
System.out.printf("@sound_effect n: %d, fx: %d, vol: %d, rep: %d, routine: $%04x\n", soundnum, effect, volume, repeats, routine);
// In version 3 repeats is always 1
if (getStoryFileVersion() == 3) {
repeats = 1;
}
final SoundSystem soundSystem = getMachine().getSoundSystem();
soundSystem.play(soundnum, effect, volume, repeats, routine);
nextInstruction();
}