n505ve_audio, 1999-12-20
Download
A package containing the driver's source, makefile, install script and this document is available at http://www.electricmagic.com/~ag/snippets/n505ve_audio.zip.
Background
The Sony N505VE (and N505VX, I presume) use Yamaha's YMF-744B sound chip. The publicly available documentation for this chip is insufficient to implement a driver using its native API. BeOS R4.5.x ships with a driver that supports a precursor of the 744, the YMF-724. This driver does not recognize the 744 as being a 724, although apparently it ought to work with it. Takayuki ITO's patch, available at http://hp.vector.co.jp/authors/VA001240/archive/index-en.html modifies the shipped 724 driver so that it recognizes the 744. My own experience with this patch is that although the 744 is recognized, and the sound subsystem appears active to the Media preferences app and others, it does not actually play sound -- all I hear is the mike input looped back to the speaker, ie horrible feedback if headphones are not used.
So, I put together this driver which uses the YMF-744B's Sound Blaster Pro legacy support. It is limited in its capabilities, supporting 44kHz 8 bit stereo, which is better than nothing at all. From a program's perspective the YMF-744B supports recording using the Sound Blaster Pro interface. It responds to commands to initiate the grabbing of samples, and does the DMA transfers, but the data it delivers is not derived from the actual sound input -- it just delivers silence, and is documented as doing so. So this driver does not provide any support for recording. And as I'm not interested in MIDI stuff, I haven't put in any support for MIDI operations.
Hopefully Yamaha Corporation will see the light and release full specs for the YMF-744B, at which time this driver can be retired.
Implementation Notes
The driver is written in C++. Although the BeOS kernel does not provide any runtime support for C++, by implementing our own __builtin_new, __builtin_delete and __pure_virtual functions, the code runs just fine. __builtin_new and __builtin_delete just call through to the kernel's malloc and free functions, and __pure_virtual is a no-op (it's actually quite hard to arrange things so that __pure_virtual is called from legitimate code, so having it be a no-op is no big deal.)
The driver makes no attempt to probe for the hardware -- it assumes I/O base address 0x220, IRQ 5 and DMA 1. This is correct on my N505VE, and most likely will be on yours too.
Installation
Double click on the file install, which will build the driver (named n505ve_audio), move it to ~/config/add-ons/kernel/driver/bin/, and set up the necessary symlinks in ~/config/add-ons/kernel/drivers/dev/audio/raw/ and ~/config/add-ons/kernel/drivers/dev/audio/old/. It will then put up an alert asking you if you would like to restart the media server -- answer yes and the driver should be active, otherwise it will become active after reboot.
References and Acknowledgements
Joseph Wang's sbpro driver and install script (thanks Joe).
Be's sonic_vibes sample sound driver.
Sound Blaster Programming Information v0.90.
Yamaha Corporation Document LSI-4MF744B00.
Contact
Any questions, comments or suggestions should be sent to Andrew Green. The driver's permanent home on the web is at http://www.electricmagic.com/~ag/snippets/n505ve_audio.html.
Andrew Green
Electric Magic Company
350 25th Avenue, Suite #1
San Francisco, CA 94121
ag@electricmagic.com
Voice: +1 (415) 831 2471
License
Copyright (c) 1999 Andrew Green. ag@electricmagic.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.