Click here to Skip to main content
15,913,361 members
Home / Discussions / C#
   

C#

 
AnswerRe: Pausing A Loop in Windows Application Pin
Pete O'Hanlon15-Jun-07 4:36
mvePete O'Hanlon15-Jun-07 4:36 
QuestionC#:How to get Dragged Item when drop to Target Control Pin
Chintan.Desai15-Jun-07 0:17
Chintan.Desai15-Jun-07 0:17 
AnswerRe: C#:How to get Dragged Item when drop to Target Control Pin
WillemM15-Jun-07 3:43
WillemM15-Jun-07 3:43 
GeneralRe: C#:How to get Dragged Item when drop to Target Control Pin
Chintan.Desai15-Jun-07 3:55
Chintan.Desai15-Jun-07 3:55 
GeneralRe: C#:How to get Dragged Item when drop to Target Control Pin
WillemM15-Jun-07 4:09
WillemM15-Jun-07 4:09 
Questionc# Pin
nikvarma15-Jun-07 0:08
nikvarma15-Jun-07 0:08 
AnswerRe: c# Pin
Rudolf Jan15-Jun-07 0:16
Rudolf Jan15-Jun-07 0:16 
AnswerRe: c# Pin
Andrei Ungureanu15-Jun-07 1:13
Andrei Ungureanu15-Jun-07 1:13 
Hey,

I created an application that plays the sound from a byte array. I took me some time to figure it out, and finally I used Microsoft DirectX SDK. I will give you the code, maybe it will help you:
<br />
public void PlaySound(Array soundBytes)<br />
        {<br />
            if (soundBytes == null)<br />
                return;<br />
            BufferDescription desc = new BufferDescription(InputFormat);<br />
            desc.BufferBytes = soundBytes.Length;<br />
            desc.ControlFrequency = true;<br />
            desc.ControlPan = true;<br />
            desc.ControlPositionNotify = true;<br />
            desc.ControlVolume = true;<br />
            secBuffer = new SecondaryBuffer(desc, _appDevice);<br />
            secBuffer.Write(secBuffer.WritePosition, soundBytes, LockFlag.None);<br />
            secBuffer.Play(0, BufferPlayFlags.Default);<br />
        }<br />


The only thing you have to do is initialize the _appDevice object. Something like this:
<br />
_appDevice = new Device();<br />
_appDevice.SetCooperativeLevel(formHandle, CooperativeLevel.Priority);<br />

The form handle is the form which when is active can play the sound.

Hope it helps

Do your best to be the best

QuestionReading Microsoft .lit files. Pin
Nic Rowan14-Jun-07 23:52
Nic Rowan14-Jun-07 23:52 
AnswerRe: Reading Microsoft .lit files. Pin
Vasudevan Deepak Kumar15-Jun-07 2:47
Vasudevan Deepak Kumar15-Jun-07 2:47 
GeneralRe: Reading Microsoft .lit files. Pin
Mali Perica15-Jun-07 3:42
Mali Perica15-Jun-07 3:42 
QuestionHow to convert an MS Word document to PDF Pin
khuzwayom14-Jun-07 23:40
khuzwayom14-Jun-07 23:40 
AnswerRe: How to convert an MS Word document to PDF Pin
Vasudevan Deepak Kumar15-Jun-07 0:33
Vasudevan Deepak Kumar15-Jun-07 0:33 
GeneralRe: How to convert an MS Word document to PDF Pin
khuzwayom15-Jun-07 0:56
khuzwayom15-Jun-07 0:56 
QuestionHow to open a existing forn ? Pin
help as an alias14-Jun-07 23:40
help as an alias14-Jun-07 23:40 
AnswerRe: How to open a existing forn ? Pin
Martin#14-Jun-07 23:51
Martin#14-Jun-07 23:51 
GeneralRe: How to open a existing forn ? Pin
Muammar©17-Jun-07 4:56
Muammar©17-Jun-07 4:56 
AnswerRe: How to open a existing forn ? Pin
umitmax15-Jun-07 9:33
umitmax15-Jun-07 9:33 
QuestionWS and DesktopApplication Pin
Andrei Ungureanu14-Jun-07 22:53
Andrei Ungureanu14-Jun-07 22:53 
AnswerRe: WS and DesktopApplication Pin
Pete O'Hanlon15-Jun-07 0:30
mvePete O'Hanlon15-Jun-07 0:30 
GeneralRe: WS and DesktopApplication Pin
Andrei Ungureanu15-Jun-07 1:04
Andrei Ungureanu15-Jun-07 1:04 
AnswerRe: WS and DesktopApplication Pin
leppie15-Jun-07 0:34
leppie15-Jun-07 0:34 
GeneralRe: WS and DesktopApplication Pin
Andrei Ungureanu15-Jun-07 1:06
Andrei Ungureanu15-Jun-07 1:06 
QuestionMaximize glitches Pin
sinosoidal14-Jun-07 22:48
sinosoidal14-Jun-07 22:48 
QuestionDll Versions Pin
umashankergr814-Jun-07 22:36
umashankergr814-Jun-07 22:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.