> Can you (or anyone else) direct me to any references/examples for
accessing
> the sound hardware directly?
Peter and I used the DragonBall manuals (both the original 328 and the EZ)
to do background sound in Flytrap before there was OS support for background
sound. Read the chapters on the Pulse Width Modulator (PWM). But you only
need to go directly to the hardware on Palm OS 1.0 and 2.0. I really doubt
you need to support such old OS versions.
It's probably better to use the SndDoCmd API. On Palm OS 3.0 and later, this
can be used to play a single note asynchronously (ie. without blocking). You
need to call it once for each note, but you can do other stuff (such as
processing events) while each note is playing. You just need to keep track
of which note you're playing and when to play the next note.
If you do want to do sound on Palm OS 1.0 and 2.0, let me know. I can send
you sample source code that uses direct hardware access on old OSes and
SndDoCmd on new OSes. If you only want to support Palm OS 3.0 and later,
just use SndDoCmd:
SndCommandType sndCommand;
Err err;
sndCommand.cmd = sndCmdNoteOn;
sndCommand.param1 = <a MIDI note number (0 to 127)>;
sndCommand.param2 = <duration in milliseconds (0 to 65535)>;
sndCommand.param3 = <a volume (0 to sndMaxAmp)>;
err = SndDoCmd(NULL, &sndCommand, 0);
You can specify the duration so the note ends slightly before you start
playing the next note to get a neat staccato effect. You can use sndCmdFrqOn
instead if you prefer to specify a frequency in Hertz rather than a MIDI
note number.
-
Danny
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/