C++/VB - Question about DirectSound notifications

Asked By Loren Rogers
24-Aug-08 06:48 AM
Hey gang,
I've created a DirectSound test application with the capture notifier
set to 50 indexes (16000-2-byte samples (640 bytes) at 20 ms each).
So I would expect my callback thread to be called 50 times per second
with the buffersizes of 640 bytes.  I'm not seeing this.  What I am
seeing is (using MM timestamps as a test) is about 36 to 38 events per
second with some "woken-up" event durations at 0 ms and others with 50
ms.  What can I do to configure Directsound capture notifier to wake
up my thread every 20 ms with the correct buffer sizes?  My thread is
using ::MsgWaitForMultipleObjects().
/Loren
MsgWaitForMultipleObjects
(1)
WaitForMultipleObjects
(1)
DirectSound
(1)
DirectShow
(1)
Buffersizes
(1)
Timestamps
(1)
Callback
(1)
Buffers
(1)
  Chris P. replied...
25-Aug-08 09:18 AM
For one don't use MsgWaitForMultipleObjects().  Use WaitForSingleObject()
or WaitForMultipleObjects().

The event notifications in DirectSound are somewhat broken.  It is
particularly bad if there are multiple DirectSound applications running as
you will receive the other applications events as well.

--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
  Loren Rogers replied...
26-Aug-08 11:13 PM
()
s

Thanks Chris,
What I wound up doing and it seems to work is wake up every 100 ms
(3200 bytes in this case) and then break that buffer into 5 smaller
buffers (640 bytes).  I need the smaller sample sizes for encoding/
network packetization.
Create New Account
help
Image Tearing in video capturing, VSync in directshow?? C++ / VB Hi, I am developing an application to capture images from the analog video source. I am using Directshow apis to capture the analog video. The application is based on msdn sample amcap (first suggested for this problem Vsync mode. How can I set the v sync mode using directshow apis? I did not find any directshow apis for the same. Any help in this regard is highly appreciated. Regards, Albert Win32 you using? This sounds like a problem in either the hardware or the driver, not DirectShow (DirectShow only knows how to handle media samples, how to properly fill them is the responsibility of the source component). - - / / Alessandro Angeli / / MVP :: DirectShow / MediaFoundation / / mvpnews at riseoftheants dot com / / http: / / www.riseoftheants.com / mmx / faq.htm Hi, Thanks the image using GetCurrentImage API of IBasicVideo interface. Is there anyway to disable interlacing using directshow apis such that problem i got doesn;t occur? or any other way at application
know which Windows API suits best for this rather simple task. I have read about DirectSound, XACT and XAudio2 so far. The target platform is Windows XP and above. Can someone memory buffer: - waveOut (since Win3.x) http: / / msdn.microsoft.com / en-us / library / dd743678.aspx - DirectSound (since Win95) http: / / msdn.microsoft.com / en-us / library / ee416960.aspx - WASAPI (since Vista) http memory buffer): - MCI (since Win3.x) http: / / msdn.microsoft.com / en-us / library / dd757151.aspx - DirectShow (since Win98) http: / / msdn.microsoft.com / en-us / library / dd389098.aspx - MediaFoundation (since Vista) http managing PCM buffer is quite easy). If I were you, I would use waveOut or DirectSound or, if you want a player-like API, DirectShow (but DirectShow can not play PCM buffers without a custom source filter: the samples Async, PushSource, Ball and Synth can be used as a basis to quickly develop one). - - / / Alessandro Angeli / / MVP :: DirectShow / MediaFoundation / / mvpnews at riseoftheants dot com / / http: / / www.riseoftheants.com / mmx / faq.htm On 19 Alessandro Angeli" <nob. . .@nowhere.in.the.net> Thanks a lot. I think I will use DirectSound. . . Markus Note that DirectSound is the better API choice for Windows XP, but for Windows
Add / Remove DMO filters during audio playback C++ / VB I am new to DirectShow and have been playing around with adding a DMOFilterWrapper to an MP3 and playing it sample format that it takes in. - - http: / / www.chrisnet.net / code.htm [MS MVP for DirectShow / MediaFoundation] Chris, I am using the standard DMO objects (compressor, eq, flanger, etc.) and as little advanced, so probably not the best thing to try if you are new to DirectShow. If you don't need any DirectShow behavior such as automatic rendering then you might be better off using DirectSound directly as you can turn effects on or off there. - - http: / / www.chrisnet.net / code htm [MS MVP for DirectShow / MediaFoundation] I initially looked at using DirectSound for the reasons you specified, but I am primarily playing mp3 formatted files and I a little advanced for me. Do you have any knowledge of playing mp3 files with DirectSound? You could do the MP3 decoding using the ACM instead. Then it's just a
DirectX SDK from Feb 2005 (I think it was the last version to include the DirectShow SDK). I am not sure about the platform SDK version but I guess this would the new version of the runtime). However, why do not you upgrade your SDKs? The DirectShow SDK has simply been moved to the Platform / Windows SDK. The latest version of the microsoft.com / downloads / details.aspx?FamilyID = 0baf2b35-c656-4969-ace8-e4c0c0716adb), which should contain the DirectShow SDK. However, if you can, you should upgrade to VC++2008SP1 and the WinSDK for Win7 (which includes both DirectShow and WindowsMedia). Notice that the express edition of VC++2008 is free (but you loose MFC and ATL if that is important to you). - - / / Alessandro Angeli / / MVP :: DirectShow / MediaFoundation / / mvpnews at riseoftheants dot com / / http: / / www.riseoftheants.com / mmx / faq.htm Thanks. The only way to create Microsoft? Windows MediaT Audio and Windows Media Video files in Microsoft DirectShow". In practice is this the only approach that everone uses to write Windows Media Video and Audio files from frames served through a DirectShow filter graph, or are there other ways of doing this - perhaps better? Is this version Platform SDK? When I installed the old DirectX SDK it was because it contained the DirectShow SDK, and it was never clear to me whether DirectShow development actually needed the DirectX
WMP11, DirectShow and Vista C++ / VB I get the impression that WMP11 doesn't use DirectShow ? I say this because I'm finding that a number of video files that play fine in DirectShow (GraphEdit, our own software, Ulead Video Studio, etc) often won't play in WMP11. If WMP11 isn't using DirectShow then what is it using ? In addition, WMP11 sometimes complains about a missing codec "Intel of magnitude), is this normal ? TTFN, Jon Win32 DirectX Video Discussions Vista (1) XP (1) DirectShow (1) GraphEdit (1) MPeg (1) Ulead (1) Connectionless (1) Likelyhood (1) WMP11 will use Media Foundation instead of DirectShow for certain file types. Currently these file types are ASF and MP3 (MPeg-1 layer and there is no decoder found it will fail rather than failing over to using DirectShow (which in all likelyhood would have worked). DirectShow is still used for all other file types such as AVI etc. Depends. Media Foundation