G3 sound recording
I just updated the PowerPC Mac dmasound driver so it will also record. It still needs some work, but the framework is there for anyone to update and it is useful.
I did the development on my PowerBook G3, and will soon test it on my iMac.
The driver supports the standard sample rates and the signed/unsigned 8- and 16-bit PCM data format. It does not support A-law or u-law because I have not yet taken the time to integrate the conversion algorithm.
To the mixer read/write recording source I added the SOUND_MASK_MONITOR because the AWACS has the "loop through" capability. When this is set, along with your recording input selection, the audio input will be sent to your selected audio output (along with giving you the data). This is the way the audio CD players work, so if you turn this off don't be surprised when an audio CD program may not play. If this was not the right mask to use for this purpose, will someone with more knowledge please tell me what is correct.
The driver runs full duplex, you can play and record at the same time. In fact, I tested it this way with a loop back program. Multiple threads and an extra slop buffer help out here.
I left plenty of things for others to do :-). Also, be careful when requesting data formats. The driver will report more than are supported by the recording side, since it can also play A-law and u-law. I don't know the "right" thing to do here, since there is only one method to get formats (I know, fix the record side :-).
Thanks to everyone that helped out, including the folks that started the work and to Paul for the documentation.
Now, back to the 8xx and 82xx updates.......
Have fun.
-- Dan
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]
Sound stuff (was Re: G3 sound recording)
Quoted 9 lines · Dan Malek
To the mixer read/write recording source I added the
SOUND_MASK_MONITORbecause the AWACS has the "loop through" capability. When this is set, along with your recording input selection, the audio input will be sent to your selected audio output (along with giving you the data). This is the way the audio CD players work, so if you turn this off don't be surprised when an audio CD program may not play. If this was not the right mask to use for this purpose, will someone with more knowledge please tell me what is correct.
First, that's awesome Dan. =)
Second, this reminded me of two sound things, both about the CD player. 1) If I'm playing an mp3, any sox output (like Licq's notifications) gets played after the mp3 has finished. Kinda like Windows, except the sound does eventually play instead of getting dropped. But, if I'm playing a CD, I can hear ICQ messages fine, simultaneously (more like the Mac OS). I assume this is because the kernel would have to mix the sounds itself in the first case, and the sound chip does it in the second? I guess this is a Linux limitation, but does any kernel hacker have a quick hack so sounds get dropped instead of queued? I don't really like getting 10 "uh-oh"'s when a song finishes because I've been having a conversation.
The other thing was, does anyone remember the CD audio volume level being adjustable before? I've been using 2.2.x for a while, and all I get is the left channel either on or off. I could have sworn I used to be able to actually adjust both channels's volumes to whatever I wanted (maybe in 2.1.x?). Am I remembering this wrong?
-Hollis
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]
Re: Sound stuff (was Re: G3 sound recording)
Quoted 1 line · Hollis R Blanchard
First, that's awesome Dan. =)
Thanks. I haven't seen my CVS update mail message yet, so I don't know where the bits really are :-). I did enough to help out my other projects. I am doing lots of embedded audio projects, and just needed a way to record various samples on my PowerBook. This works for me, and unless I find some bugs in this basic feature I probably won't be making any more updates.
Quoted 1 line
Second, this reminded me of two sound things, both about the CD...
When you are playing mp3, it is using the dma sound driver to send those bits to the AWACS and out the audio port. The play functions (which I didn't touch and hopefully didn't break :-), give precedence to the data you are writing. Any kernel generated audio (like beeps) are discarded.
The audio driver is an exclusive use device (play and record are separate). If multiple programs are trying to open, the later ones wait until the current program closes and then the later program starts running. Now, keep in mind you can separately open the read and write. When you get around to making ioctl()'s, the driver doesn't track anything so you could have two threads or programs fighting each other for capabilities.
When you are playing an audio CD, the analog sound from the CD is just mixed in the output stage along with the samples you are playing from any program. This is why you can play an audio CD without any processing overhead, and why you also get the kernel (or program) generated audio samples. If you want, you can now switch the CD to become an recording input, read the data into a program, and then write it back out. Lots of cycles I would rather spend on something else :-).
The kernel certainly doesn't do any kind of audio mixing. It is more then just adding the bits and should be done by an application program that knows this. The sound drivers just enable hardware capability, and provide a buffering path for PCM samples to applications.
Quoted 1 line
The other thing was, does anyone remember the CD audio volume...
I played around with volumes and gains from my test program. If you send the right parameters through the ioctl() it seems to work. I didn't download any player/mixer sources to see how this is done.
By the way, I thought someone (Cort?) has a program that would intercept the volume/mute buttons on the PowerBook and perform the volume operation. If not, I can write this. Maybe I can do something similar to the screen brightness and intercept these in the kernel and just "make it happen". This value must also be stored in NVRAM someplace. Anyone know where?
-- Dan
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]
Re: Sound stuff (was Re: G3 sound recording)
In reply to Hollis R BlanchardQuoted 5 lines · Hollis R Blanchard
Second, this reminded me of two sound things, both about the CD player. 1) If I'm playing an mp3, any sox output (like Licq's notifications) gets played after the mp3 has finished. Kinda like Windows, except the sound does eventually play instead of getting dropped. But, if I'm playing a CD, I can hear ICQ messages fine, simultaneously (more like the Mac OS). I assume this
This can be fixed in part by esound and esound compliant apps. Ie: stick x11amp into esd mode, and find an icq client that can send its sounds to esd. Then you'll here 'em like in MacOS.
---
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]