Playing a sound in DirectX9 from Non active window (VB.NET2005)
  Home FAQ Contact Sign in
microsoft.public.win32.programmer.directx.audio only
 
Advanced search
POPULAR GROUPS

more...

 Up
Playing a sound in DirectX9 from Non active window (VB.NET2005)         

Group: microsoft.public.win32.programmer.directx.audio · Group Profile
Author: Rick Muething
Date: Sep 18, 2008 09:05

I have what should be a simple problem but haven't been able to find a
solution.
I am using DirectX 9 to play a simple 16 bit mono sound file in a Sound card
modem application. The playback code is simple:
devSelectedPlaybackDevice.SetCooperativeLevel(Me.Handle,
CooperativeLevel.Priority)
bufPlayback = New SecondaryBuffer(Filename,
devSelectedPlaybackDevice)
bufPlayback.Volume = -5000 + 50 * intOutputLevel ' -5000=off,
0=full volume
bufPlayback.Play(0, BufferPlayFlags.Default)

All this works fine IF the application window is the active window. If the
application
Window is not the active window the sound card capture code (not shown)
continues to work fine but there is no playback from the sound card output.
This works the same way on several different sound cards (internal or
external USB). There is no exception thrown just no output from the sound
card. Once the window containing the application is made active again it
plays correctly.

How can I make it play regardless of the applications's window status
(active, non active, minimized)?

Thanks,
Rick Muething

--
Rick Muething
Winlink Development Team
3 Comments
diggit! del.icio.us! reddit!