delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/11/10:37:22

From: David Jenkins <me AT jenkinsdavid DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: midi sound detecting in Allegro??
Date: Tue, 11 Mar 1997 12:58:42 +0000
Organization: None
Distribution: world
Message-ID: <o7fzjXACcVJzEwqf@jenkinsdavid.demon.co.uk>
References: <yATjZAAJO4IzEwya AT jenkinsdavid DOT demon DOT co DOT uk>
<5g0lr3$s0e AT news DOT ox DOT ac DOT uk>
NNTP-Posting-Host: jenkinsdavid.demon.co.uk
MIME-Version: 1.0
Lines: 48
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


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