
astuner 3.0 - The AfterStep Radio Tuner.
By David Muench
cc@spork.neonexus.com
http://www.neonexus.com/cc/

This program uses code from Rob Malda's ascd, and as of 3.0 it also uses
Matthew Kirkwood's Linux kernel radio support. Thanks to both of you.

WHAT IT IS:

This program will control your AIMS RadioTrack or Reveal RadioReveal
FM radio cards. I personally have an AIMS, but the two seem to be identical
with the exception that the AIMS is still made, and Reveal has gone belly
up. If you want one of these cards, Walmart might still have a Reveal one
laying around on the top shelf if you dig, but the company is out of
business. You may not care though since they are $25 or less this way.
If you want an AIMS lab one, their web site is at www.aimslab.com, and you
can purchase them through Tiger Direct (1-800-888-4437). I paid $39.99 for
mine via Tiger, and got a free coaster with it (Prodigy Internet CDROM).
The cards don't require a sound card and have their own small amps on board. 

I've also added a "fake IPC" now. Other programs can now tell astuner to do
things. This is useful for a lot of things. The example program that comes
with it, cmdtuner, can be used to control the radio from the command line. I
use it from my DEC vt220 I have connected to my machine to control the radio
from there. But the real reason it's there is... I recently got a remote
control for my box (from www.onsale.com), and the daemon for that that I am
writing will be able to control astuner now. The idea will be to have all
the little afterstep applets have an IPC like this. So the remote control
(or anything, something like cmdtuner maybe) can control ascd and so on.
Another great usefulness would be an alarm clock. You can now turn on and
off your radio via a crontab and cmdtuner. Pretty neat.

A neat project for someone might be to write a small app that launches when
asclock is clicked on that will add and delete alarms from your crontab.
Ideally you could have it turn on the radio, or start up ascd, perhaps with
a random cd and track using ascdc and a cd changer.. Lots of possibilities.

HOW TO MAKE IT GO:

This program was written under Linux. As of astuner 3.0, it will only work
under Linux. Some people may not like that, but I took an informal survey of
people who use astuner on the afterstep mailing list and they all ran Linux.
If you want to use it on another os, just get astuner 2.0. You'll also need
libXpm and flex (libfl), along with libX11 and so on..

Note to those upgrading: There may be configuration file
changes/additions/deletions. Always check the version history at the bottom
of this file and the sample astunerrc for changes you may need to make to
your config file.

First of all you must patch your kernel with the radio-2.1.29.diff patch.
This patch should work on all recent 2.0.x and 2.1.x kernels. Then
reconfigure your kernel (make config/menuconfig/xconfig/whatever), go into
the sound section, and enable RadioREVEAL support and set your I/O port for
the radio card correctly. Recompile your kernel, install it and reboot (see
the Kernel-HOWTO available at http://sunsite.unc.edu/LDP/ for details on
how to do all of this).  

Also, you need to make a /dev/radio device. Type this to make it:
mknod /dev/radio c 14 15
Note, you must be root to do that. You also must make sure your user has
write access to it. For me that meant changing it's group to my user's group
(chgrp cc /dev/radio) and giving it group read/write access (chmod g+rw
/dev/radio).

Run:
xmkmf
make
make install

The make install step usually has to be done as root.

Copy astunerrc into /etc if you don't already have one, and edit it
according to the comments in there.

Then stick it in your Wharf section of your .steprc:

*Wharf - - Swallow "astuner" astuner &

That's about it. The controls are easy, left-right buttons are station,
the little up/down buttons are volume, the red button is to turn the radio
on and off, and the P button cycles through your presets. Left clicking on
it jumps to the next preset, right clicking jumps back one, and middle
clicking sends you to the start of the preset list. Also, the color
of the station LED's will change depending on how strong the signal is. If
it's well tuned, they will be bright green, otherwise they will be cyan.

cmdtuner is equally easy to use, if you want the help screen just type
cmdtuner with no arguments.

David Muench
cc@spork.neonexus.com
http://www.neonexus.com/cc/

See the file COPYING for the GPL info..

BUGS:

  astuner 3.0 was released with one known bug in it. When the callsigns come
  up in the display, the 3rd letter is partially 'not there'. As if there is
  a splotch covering it. I can't figure this one out. If you have any ideas,
  email me, please.

  Mail me if you find others.

FUTURE PLANS/POSSIBILITIES:

  * Little red indicator that flashes when you push a button <mitch@palmtop.net>
  * Right click on the tuning buttons for fine tuning <mitch@palmtop.net>
  * Major code cleanup <me!>
  * If you have other ideas, email me them. Remember, we are constrained to
    working inside a 48x48 icon here..

REVISION HISTORY:

version 0.1
Original Release (yay it works!)

version 1.0
Added a config file (/etc/astunerrc)
New graphics (complete with a power LED) from Robert Forbes <bokeyf@gte.net>
Fixed a bug (eek!) where if the radio was off and you hit a tuning button,
  the radio would turn on correctly, but you'd have to hit the power button
  twice to get any response to turn it off again.
Added presets! Just define them (up to 20) in the config file.
Added tuning signal indicator

version 1.1
Argh, forgot to remove a line of debugging code that would spew stuff over
  the console. No big deal, but might as well fix it..

version 2.0
Added a fake ipc (InterProcess Communication) system.
Added a new program, cmdtuner, a command line program to tell astuner what
  to do via the new fake ipc.
Now you can right click on the presets button to back up a station, or
  middle click to go to the start of the list. Thanks to Roman Mitz
  <rmitz@milliways.res.cmu.edu> for this nice patch.

version 3.0
Updated that pesky version number from 0.1.. Whoops. :)
astuner now uses the Linux kernel driver for access to the radio card, which
  means it's no longer setuid root.
Fixed tiny typos in the README.
Removed the port command in the config file since the kernel takes care of
  that now and added the device command to tell where your /dev/radio is.
Added station callsigns. It now uses that info from the config file, and if
  you are on a preset station it will switch back and forth from the station
  number to the callsign every 4 seconds. Suggested by bokeyf@gte.net.

