public void playSoundOnetime(SoundDescriptor sd) { Sound snd = new Sound(sd); snd.transient = true; snd.play(); }
public void transitionMusic(SoundDescriptor music, double transitionTime) { //cleanup if we transition before we're done with a transition if (myNextMusic != null) { if (music.source.filename != myNextMusic.source.filename) { myNextMusic.stop(); myNextMusic = null; } else { return; //don't transition to the same song } } //don't transition to the same song if (myCurrentMusic != null && myCurrentMusic.source.filename == music.source.filename) { return; } //transition to new song Sound snd = new Sound(music); myNextMusic = snd; myNextMusic.volume = 0.0f; myNextMusic.play(); myMusicTransitionTime = transitionTime; myCurrentMusicTransitionTime = 0.0; }
public void update(double dt) { pitch.update(dt); volume.update(dt); sound.pitch = pitch.currentVal; sound.volume = soundscape.volume * volume.currentVal; sound.play(); }
public void playSoundOneTime(string filename, Vector3 pos, bool relative, Vector3 vel, float falloffDistance, AbstractAudio.Priority priority) { SoundDescriptor desc = new SoundDescriptor(); desc.filename = filename; desc.is3d = true; desc.isLooping = false; desc.priority = priority; Sound snd = new Sound(desc); snd.position = pos; snd.velocity = vel; snd.relativePosition = relative; snd.transient = true; snd.play(); }
public void update(double dt) { nextTime -= (float)dt; if (nextTime <= 0.0f) { Random rand = new Random(); nextTime = rand.randomInRange(minDelay, maxDelay); Vector3 pos = new Vector3( rand.randomInRange(0.0f, maxRange[0]), rand.randomInRange(0.0f, maxRange[1]), rand.randomInRange(0.0f, maxRange[2]) ); sound.position = pos; sound.pitch = rand.randomInRange(minPitch, maxPitch); sound.volume = soundscape.volume; sound.play(); } }