public inbox for linux-msdos@vger.kernel.org
 help / color / mirror / Atom feed
* Re: App database
@ 2003-07-10 17:20 Stas Sergeev
  2003-07-11 17:30 ` App database, libsynth Ryan Underwood
  0 siblings, 1 reply; 31+ messages in thread
From: Stas Sergeev @ 2003-07-10 17:20 UTC (permalink / raw)
  To: linux-msdos

Hello.

Ryan Underwood wrote:
> The idea was to be able to file bugs against a particular
>  application under a particular DOSEMU version
I think that can be helpfull. But as the
bottleneck of a dosemu development process is
unfortunately elsewhere, I wouldn't assign the
prio to that your project higher than to your
adlib server:)

> It should function similarly to the WINE application compatibility database.
Just wondering, is/was that possible to reuse
their (or other) code rather than writing your
own?

> whether or not it works with any of the other emulators (FreeBSD doscmd,
> DosBox, Bochs, etc)
Actually testing against NT or 2000 dos box is
the most important. Bochs and doscmd are out of
comparision.

PS: I think there will be problems with your
adlib server as a separate process to mix the
sound with dosemu's SB digital output in real-time.
The adlib server must do a frequent small transferrs
together with taking care about keeping the OSS's
buffers partially filled to avoid underruns.
At the same time dosemu's DMA will write a
large blocks and very infrequently. When the
block from DMA arrives, there is already a data
from an adlib server in a real card's DMA buffers,
and there is no possibility to mix so lately
(unless the hardware permits).
So I beleive the DMA and Adlib sounds will always
interrupt each other, unless they are coordinated
and using an internal mixing (not per your design).
Is there a planned solution for that? Or is there
something in ALSA that can help with the real-time
mixing even under that hostile conditions? dmix?


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: App database, libsynth
@ 2003-07-11 19:02 Stas Sergeev
  2003-07-11 19:59 ` Ryan Underwood
  0 siblings, 1 reply; 31+ messages in thread
From: Stas Sergeev @ 2003-07-11 19:02 UTC (permalink / raw)
  To: linux-msdos

Hello.

Ryan Underwood wrote:
>> Is there a planned solution for that? Or is there
>> something in ALSA that can help with the real-time
>> mixing even under that hostile conditions? dmix?
>  Yes, the dmix
Will this require an ALSA support plugin for
dosemu, or it is somehow possible to use dmix
via an OSS emulation layer?

> any soundcard that is modern enough to not have a OPL* cell on it 
> should support multiple opens.
I think there are many cheap PCI boards without
either. Btw, AFAIK WinXP decided against using
the HW mixing (I may be wrong), in which case it
(HW mixing, not XP) will not survive for too long:)

> If you think the mixing should be done inside
> the application
Actually I don't think so. But otherwise we have
to write another output plugin (you can't do too
much with OSS) and we may still need an internal
resampling anyway, because the program may alter
the sampling rate on the fly (without interrupting
the transferr) and I don't know if any of the
existing software can handle that properly.
Internal resampling will also help the current
OSS output a lot. So it is a matter of writing
another output plugin and internal resampling.
This is a good thing to do, but as noone has time...

> I tried to keep the application
> interface very simple and do most of the device management internal to
> the library, so the application programmer has to do no more than create
> a synth device, check if it was successful, and then write data to the
> device.
So does it interact with ALSA, or you decided to
do it a standalone?

> I can create a threaded interface to the library instead that operates
> within the process context, and returns a buffer to be mixed by the
> programmer of the application.
[]
> It also
> requires the program to have different behavior whether there is real 
> or emulated hardware.
OK, that makes sense of course. It is good that
your lib can use the real hardware and no point
to drop that only because noone wants to write
another sound plugin (and resampling!) for dosemu:)

> It didn't seem like as flexible a solution.
Yes, it is just cheap (I think) and is more
feasible under the current circumstances etc,
but after all it is rather poor.

