Difference between revisions of "A/V Control Commands"
Line 31: | Line 31: | ||
MD0.wav | MD0.wav | ||
+ | |||
MD1.wav | MD1.wav | ||
+ | |||
MD2.wav | MD2.wav | ||
+ | |||
MD3.wav | MD3.wav | ||
Line 42: | Line 45: | ||
MDA.wav | MDA.wav | ||
+ | |||
MDB.wav | MDB.wav | ||
+ | |||
MDC.wav | MDC.wav | ||
+ | |||
MDD.wav | MDD.wav | ||
Line 55: | Line 61: | ||
L1A.wav -Four different voices for Shot 1 | L1A.wav -Four different voices for Shot 1 | ||
+ | |||
L1B.wav | L1B.wav | ||
+ | |||
L1C.wav | L1C.wav | ||
+ | |||
L1D.wav | L1D.wav | ||
L2A.wav -Four different voices for Shot 2, and so on | L2A.wav -Four different voices for Shot 2, and so on | ||
+ | |||
L2B.wav | L2B.wav | ||
+ | |||
L2C.wav | L2C.wav | ||
+ | |||
L2D.wav | L2D.wav | ||
+ | |||
Techniques like these can greatly randomize your audio and keep it fresh every time! | Techniques like these can greatly randomize your audio and keep it fresh every time! |
Revision as of 18:19, 21 September 2014
These are the commands you call from the main game kernel to control the Propeller A/V. Most commands do not return a value unless noted.
playSFX(which channel, which folder, clip0, clip1, priority)
Example:
playSFX(0, 'B', 'A', 'A', 255);
Plays audio file "BAA.wav" from the SFX/_FB folder on Channel 0 at top Priority.
Use channels 0-2. Channel 3 is reversed for music (usually always playing)
If a sound file is currently playing on Channel 0 at a higher priority than an incoming sound, then the new sound will not play. What I tend to do is use channel 0 for voice prompts, channel 1 for mid-table sound effects (targets, slings etc) and channel 2 for back of the table sounds (pop bumpers and rollovers) This helps "space out" the sounds during a multiball.
As an example, run your normal pop bumper sound on channel 2 with a priority of 250. Then, if you have a "Super Pops" sound or callout, use the same channel but with a priority of 255. Reason for this is let's say you get 50 pops and it says "SUPER POPS!" Now you'll probably get additional pop hits while this voice plays. By calling the voice at 255, and the pops at 250, it ensures the normal pop sound won't override the voice prompt until the priority 255 voice prompt finishes.
It might be tempting to avoid this by using different channels all the time, but the problem there is you may have voices overlapping which sounds bad.
The 3 characters must be valid ASCII filename characters, and the first character MUST be A-Y (to match the folders). The sound data is subdivided into folders to greatly reduce search time (worst case is 5ms, usually less)
You CAN however mix and match variables to create randomized or progress-based callouts. For example:
playSFX(0, 'M', 'D', '0' + random(4), 255);
Will randomly pick from:
MD0.wav
MD1.wav
MD2.wav
MD3.wav
What is does is takes the ASCII value of '0' (48) and adds a random number between 0 and 3 to it. Or you could also do this:
playSFXQ(0, 'M', 'D', '@' + progress, 255);
Progress variable would increase every time you make a shot, so the clips could be labeled:
MDA.wav
MDB.wav
MDC.wav
MDD.wav
Notice how we start with '@' (64) and then add Progress? That's because making the shot increments Progress by 1, so it will never be 0. 64+1=65 which is the letter A.
AMH took this a bit further with code like:
playSFX(0, 'L', 48 + hotProgress[player], random(4) + 65, 255);
So for each shot that advances the Hotel, there are 4 random phrases per shot.
L1A.wav -Four different voices for Shot 1
L1B.wav
L1C.wav
L1D.wav
L2A.wav -Four different voices for Shot 2, and so on
L2B.wav
L2C.wav
L2D.wav
Techniques like these can greatly randomize your audio and keep it fresh every time!
playSFXQ(which channel, which folder, clip0, clip1, priority)
Example:
playSFXQ(0, 'B', 'A', 'A', 255);
Works just like playSFX but queues the clip to play once whatever is already playing in that channel finishes.
Let's use Attack from Mars as an example. Destroying the second saucer has the explosion + "Well Done" and then says "Extra Ball is lit". If you needed to do something like this in your game, you'd play the normal sound via playSFX, then queue up whatever is said next with the playSFXQ command. This allows you to separate things out.
In America's Most Haunted, revealing a Ghost Minion triggers a randomized quote. playSFX is used so the character says "It's a class five..." and playSFXQ is used to finish the quote "...Free Roaming Vapor Mist Anomaly!"
In the code it looks like this:
playSFX(0, 'M', 'C', '9', 255); //You can keep beating them, but they only go up to Class 9 video('M', 'F', '9', allowSmall, 0, 250); //Ghost level cap at 9 playSFXQ(0, 'M', 'D', '0' + random(10), 255); //Something Something Specter!
It's a good idea to do something between the SFX calls to ensure the first sound gets going before you enqueue a second.