APTR chandle = AllocAudioChannel(APTR handle, int fmt, int freq, int vol, int (*feedproc)(APTR handle, APTR chandle, APTR buf, int count, APTR userdata), ULONG flags, APTR userdata, struct hwTagList *tags);
fmt
parameter
can be one of the following formats:
HWSMPFMT_U8M:
HWSMPFMT_U8S:
HWSMPFMT_S8M:
HWSMPFMT_S8S:
HWSMPFMT_S16M:
HWSMPFMT_S16S:
Parameter 3 contains the number of PCM frames that will be played on this channel per second. Common values are 44100 or 48000 here. Parameter 4 contains the desired volume for this channel. This can range from 0 (mute) to 64 (full volume).
Hollywood will also pass a pointer to an audio feed procedure to this function. Whenever you need more PCM data to play on this audio channel, call this feed procedure. The prototype of this procedure looks like this:
int feedproc(APTR hdl, APTR ch, APTR buf, int count, APTR userdata); |
Here is how you have to call this feed procedure:
hdl:
ch:
AllocAudioChannel()
.
buf:
count:
feedproc()
call is a reasonable size.
userdata:
AllocAudioChannel()
function here.
feedproc()
returns the number of PCM frames successfully copied. Once again,
be careful that this value is in PCM frames, not in bytes (see above). If this
value is less than you requested, the channel has finished playing and Hollywood
will soon call FreeAudioChannel() on it.
The feed procedure that Hollywood passes to you is thread-safe so you can call this from worker threads or audio interrupts as well.
feedproc()
NULL
)NULL
on error