A singing joystick

Hello,

I have a rather odd question that I’m hoping someone here can help me
with. I have to create a “singing joystick” for playing UT2003 on Linux.
The idea is that singing different notes will result in different
actions in the game. (In case you’re wondering, this is for an art
installation.)

I already have DSP code for converting mic input into pitch and
amplitude measurements. I am hoping that I can write a “joystick” driver
that converts pitch and amplitude to button presses and joystick movements.

Is this the right approach (making my device look like a joystick)? Or
is there some way I could skip past the Linux input core and X and
program directly to SDL’s event-handling code?

I’d appreciate any insights or comments you might have.

Thanks,
Ryan

I would have thought that the most obvious, and most straight forward
way to do this would be by writing a kernel module that acts as a
joystick, that way you can use it as a joystick in any application (e.g.
one for debugging your input).On Mon, 2004-02-16 at 01:17, Ryan Shaw wrote:

Hello,

I have a rather odd question that I’m hoping someone here can help me
with. I have to create a “singing joystick” for playing UT2003 on Linux.
The idea is that singing different notes will result in different
actions in the game. (In case you’re wondering, this is for an art
installation.)

I already have DSP code for converting mic input into pitch and
amplitude measurements. I am hoping that I can write a “joystick” driver
that converts pitch and amplitude to button presses and joystick movements.

Is this the right approach (making my device look like a joystick)? Or
is there some way I could skip past the Linux input core and X and
program directly to SDL’s event-handling code?

I’d appreciate any insights or comments you might have.


http://www.mattsscripts.co.uk/

  • A great source for free CGI and stuff

Hackers do it with bugs.

Why not define your own user SDL events and push them onto the event queue
from your DSP code?

#define MyEvent1 SDL_USEREVENT;
#define MyEvent2 (SDL_USEREVENT + 1);
// etc…
SDL_PushEvent(SDL_Event *event);

JPOn Monday 16 February 2004 01:13 am, Matt Wilson wrote:

On Mon, 2004-02-16 at 01:17, Ryan Shaw wrote:

Is this the right approach (making my device look like a joystick)? Or
is there some way I could skip past the Linux input core and X and
program directly to SDL’s event-handling code?

I would have thought that the most obvious, and most straight forward
way to do this would be by writing a kernel module that acts as a
joystick, that way you can use it as a joystick in any application (e.g.
one for debugging your input).

Ryan Shaw wrote:

Is this the right approach (making my device look like a joystick)? Or
is there some way I could skip past the Linux input core and X and
program directly to SDL’s event-handling code?

Matt Wilson wrote:

I would have thought that the most obvious, and most straight forward
way to do this would be by writing a kernel module that acts as a
joystick, that way you can use it as a joystick in any application (e.g.
one for debugging your input).

j_post wrote:

Why not define your own user SDL events and push them onto the event queue
from your DSP code?

#define MyEvent1 SDL_USEREVENT;
#define MyEvent2 (SDL_USEREVENT + 1);
// etc…
SDL_PushEvent(SDL_Event *event);

These two replies seem to correspond to the two possibilities I
mentioned in my original post. I think I would prefer the 2nd approach,
since it seems more straightforward and this isn’t intended to be a
general purpose input device.

But here is where I get a little fuzzy: this needs to work with UT2003,
not event handling code I’m writing myself. How do I know I’m pushing
events onto the same queue that UT is reading from? (I apologize if this
is a stupid question.)

Ryan

But here is where I get a little fuzzy: this needs to work with UT2003,
not event handling code I’m writing myself. How do I know I’m pushing
events onto the same queue that UT is reading from? (I apologize if this
is a stupid question.)

You need to modify the version of SDL that comes with UT to have a new
joystick driver.

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment