Clipboard audio for background play?

A

AWW

Using XP and VB 2005, it seemed like a good idea to
save audio in the clipboard and then play it with backgroundworker.
Cannot find a good Clipboard audio example anywhere - just SetAudio
and GetAudio. And an example seems to do a SwapAudio which makes no
sense.
Basically I want to spool or simulate spooling of audio.
So is this reasonable for asynchronous audio clip play? or alternate?
Any thoughts or pointers to other sources? Thanks.
 
K

kimiraikkonen

Using XP and VB 2005, it seemed like a good idea to
save audio in the clipboard and then play it with backgroundworker.
Cannot find a good Clipboard audio example anywhere - just SetAudio
and GetAudio. And an example seems to do a SwapAudio which makes no
sense.
Basically I want to spool or simulate spooling of audio.
So is this reasonable for asynchronous audio clip play? or alternate?
Any thoughts or pointers to other sources? Thanks.

AWW,
You can take a look at Clipboard's overloaded SetAudio and
GetAudioStream methods as follows:
http://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard.setaudio(VS.80).aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard.getaudiostream(VS.80).aspx

However, if you just want to play a WAV file at the background, you
can use "My.Computer.Audio.Play" as follows:

'Play wav file in background continuously
'Check AudioPlayMode Enum for more options
My.Computer.Audio.Play("c:\sound.wav", AudioPlayMode.BackgroundLoop)

'To stop just call Stop method
My.Computer.Audio.Stop

Hope this helps,

Onur Güzel
 
A

AWW

AWW,
You can take a look at Clipboard's overloaded SetAudio and
GetAudioStream methods as follows:
http://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard.setaudio(VS.80).aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard.getaudiostream(VS.80).aspx

However, if you just want to play a WAV file at the background, you
can use "My.Computer.Audio.Play" as follows:

'Play wav file in background continuously
'Check AudioPlayMode Enum for more options
My.Computer.Audio.Play("c:\sound.wav", AudioPlayMode.BackgroundLoop)

'To stop just call Stop method
My.Computer.Audio.Stop

Hope this helps,

Onur Güzel
OK, that is the way it should work but I have SetAudio in the
"foreground" and even checked immediately for ContainsAudio and get a
True response. But in BackgroundWorker_DoWork the ContainsAudio
returns a False.
Any idea about that? Thanks for any thoughts.
 
K

kimiraikkonen

OK, that is the way it should work but I have SetAudio in the
"foreground" and even checked immediately for ContainsAudio and get a
True response. But in BackgroundWorker_DoWork the ContainsAudio
returns a False.
Any idea about that? Thanks for any thoughts.

Same behaviour, If i use BackgroundWorker! Playing the stream simply
in a button1_click returns True if the audio is on clipboard. My guess
(just prediction) that, when you try to invoke Background object,
clipboard gets changed or modified and audio data on clipboard is no
longer available to be found. Maybe there are better explanations.

HTH,

Onur Güzel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top