> By the way, has anyone looked at using QEMU in dosemu?
Yes. Fabrice asked me to remove the coopthreads
from dosemu to make it qemu-compatible. The
replacement for coopthreads is already in CVS,
but the complete removal of coopthreads will
require also removing comcom.com, so the
coopthreads is still there.
OTOH I asked Fabrice to add some dos4gw support
to qemu.
He did that and dos4gw now runs, but not that
I was able to really get some of the prot. mode
apps running. Before qemu to support at least
the minimal amount of DPMI apps, I think it is
useless for dosemu (also even far not all the realmode
apps are working). After all qemu is officially
in an Alpha stage (the last time I checked),
so it may be too early for the integration
(but a good long-term ToDo if someone have enough
time and motivation).


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: App database, libsynth
@ 2003-07-12 23:47 Stas Sergeev
  2003-07-13  0:50 ` Ryan Underwood
  0 siblings, 1 reply; 31+ messages in thread
From: Stas Sergeev @ 2003-07-12 23:47 UTC (permalink / raw)
  To: linux-msdos

Hello.

Ryan Underwood wrote:
>> dosemu, or it is somehow possible to use dmix via an 
>> OSS emulation layer?
> The synth server's output would be completely separate 
> from the application using it, so the synth could use 
> ALSA where dosemu could still use the OSS emulation.
Yes. But I was wondering will they be able
to use dmix both. Is it available via the
OSS emulation layer at all?

> Unfortunately OSS emulation blocks when ALSA is in use
OK, so it seems the be not possible to use
the current OSS plugin then...

> so one would have to use a wrapper like aoss to redirect 
> the dosemu OSS output to ALSA.
I don't know about aoss, but the redirectors
like esddsp, artsdsp and the redirector for
NAS (don't remember the name) are unable to
work in O_NONBLOCK mode, which is exactly what
dosemu uses due to a lack of threading.

> I would be curious to find out if XP really got rid of 
> hardware streams mixing or not.
I think that info came to me from Vlad R, but
I was unable to find that message for you so
never mind.

> Yeah.  Also what about sending pc-speaker output to the 
> dsp?
Yes. I wanted to mention that in my previous
posting but was distracted and forgot.
This will require translating the 6-bit PDM
stream to a 8-bit PCM stream. This is very
easy IIRC, I think I've done something like
that in my ZX Spectrum emulator back in 1995.
Dosbox is doing that so (considering other
messages in that ML today) also we have to:)
Would be nice to see that in your lib. This
will require an additional stream, but what's
the deal provided we have the dmix.

>> So does it interact with ALSA, or you decided to do it 
>> a standalone?
> (1) Theoretically, it can output to either ALSA or OSS, 
> though I use ALSA to test it.
There was a discussion in the past where you
said you'll make it the timidity-sequencer alike
plugin for alsa. I was asking about that. Now
It seems you decided to make it completely
standalone.

> Once that is complete I can implement the emulator core
> as an ALSA sequencer client, which if dosemu had alsa
> support, it could connect to that sequencer slot and use
> the MT-32.  Or else maybe something could be done with
> midid?
midid is fully functional and together with
timidity it can provide you with General Midi
and (limited) MT-32. I've heard timidity is not
powerfull enough for the *real* MT-32, so they
(dosbox) needed their own code, but I am not
a musician and what timidity produces sounds
rather good for me.

> Is midid a good idea to keep around for the long 
> term?
Yes. Among other things it allows to capture
your favourite music from games into a .mid files.


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: App database, libsynth
@ 2003-07-13  0:09 Stas Sergeev
  0 siblings, 0 replies; 31+ messages in thread
From: Stas Sergeev @ 2003-07-13  0:09 UTC (permalink / raw)
  To: linux-msdos

Hello.

Bart Oldeman wrote:
> I just keep wondering about the FM devices. The DOSBOX 
> people seem to have been able to get that working, so 
> what is special about DOSBOX that is so difficult in 
> DOSEMU?
AFAIK dosbox people are using an SDL lib for
output, while we are using an OSS directly
and are going to write more plugins.
I wish dosemu to use SDL, pthreads and all
the other tasty things, but it just doesn't.
So for us it will require significantly more
work than for them to add an Adlib.

> http://www.happypenguin.org/show?DOSbox 
> http://www.happypenguin.org/show?DOSbox&start=10
Wery interesting indeed!
Well, after all I can understand their reasons:
they are comparing 1.0.2 most likely, as a last
"very stable" version and this is understandable
after all.
Also some people claim dosemu crashes their system
even without being root. It is no longer possible
since linux-2.4.20, but they haven't specified the
kernel they used, so they blame dosemu instead.
Configuring dosemu is now trivial, but again, they
were comparing against 1.0...
So probably that was not a FUD, but rather a
consequence of the fact that dosemu had recently
celebrated its first decade of existance, but there
is still no a version that is both really and officially
stable. But that can be changed eventually.

>> > but the complete removal of coopthreads will
>> > require also removing comcom.com, so the
>> > coopthreads is still there. 
>  just to clarify, it's still there but it's dead code as long as you 
>  don't use comcom. Before it was always initialized.
Unfortunately that makes no difference at all: the
coopthreads/qemu problem was triggering only when
comcom or "unix -e" was used. Now "unix -e" is safe,
but comcom, still being a default, keeps the problem
exactly where it was. Initialisation of coopthreads
didnt raised the problem and even using a builtins was
possible.
But I accept the fact that freecom needs some work
before it can be used.


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: App database, libsynth
@ 2003-07-13  0:21 Stas Sergeev
  2003-07-13  0:56 ` Ryan Underwood
  0 siblings, 1 reply; 31+ messages in thread
