-1

How do I select only the cap left or right and then play the selected sound to the headset?

halfer
  • 19,824
  • 17
  • 99
  • 186
Mario
  • 9
  • 2
  • 1
    Your question is unclear. Are you trying to play to only one channel (left or right) of a connected headset? If so, what are you using to play the sound effect? – Kevin Coppock May 05 '14 at 23:10
  • You've got it! I want to play as the sound of "beep" to the right headphones but not to the left or to play the sound from the headphones to the left but not the right one. I need this because the purpose of my application is to verify the degree of hearing deafness. Thank you and I hope that I have made ​​it clear. – Mario May 05 '14 at 23:19

1 Answers1

1

Assuming SoundPool is okay, you can use:

SoundPool pool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0);
pool.play(
        pool.load(this, R.raw.my_sound_effect, 1), // The sound effect to play
        0, // The volume for the left channel (0.0 - 1.0)
        1.0f, // The volume for the right channel (0.0 - 1.0)
        0, // Default priority 
        0, // Do not loop
        1.0f); // Playback rate (1.0f == normal)
Kevin Coppock
  • 133,643
  • 45
  • 263
  • 274