By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,258 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,258 IT Pros & Developers. It's quick & easy.

Clipboard audio for background play?

P: n/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.
Sep 27 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Sep 27, 5:31*am, AWW <wrote:
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/libr...io(VS.80).aspx
http://msdn.microsoft.com/en-us/libr...am(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
Sep 27 '08 #2

P: n/a
AWW
On Sat, 27 Sep 2008 03:03:24 -0700 (PDT), kimiraikkonen
<ki*************@gmail.comwrote:
>On Sep 27, 5:31*am, AWW <wrote:
>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/libr...io(VS.80).aspx
http://msdn.microsoft.com/en-us/libr...am(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.
Sep 28 '08 #3

P: n/a
On Sep 28, 5:13*am, AWW <wrote:
On Sat, 27 Sep 2008 03:03:24 -0700 (PDT), kimiraikkonen

<kimiraikkone...@gmail.comwrote:
On Sep 27, 5:31*am, AWW <wrote:
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/libr...forms.clipboar...
http://msdn.microsoft.com/en-us/libr...forms.clipboar...
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.
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
Sep 28 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.