All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] AD1889 OPL3 Synthesis
@ 2005-06-26 14:53 Stuart Brady
  2005-06-26 15:45 ` Stuart Brady
  0 siblings, 1 reply; 2+ messages in thread
From: Stuart Brady @ 2005-06-26 14:53 UTC (permalink / raw)
  To: parisc-linux

I thought I'd explain what's needed to get the AD1889's OPL3 synthesis
working.  (BTW, OPL3 synthesis is pretty primative.)

ALSA provides everything needed to use the OPL3 device.  Most drivers
initialise the hardware if necessary, and then call snd_opl3_create()
followed by snd_opl3_hwdep_new().  snd_opl3_free() is automatically
called by the ALSA layer when the module is unloaded, so there's no need
to call it explicitly.

snd_opl3_create() takes port addresses, so I've had to add a new
function, snd_opl3_create_mapped().  This isn't in mainline 2.6.12 yet.

I'm not happy with the snd_opl3_create_mapped() interface yet...  The
AD1889 driver maps the region containing the OPL3 registers, but the
OPL3 driver does the iounmap().  I've been told that this is the right
way to do it, but it still seems broken.

There should only be one change needed to get the AD1889 OPL3 support
working though.  The DS_SYDA register has to be set, so that it's not
muted, and that the attenuation is set reasonably.  Which is either:

	ad1889_writew(chip, AD_DS_SYDA, 0x3f3f);
	ad1889_readw(chip, AD_DS_SYDA);

or the constant should be 0x0000 rather than 0x3f3f.

I used playmidi for testing.  There are some example MIDI files:
/usr/share/doc/playmidi/examples/*.mid.gz.  Unfortunately, ALSA's OPL3
code has some bugs which affect the quality of the music produced.
Also, playmidi's instruments need some work.

I was getting silence when testing before, but it otherwise appeared to
be working.  There's probably a mixer channel associated with the OPL3
(or SYN, see below) which must be used.  I have no idea which this is.

It seems that if the SYEN bit in the DS_WSMC register is set, this
enables a secondary wave channel (which is called SYN, just to be
confusing) and _disables_ the OPL3 - which results in an HPMC if an
attempt is made to use the OPL3's registers.

The RES channel appears to be take the output of the SYN channel or the
OPL3 (whichever is enabled), resampling it at the rate specified by the
DS_RES register.  It looks as though the SYN channel's sample rate and
format is always that of the WAV channel, which limits its use.
-- 
Stuart Brady
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

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

end of thread, other threads:[~2005-06-26 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-26 14:53 [parisc-linux] AD1889 OPL3 Synthesis Stuart Brady
2005-06-26 15:45 ` Stuart Brady

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.