Author Topic: [C/ Win32 API] Playing multiple WAV files at the same time  (Read 3954 times)

0 Members and 1 Guest are viewing this topic.

Offline SilentWorld

  • ZX 81
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
As the title says, is there any way at all to do this using the default Win32 API? I know that PlaySound is ancient and can't do sound mixing. I am currently using it just to play looping background music which works perfectly. I have read a little about DirectSound, but that has been deprecated for a long time and is even lower level than PlaySound. Basically, I need something lightweight that can be statically linked to play WAVs. I have read in a couple of places that using MCISendString allows multiple sounds to be played, but the code is always in VB.

Link: https://social.msdn.microsoft.com/Forums/en-US/6082e245-d38e-4ba0-a6ff-445186d7ca74/play-parallel-sounds?forum=vblanguage


Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
What about using WAV buffers and some code like the player of a very basic sofware synth (mixing multiply samples) - and using waveOutOpen() API for output?
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline SilentWorld

  • ZX 81
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
What about using WAV buffers and some code like the player of a very basic sofware synth (mixing multiply samples) - and using waveOutOpen() API for output?

Thanks for the suggestion. I looked into it, but there aren't many examples I could find, and my usage here is in a very simple context. It looks to be easier for me to extract the WAV files from the exe as temp data and use MCISendString to play them. Ideally all the data should be loaded from the executable.
« Last Edit: September 18, 2021 by SilentWorld »

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
not sure if this is what we are talking about... havent looked into the sources... just a fast found....

http://alax.info/trac/public/browser/trunk/Utilities/WaveOutMultiPlay
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won: