Author Topic: Cuing code with sound resource cues  (Read 3584 times)

0 Members and 1 Guest are viewing this topic.

Offline MusicallyInspired

Cuing code with sound resource cues
« on: August 26, 2010, 02:51:39 PM »
So I'm playing around with sound resources and scripts. After successfully creating a custom sound resource in Soundbox fully compatible with Adlib, MT-32, Tandy 3-Voice, and the PC Speaker, I wanted to start utilising the sound resource's cue ability. You can set the Sound resource's cue points and their data with Soundbox. That I did no problem. What I have a problem with is figuring out how to use this in a script. I've been mulling over the Sound class and sound-related kernel functions but it's not coming easy to me.

I'll be using this thread to post any of my findings and discoveries. If anybody else has some insight please feel free to post it here.


Brass Lantern Prop Competition

Offline lskovlun

Re: Cuing code with sound resource cues
« Reply #1 on: September 23, 2010, 05:59:02 PM »
Hi Brandon,

I meant to write this sooner, but... oh well. This is off the top of my head an untested:
There are two ways of doing what you want, either you write a Script
instance or else you handle it in a doit method somewhere. The most
flexible way uses the doit method; it is more complicated to support
looping sounds with the script method, for instance. If you use the
script method, you specify a script as a parameter to the play
method. The script then gets cued whenever a cue is hit - you can
pick out which one by looking at the signal property of the
sound if you want to differentiate. If you use doit, you should
instead check the prevSignal property. Also, if you use a
script, you'll want to be mindful of timing issues if characters are
moving about on the screen (this is called a "race condition", in case
you didn't know). Conversely, I find the script method to be easier in
simple cases.

Regards,

Lars

Offline Cloudee1

Re: Cuing code with sound resource cues
« Reply #2 on: September 23, 2010, 06:49:19 PM »
I'd just be happy knowing the sound "rules." For instance internal speaker craps out if two notes overlap, so one instrument (they all just beep anyway) one note at a time. For the other options, does the instrument bank in anvil studio line up with  the actual  instruments used during playback. Any other note limitations. Help a brother out with getting at least some knowledge.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline MusicallyInspired

Re: Cuing code with sound resource cues
« Reply #3 on: September 24, 2010, 08:20:55 AM »
The PC Speaker should have its own channel (channel 1) which plays only one note at a time. This channel should be reworked so that it contains a mix of the more important sections of a song. That is, you can't have 2 PC Speaker channels and expect them to figure out which notes to play before others. Same thing with 2 notes playing at the same time in the same channel. You have to manually edit the sequence so that it's one note at a time in one channel.

Usually this channel is also the first of 3 channels used for Tandy 3-voice (each playing one note at a time).

MT-32 channels are from 2-9 as those are the only channels the MT-32 can read conventionally in a game. Some of these channels can be shared with Adlib channels as well. Altogether Adlib uses a maximum of 5 channels, I believe. I'll double check, though. I also can't remember right now what the polyphony limit is. I think it's 7 constant notes from all 5 channels at a time but I'll double check. I looked at a sound resource from KQ1SCI as an example which I tried to copy the format of and that's how I discovered these rules.

Note, for Adlib, if you use the ADL.DRV it'll ignore the panning MIDI information and have that low polyphony limit. If you use SNDBLAST.DRV that I provided with those SCI sound utilities it'll use the panning information and will not have such low polyphony. I think you can conceivably get the same polyphony level as an MT-32 which is much higher than 7, yet not unlimited.
« Last Edit: April 07, 2016, 10:40:13 PM by MusicallyInspired »
Brass Lantern Prop Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.035 seconds with 23 queries.