Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 518469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:56:26+00:00 2026-05-13T07:56:26+00:00

I’ve been confronted to a situation. I’m writing a Windows app in C# .NET.

  • 0

I’ve been confronted to a situation. I’m writing a Windows app in C# .NET.
I want to play multiple .wav files one after another and do that continuously.

is there a class that could allow that ? otherwise, how would I implement it ?

I tried using MCI and it works, using the notify flag and interception of the MM_MCINOTIFY message but it’s rather messy and complicates my code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:56:26+00:00Added an answer on May 13, 2026 at 7:56 am

    If the list of files is fixed, then just make a playlist and pass it to an instance of MediaPlayer. media player accepts playlist in either .m3u format or .wvx format.

    But if you need to choose the order of files dynamically, one if the easiest way is to use PlaySound(). You hand it individual filenames, or pointers to wave data in memory (you would have to marshal that to unmanaged memory). Either dedicate a thread to the sound, and have it just call PlaySound in a loop, or use SND_ASYNC.

    Note that it is possible just by looking at the header of a wave file to know how long it will take to play a file with a high degree of accuracy.

    [DllImport("WinMM.dll")]    
    public static extern bool  PlaySound(string name, int hModule, int flags);
    
    // see mmsystem.h for these flags
    public int SND_SYNC      = 0x00000000; // don't return until playback is done
    public int SND_ASYNC     = 0x00000001; // play asynchronously    
    public int SND_NODEFAULT = 0x00000002; // don't play the default sound if n
    public int SND_MEMORY    = 0x00000004; // name is actual a pointer to a WAVEHEADER
    public int SND_LOOP      = 0x00000008; // loop the sound until next call to PlaySound (use with SND_ASYNC)
    public int SND_NOSTOP    = 0x00000010; // don't stop any currently playing sound
    public int SND_FILENAME  = 0x00020000; // name is a filename (it's a sound name otherwise)
    public int SND_NOSTOP    = 0x00000010; // don't stop any currently playing sound
    

    Both of these methods will allow you to mix files of different bit depth and sample rate. But they will also both put a slight amount of silence between the files. If you need the transitions between the files to be seamless then you will need to either find a 3rd party audio engine, or roll your own.

    Or, you can write a multiple-wave-file file stream reader (in C++, not C# it has to be unmanaged code). And use it instead of the default .wav file reader to play the files in MediaPlayer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.