From: Stas Sergeev @ 2003-07-13  0:21 UTC (permalink / raw)
  To: linux-msdos

Hello.

Ryan Underwood wrote:
>> That means that a potential future DOSEMU for it has to
>>  run "real mode" 16bit apps emulated but can execute 
>> DPMI apps natively.
> Are you certain about emulation necessary for 16bit apps?
Note the "real mode" in the quote above.

> It goes on to say: "compatibility mode is enabled by the
> operating system on an individual code-segment basis.
> From the application's viewpoint, compatibility mode
> looks like a legacy x86 protected-mode environment."
Note the "protected-mode" in the quote above.
See? :)

> Which means to me, that vm86()
You might have confused the v86 mode with 16-bit
protected mode. There is nothing about vm86() in
what you have quoted from the docs.

> will have different semantics on x86-64,
> probably setting up a 1MB v86 window but also turning on the
> "compatibility mode" flag for that process.
That will not give you the v86 mode however.


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: App database, libsynth
@ 2003-07-13  0:29 Stas Sergeev
  2003-07-13  0:59 ` Ryan Underwood
  0 siblings, 1 reply; 31+ messages in thread
From: Stas Sergeev @ 2003-07-13  0:29 UTC (permalink / raw)
  To: linux-msdos

Hello.

Ryan Underwood wrote:
>> In long mode there is no vm86.
> It looked like the long vs legacy mode could be toggled
> on a per segment basis in the rest of the information I
> pasted.  What do you think that refers to?
That refers to that you seem like confusing
the legacy mode with the compatibility mode.
See this about switching:
http://www.x86-64.org/lists/discuss/msg03333.html

For now the decision was AFAIK to not mess with
vm86() in x86-64 linux port. That may sound sad
for us, but I guess they had some reasons for
doing so.


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: App database, libsynth
@ 2003-07-13  2:37 Stas Sergeev
  2003-07-13  5:00 ` Ryan Underwood
  0 siblings, 1 reply; 31+ messages in thread
From: Stas Sergeev @ 2003-07-13  2:37 UTC (permalink / raw)
  To: linux-msdos

Hello.

