好东西大家分享:
解决方法如下,用DSPACK2.2开发
在界面上放一个Filter,Filter的FilterGraph指向已放置好的TFilterGraph,再点BaseFilter,然后在出现在Base Filter Editor中选择DirectShow Filters中的MPEG Audio Decoder,确定
实现代码如下:
procedure TForm1.SetBands(Bands:integer);
var
    MpegAudioDecoder:IMpegAudioDecoder;
begin
  if succeeded(Filter1.QueryInterface(IMpegAudioDecoder, MpegAudioDecoder))then
  begin
    MpegAudioDecoder.put_DualMode(Bands););//0 ALL 1 Left 2 Right
    MpegAudioDecoder := nil;
  end;
end;
有关资料如下:
// Values for DualMode
const
  AM_MPEG_AUDIO_DUAL_MERGE = 0;
  AM_MPEG_AUDIO_DUAL_LEFT  = 1;
  AM_MPEG_AUDIO_DUAL_RIGHT = 2;type
  IMpegAudioDecoder = interface(IUnknown)
    ['{B45DD570-3C77-11D1-ABE1-00A0C905F375}']
    function get_FrequencyDivider(out pDivider: LongWord): HRESULT; stdcall;
    function put_FrequencyDivider(Divider: LongWord): HRESULT; stdcall;
    function get_DecoderAccuracy(out pAccuracy: LongWord): HRESULT; stdcall;
    function put_DecoderAccuracy(Accuracy: LongWord): HRESULT; stdcall;
    function get_Stereo(out pStereo: LongWord): HRESULT; stdcall;
    function put_Stereo(Stereo: LongWord): HRESULT; stdcall;
    function get_DecoderWordSize(out pWordSize: LongWord): HRESULT; stdcall;
    function put_DecoderWordSize(WordSize: LongWord): HRESULT; stdcall;
    function get_IntegerDecode(out pIntDecode: LongWord): HRESULT; stdcall;
    function put_IntegerDecode(IntDecode: LongWord): HRESULT; stdcall;
    function get_DualMode(out pIntDecode: LongWord): HRESULT; stdcall;
    function put_DualMode(IntDecode: LongWord): HRESULT; stdcall;
    function get_AudioFormat(out lpFmt: TMPEG1WaveFormat): HRESULT; stdcall;
  end;
以上只能解决MPEG1编码的声道问题,MPEG4的还没有找到办法,欢迎大家发表看法。

解决方案 »

  1.   

    老大,你这一招是不是人家机器上必须装有Direct9.0才能运行?如果是这样子那就失去意义了....(因为winme,win2000这两个最常用的操作系统并没有自带Direct9.0)啊,有什么办法能使Direct7.0可以调节左右声道的吗?望复帖...
      

  2.   

    请较一下,用dspack做播放器的时候,如何来设置声道,是设置filtergraph的balance属性吗,我试了很多值都不可以,而且用mcisendstring('set all audio right on',…)也不可以?想实现循环应该如何来做呢?还有一个问题就是当我同时选择多个文件来播放时,只会播放第一个,是不是要加入一个变量来保存选择的各文件名,一个变量保存文件个数,然后再分别取出播放呢?
      

  3.   

    okdelphi(okdelphi):
    我试过了的,不一定要是Direct9.0,Direct5.0的也可以
      

  4.   

    3cs(阿虎) :
    和MPEG1的做法差不多,只是没有图像而已