[Wine]FMOD audio engine fails to initialize DirectMusic

Francois Gouget fgouget at free.fr
Thu Jul 15 05:53:16 CDT 2004


On Wed, 14 Jul 2004, Robert Reif wrote:

> Francois Gouget wrote:
>
> >Why does DirectSound need full-duplex?
> >It doesn't seem like it should be needed for simple playback.
> >In fact I said I would send a patch to change this ERR to a WARN and I
> >guess this means I'm overdue...
> >
> According to the comment in the code, you need to mmap the memory R/W
> in linux for it to work. R/W permission implies full duplex the way
> the driver is currently written.

Hmm, the specs don't actually say that opening RDWR only works
on full-duplex capable devices. They do however recommend not to do so
unless you intend to use full-duplex. For instance on p26:

    Open the device files using O_RDONLY or O_WRONLY flags whenever
    it is possible. The driver uses this information when making many
    optimizing decisinos. Use O_RDWR only when writing a program which
    is going to both record and play back digital audio.

Then again on p29:

    Read write mode (O_RDWR) should be used only when necessary to
    record and play back at the same time (full duplex mode).

But note that it says 'should', not 'must' (if the distinction is
actually significant here). Also opening RDWR is not enough to enable
full-fuplex, you must then call SNDCTL_DSP_SETDUPLEX.

Anyway, this trace:

err:wave:OSS_RawOpenDevice ioctl(/dev/dsp, SNDCTL_DSP_SETDUPLEX) failed (Input/output error)

can only happen if open("/dev/dsp",O_RDWR) succeeded which, if the ioctl
error means this device only supports half-duplex, would mean that the
open can work on half-duplex devices. It might be a bug in this
particular driver, or maybe the Linux OSS drivers allow O_RDWR on
half-duplex precisely because it is needed for mmap (or just because
they diverge from the 4Front OSS specs).


> I have not tried different mmap permissions to see if the linux bug is
> real or still exists.  It's weird to do it that way but it's a work
> around for a bug that may not be valid any more.  Can the person that
> wrote the code comment?

Is it possible to mmap write-only memory? If not that may explain
Linux's insistence on being able to read from the fd: since the mmap
will let you read from the device you have to prove to the kernel that
you have read permission on the device. The only way to do so is to open
it O_RDONLY or O_RDWR.

I'm not saying it makes complete sense in this particular case, just
searching for an explanation...


-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
            "Lotto: A tax on people who are bad at math." -- unknown
          "Windows: Microsoft's tax on computer illiterates." -- WE7U



More information about the wine-users mailing list