本文介绍了体积沟道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这样的问题:我有记录的两声道的视频文件。我想这个code关掉左声道:

Such Problem: I have video file recorded with two sound channels. I tried to switch off left sound channel by this code:

MediaPlayer mp;

....

mp.setVolume(0.f, 1f);

...和平板这项工作好(右通道音量的声音很好)。但后来我想它是在Google,我连接到​​三星UE46ES6307U这code没有工作,声音swichs关闭。
也许是界限,以杜比数字+ /杜比睿波音频?我可以采用某种编程发现如何声道设备都有,什么量在每个chanels setuped?

... and on Tablet this work good (right volume channel sounds well). But then I tried it on googleTv which I connect to Samsung UE46ES6307U and this code did not work, sound swichs off.Maybe it is bounds to Dolby Digital Plus / Dolby Pulse audio? Can I somehow programmatically discover how sound channels device has, and what volume in each chanels setuped?

更新:
在这个论坛上的在回复一条这样的消息:罗技还没有想出如何管的多声道音频直通hdmi.you必须使用光纤输出这是OK。

Update:On this forum http://www.googletvforum.org/forum/logitech-revue/375-audio-problems-logitech-revue.html in one of replies such message: "Logitech has not yet figured out how to pipe multichannel audio thru hdmi.you have to use the optical output. Which is ok."

你是如何构建的MediaPlayer?

Videoview vv;
...............

        vv.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setVolume(0.f, 1f);
            }
        });

更新:

public class MainActivity extends Activity {
    MediaPlayer mp = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if (mp != null) {
            mp.reset();
            mp.release();
        }

        mp = MediaPlayer.create(this, R.raw.test);
        mp.start();

    }

    public void onTurnOffLeft(View v){
        mp.setVolume(0.f, 1.f);
    }

    public void onTurnOffRight(View v){
        mp.setVolume(1.f, 0.f);
    }
}

方法onTurnOffLeft交换机关闭所有声音,onTurnOffRight方法没有效果。

Method onTurnOffLeft switchs off all sound, and onTurnOffRight method has no effect.

UPDATE2

我试着玩Vorbis的codeC codded .OGG音频文件 - 通道关闭好。但我试图发挥codded与MP3,AC3,PCM,AAC格式的视频文件 - 和问题,关闭通道仍然存在......我需要关闭视频音频通道,而是如何解决这个问题,我不知道然而。

I tried to play .ogg audio file codded with Vorbis codec - channels turns off well. But I tried to play video files codded with mp3, ac3, pcm, aac - and problem with turning off channels is still there... I need to turn off audio channels in video, but how to solve that problem, I do not know yet.

推荐答案

的MediaPlayer对象是通过在设备(不是平板电脑和谷歌电视之间相同)不同的库支持。你是如何构造的MediaPlayer?

The MediaPlayer object is backed by different libraries across the devices (not the same between a tablet and a Google TV). How are you constructing the MediaPlayer?

您可能想尝试是调用它建成后对上的MediaPlayer #reset()一件事。默认情况下,当你使用一个新运营商构建一个MediaPlayer的实例,它是处于空闲状态(至少在谷歌电视)。通过调用重置您允许调用自己OnErrorListener.onError()处理。这将让你看看是否有一些潜在的错误,否则是不可见的。

One thing you may want to try is calling #reset() on the MediaPlayer right after it is constructed. By default when you use a "new" operator to construct a MediaPlayer instance it is in an IDLE state (at least on Google TV). By calling reset you allow your own OnErrorListener.onError() handler to be invoked. This will let you see if there is some underlying error that is not visible otherwise.

您可能也想看看AudioManager#setStreamVolume(INT,INT,INT),它设置一个特定类型的所有数据流的音量。

You may also want to look at AudioManager#setStreamVolume(int, int, int) which sets the volume of ALL streams of a particular type.

编辑1:
因为你只是抓住从布局VideoView(我猜是因为省略了code)您设置你应该叫重置视频查看监听器后。

Edit 1:Since you are just grabbing the VideoView from layout (I'm guessing since that code was omitted) after you setup the listener you should call reset on the video view.

这篇关于体积沟道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 00:56