Discussion:
[Portaudio] Re: WDM-KS/WASAPI status? (and fixes)
Ross Bencina
16 years ago
Permalink
First up thanks Toni for moving the WDM-KS stuff forward. As David V. said
it hasn't made it past the beta stage since it worked on some systems but
not on others..

I have a question about your patch here:
http://music.columbia.edu/pipermail/portaudio/2009-April/009055.html

What is the dependency on the SPDIF flags caused by? I recently comitted a
patch for pa_wmme which provides generic support for these flags in the
waveforematex ( pa_win_waveformat.h/c ) which is used by WMME and DSOUND
(perhaps we should look at using this in wdmks too, if it isn't already).

I'm already maintaining WMME/DSound/ASIO so I'm reluctant to take on another
API but I can look into merging these changes since they seem to make a
difference to some at least.

Comments anyone?

Ross.









===================================
AudioMulch 2.0 coming soon!

http://www.audiomulch.com
Toni Wilen
16 years ago
Permalink
Post by Ross Bencina
What is the dependency on the SPDIF flags caused by? I recently
comitted a patch for pa_wmme which provides generic support for these
flags in the waveforematex ( pa_win_waveformat.h/c ) which is used by
WMME and DSOUND (perhaps we should look at using this in wdmks too, if
it isn't already).
Sorry, I have no idea. I get errors like this without them:

C:\msvs\Microsoft SDKs\Windows\v7.0\Include\ksmedia.h(3000) : error
C2065: 'WAVE_FORMAT_DTS' : undeclared identifier
C:\msvs\Microsoft SDKs\Windows\v7.0\Include\ksmedia.h(3000) : error
C2099: initializer is not a constant

(and I felt too lazy to find proper solution..)
Ross Bencina
16 years ago
Permalink
Hi Toni
Post by Toni Wilen
Post by Ross Bencina
What is the dependency on the SPDIF flags caused by? I recently
'WAVE_FORMAT_DTS' : undeclared identifier
initializer is not a constant
Ah ok, so it's just a ksmedia.h dependency.

In that case I would expect including mmsystem.h or mmreg.h before ksmedia.h
would resolve the problem.

Does that work for you?

Thanks

Ross.
Toni Wilen
16 years ago
Permalink
Post by Ross Bencina
Ah ok, so it's just a ksmedia.h dependency.
In that case I would expect including mmsystem.h or mmreg.h before
ksmedia.h would resolve the problem.
Does that work for you?
Yes, it will fix undeclared identifier errors but also introduces other
errors:

1>Compiling...
1>pa_win_wdmks.c
1>..\..\src\hostapi\wdmks\pa_win_wdmks.c(136) : warning C4005:
'_INC_MMREG' : macro redefinition
1> C:\msvs\Microsoft SDKs\Windows\v7.0\Include\mmreg.h(30) : see
previous definition of '_INC_MMREG'
1>..\..\src\hostapi\wdmks\pa_win_wdmks.c(141) : warning C4005:
'DEFINE_GUIDEX' : macro redefinition
1> C:\msvs\Microsoft SDKs\Windows\v7.0\Include\mmreg.h(2321) :
see previous definition of 'DEFINE_GUIDEX

commented out whole #ifdef _MSC_VER block and moved DEFINE_GUIDEX
outside of comments, linker errors this time:

1> Creating library Win32\Release\portaudio_x86.lib and object
Win32\Release\portaudio_x86.exp
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX referenced in function _PinNew
1>pa_win_wdmks_utils.obj : error LNK2001: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSPROPSETID_Pin referenced in function _PinNew
1>pa_win_wdmks_utils.obj : error LNK2001: unresolved external symbol
_KSPROPSETID_Pin
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSDATAFORMAT_SPECIFIER_WAVEFORMATEX referenced in function _PinNew
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_PCM referenced in function _PinNew
1>pa_win_wdmks_utils.obj : error LNK2001: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_PCM
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSDATAFORMAT_TYPE_AUDIO referenced in function _PinNew
1>pa_win_wdmks_utils.obj : error LNK2001: unresolved external symbol
_KSDATAFORMAT_TYPE_AUDIO
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSMEDIUMSETID_Standard referenced in function _PinNew
1>pa_win_wdmks_utils.obj : error LNK2001: unresolved external symbol
_KSMEDIUMSETID_Standard
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSINTERFACESETID_Standard referenced in function _PinNew
1>pa_win_wdmks_utils.obj : error LNK2001: unresolved external symbol
_KSINTERFACESETID_Standard
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSPROPSETID_Connection referenced in function _PinSetState
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT referenced in function _FillWFEXT
1>pa_win_wdmks_utils.obj : error LNK2001: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSCATEGORY_CAPTURE referenced in function _BuildFilterList
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSCATEGORY_RENDER referenced in function _BuildFilterList
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSCATEGORY_AUDIO referenced in function _BuildFilterList
1>Win32\Release\portaudio_x86.dll : fatal error LNK1120: 12 unresolved
externals

Only commented out #define _INC_MMREG:

1> Creating library Win32\Release\portaudio_x86.lib and object
Win32\Release\portaudio_x86.exp
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX referenced in function _PinNew
1>pa_win_wdmks_utils.obj : error LNK2001: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_PCM referenced in function _PinNew
1>pa_win_wdmks_utils.obj : error LNK2001: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_PCM
1>pa_win_wdmks.obj : error LNK2019: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT referenced in function _FillWFEXT
1>pa_win_wdmks_utils.obj : error LNK2001: unresolved external symbol
_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
1>Win32\Release\portaudio_x86.dll : fatal error LNK1120: 3 unresolved
externals

I am not familiar with ksmedia stuff -> lost interest quickly after this :)
Bob McGwier
16 years ago
Permalink
I don't see these issues arising in the svn repository version I pointed
out earlier. Today I have included the ability to make x64 versions.
They are UNTESTED and I am concerned that the warnings in ASIO
compilation might turn out to be run time errors. I had to comment out
the debug checker for the x64 versions to work.


Bob McGwier
...
--
(Co)Author: DttSP, Quiktrak, PowerSDR, GnuRadio
Member: ARRL, AMSAT, AMSAT-DL, TAPR, Packrats,
NJQRP, QRP ARCI, QCWA, FRC.
"You don't need to see the whole staircase, just
take the first step.", MLK.
Twitter:rwmcgwier
Active: Facebook,Myspace,LinkedIn
Ross Bencina
16 years ago
Permalink
Hi Bob
Post by Bob McGwier
I don't see these issues arising in the svn repository version I pointed
out earlier.
I presume that's because you're using Toni's patch?
Post by Bob McGwier
From my point of view it is inappropriate to redefine WAVE_FORMAT_*constants
which exist in SDK headers. Especially when they are not even used by the
code (they are only used by ksmedia.h). I'd like to get this resolved before
I commit the patch.

Unfortunately I have limited time to deal with this until after June 5 so
I'm probably going to be better at pointing out problems than finding
solutions.

Sorry

Ross.


----- Original Message -----
From: "Bob McGwier" <***@gmail.com>
To: "Portaudio Mailing List" <***@music.columbia.edu>
Sent: Tuesday, May 05, 2009 4:02 AM
Subject: Re: [Portaudio] Re: WDM-KS/WASAPI status? (and fixes)
...
Bob McGwier
16 years ago
Permalink
Yes. Tony's patches work. The only problem we are experiencing using
Vista and MME and directX. Windows 7 RC1 works perfectly, XP (all
versions) work perfectly but Vista and MME in PA for our application
seem to hate each other. I have not had time to investigate it.

The WDM-KS patch is also important. Toni made a good find there. With
VS2008 and x64, I had to comment out the test for IsDebuggerPresent
because of pointer incompatibility. It is always NULL on our systems
since we do not debug down into ASIO.

All of the hosts work on all OS's except for our glitch with MME and
directX on Vista. If any others are using MME or directX with portaudio
(svn) and Vista sucessfully, I would appreciate hearing about it so
Eric and I can investigate what is going on in our app.

Bob
...
--
(Co)Author: DttSP, Quiktrak, PowerSDR, GnuRadio
Member: ARRL, AMSAT, AMSAT-DL, TAPR, Packrats,
NJQRP, QRP ARCI, QCWA, FRC.
"You don't need to see the whole staircase, just
take the first step.", MLK.
Twitter:rwmcgwier
Active: Facebook,Myspace,LinkedIn
Ross Bencina
16 years ago
Permalink
Hi Bob
Post by Bob McGwier
All of the hosts work on all OS's except for our glitch with MME and
directX on Vista. If any others are using MME or directX with portaudio
(svn) and Vista sucessfully, I would appreciate hearing about it so Eric
and I can investigate what is going on in our app.
I'm using current SVN PortAudio in AudioMulch 2.0 (beta) and havn't had any
reports of problems on Vista. I use the callback API. I have a Vista 32
machine here and it seems ok... although I haven't done much stress
testing...

Ross.
Toni Wilen
16 years ago
Permalink
I found the problem with pa_win_wdmks.c and mmreg.h, mmreg.h must be
included after DEFINE_GUID, not before.. (Too simple fix..)
Here is new cleaner patch:

--- c:\d\pa_win_wdmks.c 2009-05-06 21:36:24.262834600 +0300
+++ pa_win_wdmks.c 2009-05-06 21:32:49.600533400 +0300
@@ -77,7 +77,7 @@

#include <windows.h>
#include <winioctl.h>
-
+#include <process.h>

#ifdef __GNUC__
#undef PA_LOGE_
@@ -121,8 +121,8 @@
#endif

#ifdef _MSC_VER
+ #define NOMMIDS
#define DYNAMIC_GUID(data) {data}
- #define _INC_MMREG
#define _NTRTL_ /* Turn off default definition of DEFINE_GUIDEX */
#undef DEFINE_GUID
#define DEFINE_GUID(n,data) EXTERN_C const GUID n = {data}
@@ -131,14 +131,9 @@
#if !defined( DEFINE_WAVEFORMATEX_GUID )
#define DEFINE_WAVEFORMATEX_GUID(x) (USHORT)(x), 0x0000,
0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
#endif
- #define WAVE_FORMAT_ADPCM 0x0002
- #define WAVE_FORMAT_IEEE_FLOAT 0x0003
- #define WAVE_FORMAT_ALAW 0x0006
- #define WAVE_FORMAT_MULAW 0x0007
- #define WAVE_FORMAT_MPEG 0x0050
- #define WAVE_FORMAT_DRM 0x0009
#endif

+#include <mmreg.h>
#include <ks.h>
#include <ksmedia.h>
#include <tchar.h>
@@ -2925,10 +2920,15 @@
}
}
/* Only call the EndBufferProcessing function is the total
input frames == total output frames */
+ if (stream->recordingPin && stream->playbackPin) {
if((stream->bufferProcessor.hostInputFrameCount[0] +
stream->bufferProcessor.hostInputFrameCount[1]) ==
(stream->bufferProcessor.hostOutputFrameCount[0] +
stream->bufferProcessor.hostOutputFrameCount[1]) )
framesProcessed =
PaUtil_EndBufferProcessing(&stream->bufferProcessor,&cbResult);
- else framesProcessed = 0;
+ else
+ framesProcessed = 0;
+ } else {
+ framesProcessed =
PaUtil_EndBufferProcessing(&stream->bufferProcessor,&cbResult);
+ }
if( doChannelCopy )
{
/* Copy the first output channel to the other channels */

btw,

#if !defined( DEFINE_WAVEFORMATEX_GUID )
#define DEFINE_WAVEFORMATEX_GUID(x) (USHORT)(x), 0x0000, 0x0010,
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
#endif

Can also be removed completely (identical lines in mmreg.h)

btw2, this still does not fix random memory corruption when closing and
reopening the device (with different buffer configuration) multiple times.
Ross Bencina
16 years ago
Permalink
Thanks for this Toni

I've now comitted this with only changes to formatting/comments. You can see
the final diff here:
http://www.portaudio.com/trac/changeset/1411/portaudio/trunk/src/hostapi/wdmks/pa_win_wdmks.c

I'm pretty confident its OK but I havn't tested it here. Can you please
confirm that its OK?

Thanks

Ross.


===================================
AudioMulch 2.0 coming soon!

http://www.audiomulch.com
----- Original Message -----
From: "Toni Wilen" <***@winuae.net>
To: "Portaudio Mailing List" <***@music.columbia.edu>
Sent: Thursday, May 07, 2009 4:46 AM
Subject: Re: [Portaudio] Re: WDM-KS/WASAPI status? (and fixes)
...
Loading...