www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/14/13:30:49

From: ovek AT arcticnet DOT no (Ove Kaaven)
Newsgroups: comp.os.msdos.djgpp
Subject: Announcing MIDI & WAVE input for Allegro
Date: Sat, 14 Mar 1998 18:22:50 GMT
Organization: Arctic Net AS
Lines: 91
Message-ID: <350ac901.51124464@isflak.arcticnet.no>
NNTP-Posting-Host: villager.arcticnet.no
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

These have already been announced on the Allegro mailing list, but I
thought people around here not subscribed to it might be interested
too, especially if this is what they have been looking for and not
found in Allegro before.

This is the announce for the MIDI input driver:
=====
I have completed the MIDI input driver for Allegro. It only supports
MPU-401 for the moment, but that shouldn't be a problem. Download it
from http://www.arcticnet.no/~ovek/files/algmid.zip

Installation: pkunzip -d it into your main DJGPP directory. It will
overwrite some of Allegro's files, and create a new directory "music"
that contains music.c, an example program. Recompile Allegro, then
compile music.c, connect a MIDI keyboard, and have fun.

Usage:
Two new API functions have been added, install_sound_input() and
remove_sound_input(), and a global variable midi_recorder. To use MIDI
input, call install_sound_input(DIGI_NONE,MIDI_MPU,0,0,0); after the
usual install_sound(), and set midi_recorder to point to a callback.
It will be called (from an interrupt, remember to lock it) every time
a byte has been received from the MPU-401. Note that Allegro's
midi_out() cannot deal with single bytes, so you must collect them
like I did in music.c before you can pass them on to Allegro's MIDI
player for playback.

If you want to write an add-on that makes it easier to do stuff, so
the user don't have to deal with hooking the interrupt callback
directly him/herself, and does real buffering, timestamping, etc, feel
free.
-----

This is the announce for the WAVE input driver:
=====
I have now pulled myself together and completed the Wave Input Driver
for Allegro. I have added an API, you can now record at 8-bit even
with an SB16 (though it is still not possible to record and playback
simultaneously), and so on. Download it from
http://www.arcticnet.no/~ovek/files/algwav.zip. As before, it needs to
be installed *on top of* my MPU-401 input driver (algmid.zip), and
installed the same way (pkunzip -d in the djgpp directory). It will
overwrite a few files. Recompile Allegro, compile the included
music\wave.c, connect a microphone, and watch the waves.

Any comments or suggestions for improving the design (especially the
API) are welcome.

API:

To initialize the recording system, do it like in the MPU-401 driver:
install_sound_input(DIGI_AUTODETECT,MIDI_AUTODETECT,0,0,0);

Card Capability Inquiries:

get_sound_input_cap_bits() should return either 0, 8, or 16.
get_sound_input_cap_stereo() should return either TRUE or FALSE.
get_sound_input_cap_rate(bits,stereo) returns the maximum recording
sample rate the card is capable of with the given parameters.
get_sound_input_cap_parm(rate,bits,stereo) returns whether the card is
capable of the given parameters (-1 = nope, try another rate, 0
(REC_CAP_UNIDIR) = yes, 1 (REC_CAP_BIDIR) = even without suspending
playback)

Recording:

start_sound_input(rate,bits,stereo) starts the recording, suspending
any playback, and returns the card's DMA buffer size if successful, -1
if not. You need to allocate a buffer of this size for recording
operations.
stop_sound_input() when you're done. It stops recording and restarts
Allegro's normal playback operation.
read_sound_input(buffer,0) gets the just recorded DMA buffer, if
available. Returns -1 if recording is not in progress, 0 if the
current DMA buffer is not ready yet, or a positive value (currently 1)
if it was, and successfully copied to your supplied buffer. Then do
whatever you wish with the buffer, like perform spectral analysis,
save it to disk, or whatever.

Additional Features (same as before):

Autodetection: The SB16 card allows software to read the IRQ and DMA
settings directly from the card. SB16/SB32/etc owners may no longer
need to run setup.exe or set the BLASTER environment variable right, a
boon for SB PnP users with Win95 I think.

Hardware Support:
I've only implemented this for the SB cards, and it is currently not
possible to use two sound cards.
-----

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019