audio - Play sound with C# using DirectSound (DirectX API) -
this might seem basic question, not researching hours find out did wrong.
i tried write simple console application supposed play sound resource, , code:
using system; using microsoft.directx.directsound; namespace audioplayer { class program { static void main() { console.writeline("playing..."); device device = new device(); secondarybuffer buffer = new secondarybuffer(audioplayer.properties.resources.audiofile, device); // audioplayer.properties.resources.audiofile returns stream buffer.play(0, bufferplayflags.default); console.writeline("finished"); console.readkey(true); } } } but console window no text although @ least "playing..." should printed, , there no sound well.
i using visual studio 2015 provides option pause application, , if that, tells me threads processing external code. considering that, assumed program got stuck while creating device or buffer, again console.writeline("playing..."); seems remaining unexecuted!
additional inforamtions:
.net framework version 4.6
32-bit program
sound file format: wav
codec: mpeg-1 audio layer 3 (mp3)
it great if explain failed! , sorry if duplicate or if made really silly mistake, after time spent on this, still can neither figure out how solve it, nor find existing explanation.
Comments
Post a Comment