Francois Gouget wrote:
[...]
- if we tweak things so that the CreateThread is done, then the
resampling will be done by Alsa (or whichever back-end) which will
presumably do it much better than us. howeve rin that case we have to
make the almost never used case work and I'm not sure how well it would
work anyway (I'm concerned about skips/cracks/pops).
Option 2 turned out to be quite simple to get working so that's what I
did. However the result does not work very well. When I run the
DirectSound test I get a lot of 'stutter' :-( It seems like there are a
lot of underruns. Other applications (e.g. Windows Media Player) seem to
work better but that appears to depend on the machine too...
It seems we should be able to do better.
For those who want to play with this but don't have an i810 souncard
(e.g. me), I attached a nice patch that allows you to simulate all sorts
of things:
* by default the patch has no effect
* define I810O="1"
(that's an O for OSS)
Then the ioctls will return the same results they would return in an
i810+OSS combination. This means only 48000x16x2 will be accepted.
This simulates what happens in an i810+OSS configuration.
* define I810A="1"
Then winmm will be able to use all the formats your soundcard
supports but mmap will fail if the current format is not 48000x16x2.
This simulates what happens in an i810+Alsa configuration.
* define NOMMAP="1"
Then mmap will systematically fail. This does not simulate a
specific configuration I know of but heck, why not.
So to run the dsound test as if you had an i810+Alsa configuration you
would do:
cd dlls/dsound/tests
I810A="1" WINETEST_INTERACTIVE="1" ../../../tools/runtest -P wine -M
dsound.dll -T ../../.. -p dsound_test.exe.so dsound.c
Actually doing so you may notice that the i810+Alsa patch I sent to
wine-patches does not support writing to the primary buffer (but who
does that anyway)...
--
Francois Gouget
fgouget@codeweavers.com
Index: dlls/winmm/wineoss/audio.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/wineoss/audio.c,v
retrieving revision 1.70
diff -u -r1.70 audio.c
--- dlls/winmm/wineoss/audio.c 7 Jan 2003 23:08:05 -0000 1.70
+++ dlls/winmm/wineoss/audio.c 9 Jan 2003 23:28:33 -0000
@@ -70,6 +70,60 @@
/* Allow 1% deviation for sample rates (some ES137x cards) */
#define NEAR_MATCH(rate1,rate2) (((100*((int)(rate1)-(int)(rate2)))/(rate1))==0)
+static int i810_rate=48000;
+static int i810_format=16;
+static int i810_stereo=1;
+static int i810_ioctl(int fd, unsigned long int request, void* data)
+{
+ if (getenv("I810O"))
+ {
+ switch (request) {
+ case SNDCTL_DSP_SETFMT:
+ TRACE("simulating i810+OSS: reject non 16bit format (%d)\n",*((int*)data));
+ *((int*)data)=AFMT_S16_LE;
+ break;
+ case SNDCTL_DSP_STEREO:
+ TRACE("simulating i810+OSS: reject non stereo format (%d)\n",*((int*)data));
+ *((int*)data)=1;
+ break;
+ case SNDCTL_DSP_SPEED:
+ TRACE("simulating i810+OSS: reject unsupported sample rate (%d)\n",*((int*)data));
+ *((int*)data)=48000;
+ break;
+ }
+ }
+ switch (request) {
+ case SNDCTL_DSP_SETFMT:
+ i810_format=*((int*)data);
+ break;
+ case SNDCTL_DSP_STEREO:
+ i810_stereo=*((int*)data);
+ break;
+ case SNDCTL_DSP_SPEED:
+ i810_rate=*((int*)data);
+ break;
+ }
+ return ioctl(fd,request,data);
+}
+#define ioctl(a,b,c) i810_ioctl((a),(b),(c))
+
+static void* i810_mmap(void *start, size_t length, int prot , int flags, int fd, off_t offset)
+{
+ if (getenv("NOMMAP") ||
+ (getenv("I810A") &&
+ (i810_rate!=48000 || i810_format!=16 || i810_stereo!=1)))
+ {
+ if (getenv("RtlAcquireResourceExclusive"))
+ TRACE("simulating lack of mmap support\n");
+ else
+ TRACE("simulating i810+Alsa: reject mmap for non native format (%dx%dx%d)\n",i810_rate,i810_format,i810_stereo);
+ errno=EIO;
+ return (void*)-1;
+ }
+ return mmap(start, length, prot, flags, fd, offset);
+}
+#define mmap(a,b,c,d,e,f) i810_mmap((a),(b),(c),(d),(e),(f))
+
#ifdef HAVE_OSS
#define MAX_WAVEDRV (3)