使用 SoundPlayer 播放多个声音 [英] Play multiple sounds using SoundPlayer

查看:28
本文介绍了使用 SoundPlayer 播放多个声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个采样器程序,其中从 1 到 9 的每个键都会发出不同的声音.一切正常,但是当我同时按下两个(或多个)声音时,第二个杀死"第一个.

I'm making a sampler program where each key from 1 to 9 will make a different sound. Everything works fine, but when I press two (or more) sounds at the same time, the second one "kills" the first one.

我正在使用 SoundPlayer 播放 .WAV 文件中的声音.我该如何解决这个问题?

I'm playing the sounds from .WAV files, using SoundPlayer. How can I solve this?

推荐答案

您需要使用 DirectX (DirectSound) 或一些旨在允许同时播放多个声音的类似 API.

You'll need to use DirectX (DirectSound) or some similar API that is designed to allow the playing of multiple sounds at the same time.

这篇关于使用 SoundPlayer 播放多个声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