Saturday, October 29, 2011

Linux: Flash: Sound doesn't work because a USB webcam is default playback device

A new USB webcam appears as the default audio playback device, this makes sound stop working for everything. Initially tried adding a ~/.asoundrc file like described here but this doesn't work because nothing can share the sound device anymore once the first program that uses sound places a lock on the device. There seems to be some variations (using dmix) of this thought as well, but they don't work either (or I couldn't get them to).

When you cat the sound device modules as so:

$ cat /proc/asound/modules
 0 snd_usb_audio
 1 snd_hda_intel
 2 snd_hda_intel


Then one can see that the USB device is the default, or at least the first, and changing the order might be helpful. This comment from here provided the solution:


Chuck Ebbert 2007-06-06 15:07:16 EDT
One thing to try is adding the line:

 options snd-usb-audio index=1

to /etc/modprobe.conf

The comment is old, probably, as there is no modprobe.conf in Slackware (or Redhat uses a different init standard?), but there is a modprobe.d/ folder with a collection of .conf files, so I added a snd-usb-audio.conf with the single line:

options snd-usb-audio index=2

Reboot and then the list of sound modules now looks like:

$ cat /proc/asound/modules
 0 snd_hda_intel
 1 snd_hda_intel
 2 snd_usb_audio 

Which makes audio work again, and it can be shared among several applications at once.

Wednesday, October 19, 2011

Old and large programming projects don't go away easily

You never know how long code you write might be around. In this case, almost 20 years.

Here is the "prototype" of the "toolbox" being shown in the "ITouch" program that I wrote in 1993 (yes, that "i-everything" was popular back then). The concept was around a idea by a friend who had an idea to develop a kind of digital brochure (sort of before the Internet). The brochure could be run off of a disk (yes, a floppy disk) or from a kiosk. It involved the use of a editor that would allow you to create several screens with buttons (e.g. "links") and text and pictures (which for 1992, weren't very good I'm afraid. This code is running from dosbox (yes, the code is that old) and using the MetaGraphics driver (you could compile for either Metagraphics or the BGI).


The dialog with the blue buttons is the "screen" being edited by using the iTouch editor. The snapshot is from the initial work on a point of sale system called "Alliance" (no longer in business) when I was recasting the idea towards the design of order entry screens (with more editing capability) where you could place objects from a library of POS functions on any number of screens. I don't know how unique the idea was at the time. Most of the systems, including RapidFire that I worked on as well, used a fixed-grid kind of arrangement of function placement, and limited the user on how many or what size buttons they could have.

And now, almost 20 years later, the code is still running in a point-of-sale system I helped write in 1994-2000 on Youtube here. (Note, the system was sold, so it's not the same company anymore).


The way the narrator stumbled around making the icon actually display makes me cringe though, but icons weren't something I really supported beyond a simple array of colored pixels, so I suppose it's something of an improvement to support PNGs.

In 1992 when I started writing the code, I hadn't heard of the Internet, and of course "Youtube" wasn't something anyone had thought of either. It's interesting to see it still being used though, almost 20 years later.

I suspect the copyright notice in the code has been removed though:

//------------------------------------------------------------------------//
// Code Name: "Panthera" (tm)                                             //
// Copyright (c) 1994 by C.I.A., All rights reserved.                     //
//                                                                        //
// GXL Graphical Interface Library                                        //
// Copyright (c) 1992-1994 by Kevin Hise, All rights reserved.            //
//                                                                        //
// GXL Streamable Objects Editor Components                               //
// Copyright (c) 1994 by Kevin Hise, All rights reserved.                 //
//                                                                        //
// *** Unauthorized possession or duplication of source or executable is  //
// *** strictly prohibited by the authors!                                //
//                                                                        //
//------------------------------------------------------------------------//


So you might have written the code, but don't count on getting any credit. Just look for the "JMJ" initials. *sigh*