开发者

Play stereo sound as mono sound for different channel using c#.net

I want to play a stere开发者_开发知识库o sound in the following manner using c#.net

It’s a stereo track: Make it possible to hear only the L or only the R channel or both channels simultaneously. If you play only on channel put the audio out in mono so that you can hear the one channel in either speakers or headphones

Thanks in advance for any help


In Alvas.Audio you need use AudioCompressionManager.MergeStereo and AudioCompressionManager.SplitStereo methods

See pseudo code below

    AudioCompressionManager.SplitStereo(stereo, left, right);

    PlayerEx plex = new PlayexEx(); 
    plex.Done += new PlayerEx.DoneEventHandler(plex_Done);   
    plex.OpenPlayer(format);      
    plex.StartPlay();

    enum State {    Left,    Right,    Both }

    void plex_Done(object sender, DoneEventArgs e) {    
      byte[] left50ms = Cut(left, 50);    
      byte[] right50ms = Cut(right, 50);    
      switch (State)    {
        case State.Left:
          plex.AddData(AudioCompressionManager.MergeStereo(left50ms, left50ms));
        break;
        case State.Right:
          plex.AddData(AudioCompressionManager.MergeStereo(right50ms, right50ms));
        break;
        case State.Both:
          plex.AddData(AudioCompressionManager.MergeStereo(left50ms, right50ms));
        break; 
}


I found the solution for this .

I have found a library named zLib . U can use this library for play audio,Mix channels and many others . This library is very usefull for sound related work and written in many languages like VC++,C#.Net,VB.Net etc. Goto the below link :

zLib for Sound Work

This is a best library i have founded for sound.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