Mail Archives: djgpp/1997/03/11/10:37:22
In article <5g0lr3$s0e AT news DOT ox DOT ac DOT uk>, George Foot
<gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk> writes
>David Jenkins (me AT jenkinsdavid DOT demon DOT co DOT uk) wrote:
>: Is it possible to detect when a certain sound is played in a midi file??
>
>: I want to have the music in my demo affect something on the screen.
>: Like make the background flash whever the drum is hit.
>: Finding the volume of the sound would be perfect.
>: If the above drum noise was loud the screen would flash bright, if it
>: was quiet it would flash grey.
>
>You could make your own custom versions of the midi file routines, and
>links these in instead of Allegro's. Since Allegro comes as source, this
>shouldn't be difficult.
>
>Alternatively, you could monitor the midi_pos (?) variable, which is
>the beat count through the file.
What I really want to do is monitor the volume of each of the *noises*
as they're played.
Shawn sent me this via email in response to my original post.
I think the guys busy enough, so I don't like asking him to waste time
he could be using on something Allegro'ish ;-)
I don't think it really belongs in the main lib: it's a very specialised
requirement...
But the change is trival to make: what do you mean, you can't handle it?
Edit midi.c, go to that line, type in:
if (vol > 0)
myfunc(channel, note, vol);
or something like that, and there you have it! The channel is a MIDI
channel number (0-15, drums are on channel 9), the note is the pitch, or
which drum sound if the channel is 9, and the volume is 0-127.
******
I've found the line he's refering to, but I don't know what to add.
I figure the idea is to add some global variables which I could monitor
in MY main().
If anybody wants to "walk" me through what I should add, I'd be
grateful.
--
http://www.jenkinsdavid.demo.co.uk for Newbie C programers and a larf. ;-)
David Jenkins
- Raw text -