Code example for SoundPool

Methods: setRate

0
      int wait_stream_id = stream_id;
      stream_id = wait_stream_id_map.get(wait_stream_id);
      // Log.i("SetSoundPitch", "wait stream id " + wait_stream_id + " -> stream id " + stream_id); 
    } 
 
    sound_pool.setRate(stream_id, pitch);
  } 
   
  // public static void PlayBgm(String resource, float volume) 
  public static void PlayBgm(Activity activity, String resource, float volume)
  { 
    // Log.i("PlayBgm", "play bgm " + resource); 
     
    try 
    { 
      media_player.reset();
      media_player.setAudioStreamType(AudioManager.STREAM_MUSIC);
      media_player.setLooping(true);
      media_player.setVolume(volume, volume);
 
Contextual code suggestions in your IDE  Get Codota for Java