playing 2 mp3 files at same time

This is a discussion on playing 2 mp3 files at same time within the C# Programming forums, part of the General Programming Boards category; Is it possible to play 2 mp3 files at the same time in C#? I can only get it to ...

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    330

    playing 2 mp3 files at same time

    Is it possible to play 2 mp3 files at the same time in C#? I can only get it to work with playing one file at the same time with the mci library

  2. #2
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    Have you tried giving each mp3 a different mci alias? Eg.

    Code:
    [DllImport("winmm.dll")]
    private static extern Int32 mciSendString(String command, StringBuilder buffer,
                                              Int32 bufferSize, IntPtr hwndCallback);
    
    private void PlayTwoSongs()
    {
        String path = "c:\\some_song.mp3";
        mciSendString("open \"" + path + "\" type mpegvideo alias songA", null, 0, IntPtr.Zero);
        mciSendString("play songA", null, 0, IntPtr.Zero);
    
        path = "c:\\another_song.mp3";
        mciSendString("open \"" + path + "\" type mpegvideo alias songB", null, 0, IntPtr.Zero);
        mciSendString("play songB", null, 0, IntPtr.Zero);
    }
    Not tested this but I did something similar once to allow simultaneous recording and playback.
    Last edited by theoobe; 05-30-2011 at 06:05 PM.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    thanks a lot, that worked. I did not think of this

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Playing with .ini files.
    By Neo1 in forum C++ Programming
    Replies: 3
    Last Post: 06-21-2007, 12:23 AM
  2. Playing wma files
    By maxorator in forum C++ Programming
    Replies: 4
    Last Post: 10-02-2005, 02:23 AM
  3. playing .mmf files
    By Ruski in forum Windows Programming
    Replies: 2
    Last Post: 06-17-2005, 09:49 PM
  4. Playing mp3 files in Mac OS X
    By tek in forum C++ Programming
    Replies: 23
    Last Post: 08-30-2003, 01:42 PM
  5. Playing .wav files
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 05-17-2002, 09:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21