public partial class Form1 : Form
{
SecondarySoundBuffer m_DSoundBuffer;
DirectSound m_DirectSound;
string fileName = @"F:\\guitar-classical-E-octave0.wav";
public void setting()
{
WaveStream waveFile = new WaveStream(fileName);
SoundBufferDescription desc = new SoundBufferDescription();
desc.SizeInBytes = (int)waveFile.Length;
desc.Flags = BufferFlags.None;
desc.Format = waveFile.Format;
m_DirectSound = new DirectSound();
m_DirectSound.SetCooperativeLevel(this.Handle, CooperativeLevel.Priority);
m_DSoundBuffer = new SecondarySoundBuffer(m_DirectSound, desc);
}
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
setting();
m_DSoundBuffer.Play(0, 0);
}
}
I'm first for SlimDX.
And I'm trying to play a wave file. But It doesn't work!
Maybe anything wrong??
using WinForms, SlimDX.DirectSound, SlimDX.Mutimedia