Quantcast

Left/Right Sound Channels

Discussion in 'Google TV General Discussion' started by Yaqami, Dec 24, 2012.

  1. Yaqami

    Yaqami New Member

    Joined:
    Dec 24, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Such Problem: I have video file recorded with two sound channels. I have tried to switch off left sound channel by this code:


    Code:
    [COLOR=#2B91AF]Videoview[/COLOR] vv;
    ............... 
           vv.setOnPreparedListener([COLOR=#00008B]new[/COLOR] [COLOR=#2B91AF]OnPreparedListener[/COLOR]() { 
               [COLOR=#800000]@Override[/COLOR]            [COLOR=#00008B]public[/COLOR] [COLOR=#00008B]void[/COLOR] onPrepared([COLOR=#2B91AF]MediaPlayer[/COLOR] mp) { 
                   mp.setVolume([COLOR=#800000]0.f[/COLOR], [COLOR=#800000]1f[/COLOR]); 
               } 
           });

    ... and on Tablet this work good (right volume channel sounds well). But then I tried it on googleTv and this code did not work, sound swichs off; mp.setVolume(1.f,0.f) - has no effect, sound continues playing in both channels.


    Then I tried this:
    Code:
    [COLOR=#00008B]
    public[/COLOR] [COLOR=#00008B]class[/COLOR] [COLOR=#2B91AF]MainActivity[/COLOR] [COLOR=#00008B]extends[/COLOR] [COLOR=#2B91AF]Activity[/COLOR] { 
       [COLOR=#2B91AF]MediaPlayer[/COLOR] mp = [COLOR=#00008B]null[/COLOR]; 
       [COLOR=#800000]@Override[/COLOR]    [COLOR=#00008B]protected[/COLOR] [COLOR=#00008B]void[/COLOR] onCreate([COLOR=#2B91AF]Bundle[/COLOR] savedInstanceState) { 
           [COLOR=#00008B]super[/COLOR].onCreate(savedInstanceState); 
           setContentView(R.layout.activity_main); 
           [COLOR=#00008B]if[/COLOR] (mp != [COLOR=#00008B]null[/COLOR]) { 
               mp.reset(); 
               mp.release(); 
           } 
           mp = [COLOR=#2B91AF]MediaPlayer[/COLOR].create([COLOR=#00008B]this[/COLOR], R.raw.test); 
           mp.start(); 
       } 
       [COLOR=#00008B]public[/COLOR] [COLOR=#00008B]void[/COLOR] onTurnOffLeft([COLOR=#2B91AF]View[/COLOR] v){ 
           mp.setVolume([COLOR=#800000]0.f[/COLOR], [COLOR=#800000]1.f[/COLOR]); 
       } 
       [COLOR=#00008B]public[/COLOR] [COLOR=#00008B]void[/COLOR] onTurnOffRight([COLOR=#2B91AF]View[/COLOR] v){ 
           mp.setVolume([COLOR=#800000]1.f[/COLOR], [COLOR=#800000]0.f[/COLOR]); 
       }
    }
    Method onTurnOffLeft switchs off all sound, and onTurnOffRight method has no effect.

    I have tested on Visio Co-Star, and Logitech Revue google tv boxes with
    Optical and HDMI cables.

    First I thougth the problem is in hdmi cable, but a have tried to connect lenovo tablet to TV through hdmi cable, and experiment with swithing off sound channels finished with success. So, I need help with this problem. Any ideas would be helpfull. Thank you.


     
    Last edited: Dec 26, 2012
  2. Yaqami

    Yaqami New Member

    Joined:
    Dec 24, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Using .ogg audio file codded with Vorbis codec - method "setVolume" works well.Video files codded with mp3, ac3, pcm, aac - method "setVolume" not working correctly.
     

Share This Page