Ryan Underwood wrote:
>> Yes. But I was wondering will they be able to use dmix
>>  both. Is it available via the OSS emulation layer at 
>> all?
> Unfortunately not without the wrapper.  The dmix is done
>  in userspace, so writing to /dev/dsp kernel device would
>  bypass it.  The aoss wrapper intercepts those writes and
>  puts them through alsalib instead, allowing dmix to be 
> used.
That practically means using dosemu's OSS output
plugin will not be possible that way. It does all
the possible things to make it not compatible
with any redirectors. Leaving apart the nonblocking
I/O, it also writes a partial fragments, demands
the precise quering of a current buffer load and
all the other weird things, so it is not compatible
even with most of the third-party OSS drivers.
But have you tried it with aoss? I have to port my
pcsp driver to ALSA before I can do that.

> The PC speaker would seem to fit that model, so if you 
> have some emulation code, I should be able to include it.
Unfortunately I don't have anything like that.
The program I was referring to, was written in
Pascal.
You can also have a look in my pcsp driver, but
it does only the PCM->PDM conversion and not
the vice-versa (no recording via speaker:),
and also the code there is complicated by a
software amplification tricks.
Finally you may want to steal the code from a
dosbox, but it is in C++.
There are some explanation about PDM (aka PWM)
on the net in case you are wondering:
http://www.wikipedia.org/wiki/Pulse-width_modulation
http://www.powerdesigners.com/InfoWeb/design_center/articles/PWM/pwm.shtm
http://www.netrino.com/Publications/Glossary/PWM.html

> If the timidity/mt-32 emulator becomes an ALSA sequencer
>  client (which is the optimal situation so it can be used
>  in any ALSA application), how would dosemu/midid support
>  it?
No modifications at all. See sound-usage.txt
about how to use dosemu->ALSA->timidity. This
is quite fundamental and doesn't require midid.
But to keep the midid up-to-date, probably some
small modification to the midid's timidity
frontend will be required, as currently it
assumes that only GM is supported. That is for
the OSS users, as ALSA users doesn't need midid
at all.

> Interesting.  What about making the ALSA sequencer a 
> backend for midid?
No, actually there is an overlap of a functionality.
midid is also a kind of a sequencer. It receives the
same data on input the alsa sequencer receives. It
can't work after/before the ALSA sequencer because
they are doing the similar job. Only the output is
different: midid talks to timidity's server interface,
while alsa talks to timidity's alsaseq interface.

> So under longmode there will be no more vm86() and we 
> will definitely need to use QEMU.
Unless someone will finally implement it, which
is unlikely but not impossible: after all also X vesa
driver uses it, and so does wine, so there might be
some motivation after all...
The syscall will have to switch the CPU between the
longmode and the legacy mode, which is possible, as
per the link in a previous posting.

> So the "compatibility mode" is only good for running the 
> 32-bit applications while in longmode. Correct?
No: 16 bit is also OK.

> I think most people will be using longmode on AMD-64 
> anyhow, so we should get the fast CPU emulation going as 
> soon as possible.
The speed is not a problem on that CPUs I
guess. The problem is to make a relatively bug-free
CPU emulator. Lets see if the qemu people can do
that, otherwise qemu will add bugs to dosemu, while
dosemu has plenty of its ows ones:)

