Control audio file sound
<p>I am playing a beep sound for the last 5 seconds on a Timer.</p>

<p>I want to regulate the volume of the audio file with the volume keys of the mobile device.</p>

<p>I am currently using the android.media.SoundPool class to play the two audio files used for the Timer.</p>

<p>I am using the following method to play the sound:</p>

<pre><code>public static void playSound(int index, float speed) {
        float streamVolume = mAudioManager
                .getStreamVolume(AudioManager.STREAM_MUSIC);
        streamVolume = streamVolume
                / mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
        mSoundPool.play(mSoundPoolMap.get(index), 1, 1,
                1, 0, speed);
    }
</code></pre>

<p>Currently I am able to play both the audio files but want to control with the mobile device volume keys.</p>

<p>Kindly provide your inputs/sample code.</p>

<p>Thanks in advance.</p>

<p>Warm Regards,</p>

<p>CB</p>
