Package games.stendhal.client.sound.system

Examples of games.stendhal.client.sound.system.Time


    ClientSingletonRepository.getSound().update();
  }

  protected void playSound(String groupName, String soundName) {
    SoundGroup group = ClientSingletonRepository.getSound().getGroup(groupName);
    group.play(soundName, 0, mAudibleArea, new Time(), false, true);
  }
View Full Code Here


    group.play(soundName, 0, mAudibleArea, new Time(), false, true);
  }

  protected void playRandomSoundFromCategory(String groupName, String categoryName) {
    SoundGroup group = ClientSingletonRepository.getSound().getGroup(groupName);
    group.play(getRandomSoundFromCategory(categoryName), 0, mAudibleArea, new Time(), false, true);
  }
View Full Code Here

   */
  public boolean execute(final String[] params, final String remainder) {
    boolean play = Boolean.parseBoolean(WtWindowManager.getInstance().getProperty("sound.play", "true"));
    play = !play;
    WtWindowManager.getInstance().setProperty("sound.play", Boolean.toString(play));
    ClientSingletonRepository.getSound().mute(!play, true, new Time(2, Time.Unit.SEC));
    if (play) {
      ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("Sounds are now on."));
    } else {
      ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("Sounds are now off."));
    }
View Full Code Here

   */
  private class MuteListener implements ItemListener {
    public void itemStateChanged(ItemEvent e) {
      boolean soundOn = (e.getStateChange() == ItemEvent.SELECTED);
      WtWindowManager.getInstance().setProperty(SOUND_PROPERTY, Boolean.toString(soundOn));
      ClientSingletonRepository.getSound().mute(!soundOn, true, new Time(2, Time.Unit.SEC));
      for (JComponent comp : sliderComponents) {
        comp.setEnabled(soundOn);
      }
    }
View Full Code Here

    protected void modify(float[] data, int frames, int channels, int rate)
    {
        if(mState.get() != PLAY)
        {
            //Time delay        = new Time(mDelay.get(), Time.Unit.NANO);
            Time delaySegment = new Time(frames, rate);
            mDelay.addAndGet(-delaySegment.getInNanoSeconds());
        }

        super.propagate(data, frames, channels, rate);
    }
View Full Code Here

      // else if volume is 1 we propagate the unmodified audio data
        }
        else
        {
            Time fadingDuration  = new Time(mFadingDuration.get(), Time.Unit.NANO);
            Time segmentDuration = new Time(frames, rate);

            int   numSamples    = frames;
            float volume        = intToFloat(mCurrentVolume.get());
            float volumeSegment = intToFloat(mTargetVolume.get()) - intToFloat(mCurrentVolume.get());

            if(segmentDuration.getInNanoSeconds() > fadingDuration.getInNanoSeconds())
                numSamples = (int)fadingDuration.getInSamples(rate);
            else
                volumeSegment *= (float)((double)segmentDuration.getInNanoSeconds() / (double)fadingDuration.getInNanoSeconds());

            for(int i=0; i<numSamples; ++i)
            {
                int    index = i * channels;
                double vol   = volume + (volumeSegment * (float)i / (float)numSamples);

                for(int c=0; c<channels; ++c)
                    data[index + c] *= vol;
            }

            for(int i=(numSamples * channels); i<(frames * channels); ++i)
                data[i] *= volume + volumeSegment;

            mCurrentVolume.addAndGet(floatToInt(volumeSegment));
            mFadingDuration.addAndGet(-segmentDuration.getInNanoSeconds());
        }

        super.propagate(data, frames, channels, rate);
    }
View Full Code Here

    protected SoundManager()
    {
        Algebra.mov_Vecf(mHearerPosition, 0.0f);

    mSoundSystem = new SoundSystem(null, AUDIO_FORMAT, new Time(15, Time.Unit.MILLI), USE_NUM_MIXER_LINES);
    mSoundSystem.setDaemon(true);
    mSoundSystem.start();
    }
View Full Code Here

TOP

Related Classes of games.stendhal.client.sound.system.Time

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.