> Side effect of the CPU emulation : can we do things with
> it like run Win95 or other VCPI program underneath
> DOSEMU?
I think it will be possible. Right now qemu can
run Linux kernel itself, so running
linux->dosemu->qemu->win95 might also be possible.


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: App database, libsynth
@ 2003-07-13 19:50 Stas Sergeev
  2003-07-13 21:27 ` Ryan Underwood
  0 siblings, 1 reply; 31+ messages in thread
From: Stas Sergeev @ 2003-07-13 19:50 UTC (permalink / raw)
  To: linux-msdos

Hello.

Ryan Underwood wrote:
> Just tried aoss.  It didn't work too horribly on the ones
>  I tried (Duke3D, Hardball III).  The sound warbles and 
> there are lots of clicking, but overall it could be a lot
>  worse.
Better than I expected, at least a nonblocking
IO is not a problem. But all that clicks and
underruns you see are most likely due to an
inaccurate buffer load reporting. It is difficult
to report the "expected" buffer load after the
resampling and mixing are performed.

> Just to make sure, the PC speaker needs no programming 
> besides writing to the two hardware ports, correct?
Which ones do you mean?
There is only one port to control the
speaker - 0x61. But one have to also
program a PIT channel 0 and 2 to do the
PWM, which uses 3 more ports.
So you have to define the interface for
client to provide the timestamps to your
lib for the decoding.

> Hmm, so what's the best way to use a OPL3-emulated 
> sequencer from dosemu?
The *only* way I can think of, is simply
passing the raw data that the app is writing
to the OPL3 ports.
Midi is an absolutely different thing here.
Dosemu emulates the MPU-401 UART, so for
midi it is able to produce the raw midi stream
which can be interpreted by midid and passed
to a sequencer (or handled internally by one
of the midid plugins).

> If I make it an ALSA client, people using midid will not 
> be able to use it.  If I make it a server application 
> that midid talks to, it is less flexible for the people 
> who could use it through ALSA applications.
There might be some misunderstanding.
The OPL3 software synthesizer can be used in
two ways:
1. It implements a sequencer interface *for midi*.
The app (like midid) writes the midi messages
to it, and the lib is trying to generate some music
for them (yes, OPL3 is not very good for midi
I would say, but I know several DOS  midi players
that can use OPL3 as an output device).
This is good to have in general, but it
has zero use for dosemu. Dosemu/midid can work with
timidity, which does much better than an OPL3
synthesizer can do for midi.
2. It implements an OPL3 emulator, i.e. provides
its ports and produces some sound output (or the
midi output, like the bochs does IIRC).
In this case only dosemu can use it, but then
it will be used not for playing midi (which is
done by timidity much better anyway), but rather
for emulating the Adlib.

So:
>> If I make it an ALSA client, people using midid will 
>> not be able to use it.
You seem to be talking about the way (1) here.
I am sure midid doesn't need to use your libsynth
at all because it can use timidity. OTOH writing
an alsa-alike plugin for midid is very easy
because it will be much similar to midid's current
timidity plugin.

> If I make it a server application
>> that midid talks to, it is less flexible for the people
>>  who could use it through ALSA applications.
The same, midid doesn't need the libsynth at all,
but it is very flexible and can mimic the alsa.

> I could do both but that takes a lot of time. :)
I think you *have* to do both, otherwise your
lib would be useless.

Overall I might be misunderstanding you, but it
seems to me that you have confused the midi with
an OPL synth, which are very different and orthogonal
things. They have different code pathes inside dosemu
and must have different pathes outside it. So
essentially midid cannot be used for an OPL synth.
In short: you can use OPL synth for emulating an
Adlib, *or* as a midi sequencer (like timidity). For
dosemu it is important to have an Adlib emulation,
because the midi support is already in place, but
you can do both.

>> is unlikely but not impossible: after all also X vesa 
>> driver uses it, and so does wine, so there might be 
>> some motivation after all...
> What does wine use it for?
Dos emulation:)
Wine has an SB and DMA emulation for DOS progs even
AFAIK.

> I think XFree86 uses it for Int10 support too.
Yes, that's what I reverred to as "X vesa driver".

>>> So the "compatibility mode" is only good for running 
>>> the 32-bit applications while in longmode. Correct?
>> No: 16 bit is also OK.
> But not 16-bit realmode applications or 32-bit ring0 
> applications either?
Seems like that.

> Those VCPI-games should be taken care of like that too,
> Privateer, Strike Commander et.al.
I don't understand why the game would require a
ring-0 access. I think that is a bad design so I
wouldn't care too much about it. The authors must
fix that games, use a proper extender or whatever.
I hope there are not too much of those.
But VCPI would be good to have after all:)


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: App database, libsynth
@ 2003-07-14 17:43 Stas Sergeev
  2003-07-14 21:06 ` Ryan Underwood
  0 siblings, 1 reply; 31+ messages in thread
From: Stas Sergeev @ 2003-07-14 17:43 UTC (permalink / raw)
  To: linux-msdos

Hello.

