Sunday, April 10, 2011

A new day brings some new stuff for an old IZ2S.

Remember that bit about the double trouble?  Well, forget it.  Sometimes I have no idea what I'm talking about. 

I still don't really know what prevents me from puting a working libasound together.  It could simply be one of the zillions of ALSA config files is busted for all I know.  However I was successful with the salsa embedded ALSA lib.  I managed to build it and actually got some test programs from a beat up old Linux Journal to work.  I played with these for a bit, did some reading about "safe ALSA", and compared the way SDL wanted to use ALSA to the working mpg123 and aplay executables.  It turns out the simplistic buffering strategy used by SDL is probably ok for games, but not so good for gapless music playback on a stressed out low MHz linux box (like the zipit running IZ2S).  So I mercilessly hacked the SDL_alsa_audio.c file to make it behave more like the other programs.  Then I built a new libSDL with my changes, and with the tiny salsa library built right in. 

If you like, you can replace the old libSDL in IZ2S with sdl-salsa-iz2s.zip.  Then set SDL_AUDIODRIVER=alsa instead of dsp and go.  I recycled some rather under-utilized SDL_ALSA environment variables, just in case you want to play around and adjust the buffering scheme.  These are (lightly) documented in a text file included with the lib.

I also put together a real gmu-0.7.2-iz2s.zip package with the new libSDL since it no longer skips on IZ2S.  I must say GMU is really handy for debugging the audio code.  It's well written and easy to follow, unlike the gigantipus that is rockbox. 

I happen to like rockbox though.  So I rebuilt the IZ2S version with a more recent branch of code.  It has better (but not quit perfectly smooth) battery monitoring.  It can now change codecs on the fly and it no longer needs to move config files in and out of the /tmp directory.  It also seems to quit after 10 minutes on pause.  Perhaps that might help with the IZ2S power management?  I also let it use the standard linux file structure which prefers to install in the /usr/local directories instead of the embedded setup using the /.rockbox directory.  I'm not sure how much I like that, but for now it lets me keep the old and new versions installed at the same time for testing.  Here it is.  rockbox-iz2s-t11.zip

Finally, here's an ebindkeys executable for IZ2S with a setup to make the home key launch rockbox.  That's a single easy to find button so I can start it up in the car at night without turning on all the lights.  And here's another tip for the car.  Add a line to the startup script to soft link your music directory to /audio so it's right at the top of the rockbox file browser for quick and easy access.


Update:  It's a bit trickier to install rockbox themes on the new release.  You'll need to CD to the share directory on your SD card and temporarily rename the rockbox directory in there to .rockbox.  Then you can unzip an Ipod Video theme into the .rockbox directory.  Rename it to back to rockbox and you're done.

Also, unlike rockbox GMU only allows one key binding per function.  With the wide variation in default key mappings among IZ2S versions, this means that sometimes the volume is controlled via the +/- keys on the side of the zipit, and sometimes you'll have to use the prev/next keys.   So if you're using IZ2S 2.04 with it's default keymap and you want the volume controls on the side then you should edit the gmuinput.z2.conf file and near the bottom replace this:

Button73=280,Volume+
Button-74=281,Volume-


with this:

Button73=270,Volume+                                                                         Button74=269,Volume-
                                                                                                     
I suppose I could try to patch the code to work around this limitation.  Or maybe distribute several different GMU config files with the package.  I'll make a decision someday...

No comments:

Post a Comment