Ryan Underwood wrote:
>> Overall I might be misunderstanding you, but it
> Definitely not :)
Then why do you think it is necessary for
midid to use your server? For overall
completeness? Do it an ALSA-compatible I
would say, and if someone is ever to find
it usefull for midid to talk to your OPL3
server, that can be easily implemented, but
I don't think it can have any use.

> However, the user might like to use an OPL-emulated chip
> for playing MIDI music from DOS programs that don't
> support OPL for music.
Yes, but what's the use? What is the use??
Is it because someone have a very limited
internet connection to download the timidity
and all the samples for it? Or too slow CPU
to power up the timidity? But I think MAME
OPL emu eats even more CPU than the timidity
does:)
OK, never mind. If you do that lib and you
think it is usefull for midid to be able to
use it - then it is.


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: App database, libsynth
@ 2003-07-17 16:07 Stas Sergeev
  2003-07-17 23:09 ` Ryan Underwood
  0 siblings, 1 reply; 31+ messages in thread
From: Stas Sergeev @ 2003-07-17 16:07 UTC (permalink / raw)
  To: linux-msdos

Hello.

Ryan Underwood wrote:
> The design is simple to me.  The programmer of the 
> application need do nothing but SynthOpen the correct 
> devices, and then SynthWrite the data to them.
Sounds good. It would probably be a good
idea to provide an optional way to query
user's time and request the timer events
from user. It may be that the user's time
is different than the real time. dosemu
uses the real time, but AFAIK dosbox uses
the emulated time (CPU-emu relative).
It may also be possible that the real card's
sampling rate is not very precise (the pcsp
driver rounds the sampling rate rather cruely),
in which case you'll have one more timing
source with which you also have to keep in
sync. Last time I dealt with all that mess,
it wasn't very simple (see linux_sound.c :)

> Plan to support the following synths in the library, all 
> can be either hardware or emulated:
How are you accessing the hardware btw?
ioperm() ?

> or DMA and such are not candidates.
Yes, DMA is out of question, that's for sure.

> The OPL-chip has an internal IRQ but it can be triggered
> or cleared by simply writing to the OPL's port.
AFAIK it is not even connected to any of
the PIC wires, but why can't you provide an
optional way to notify the user about an IRQ?
Simply calling the user's registered call-back
function might just do the trick, so why not?


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2003-07-17 23:09 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-10 17:20 App database Stas Sergeev
2003-07-11 17:30 ` App database, libsynth Ryan Underwood
  -- strict thread matches above, loose matches on Subject: below --
2003-07-11 19:02 Stas Sergeev
2003-07-11 19:59 ` Ryan Underwood
2003-07-11 20:23   ` Bart Oldeman
2003-07-11 22:03     ` Ryan Underwood
2003-07-12 20:57       ` Bart Oldeman
2003-07-12 22:40         ` Ryan Underwood
2003-07-12 16:30     ` Jan Willem Stumpel
2003-07-12 19:03       ` Ryan Underwood
2003-07-12 20:13         ` Jan Willem Stumpel
2003-07-12 19:19       ` Bart Oldeman
2003-07-12 23:47 Stas Sergeev
2003-07-13  0:50 ` Ryan Underwood
2003-07-13  0:09 Stas Sergeev
2003-07-13  0:21 Stas Sergeev
2003-07-13  0:56 ` Ryan Underwood
2003-07-13  0:29 Stas Sergeev
2003-07-13  0:59 ` Ryan Underwood
2003-07-13  2:37 Stas Sergeev
2003-07-13  5:00 ` Ryan Underwood
2003-07-13 19:50 Stas Sergeev
2003-07-13 21:27 ` Ryan Underwood
2003-07-14 17:43 Stas Sergeev
2003-07-14 21:06 ` Ryan Underwood
2003-07-15  8:38   ` Paul Eggleton
2003-07-15 10:10     ` Ryan Underwood
2003-07-15 12:26       ` Paul Eggleton
2003-07-15 23:48         ` Ryan Underwood
2003-07-17 16:07 Stas Sergeev
2003-07-17 23:09 ` Ryan Underwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox