-
1 Attachment(s)
Sample 'set Volume' bug?
Hi
I think i have found a bug with the 'set sample volume' command ( see .mfa attachment at ottom of post )
...
The Application is simple:
- The player allways moves to the right, colliding with 4 Barricade Instances on the way.
- When Player Collides with a Barricade a sample "Bash 1" should play and sample volume of "Bash 1" is set to 0.
But althought i set the specific Sample Volume to 0 for each Collision, some of the Collisions still produce Samples wich can be heard ( their Volume is not set to 0 ).
Can someone pleace confirm this?
EDIT: And also the Player looks like hes making a jump in his movement when Colliding with the first Barricade.
-
I think you have to set sample volumes at Start of Frame. Haven't tested this but remember having problems with it ages ago and this should be the solution.
EDIT: or at least before the sample is actually triggered
-
1 Attachment(s)
If you use a value of some kind,.it will work. It's a bug in MMF and has been for awhile. Here's a work around. Run the frame as normal and the second time the objects that's moving comes around press the spacebar before the object collides with the other object or even when or does collide with the object.
-
I think i get how this works now, im pretty sure of it.
It seems like when MMF2 is reffering to a Sample Instance, it is always reffering to the first Instace ( and only the first ) in the Channel que regardless.
...
For example i have this Event:
- Uppon pressing SpaceBar
--> Play Sample "Bonus3"
--> Set Volume of "Bonus3" to 0
If i press 'Spacebar' three times in a row, the Sample "Bonus3" will play on:
Cannel#1
Cannel#2
Cannel#3
But only the very first "Bonus3" Sampel in the que will get muted ( in this case the Sample on Channel#1 ).
...
Im very convinced this is how it works, but if anyone have a different oppinion on this pleace feel free to chip in.
-
SolarB, setting Sample Volume prior to playing the Sample doesnt affect the Sample at all.
-
I didnt uderstand....when u set the volume to 0 you trying to stop this sample? I have not yet started working with sounds, but when you play a sample that have 3 seconds..when finished it sample dont stop?
i'm confused, i'm sorry
-
Ill make a crystal clear example of the problem i am experiencing in a minute.
In the mean time try to understand this:
- MMF2 have 32 Audio Channels
- Each Channel can only play 1 Sample at a time
- When you use the 'Play Sample' action, MMF2 automatically finds the first empty Audio Channel and plays the Sample there ( Im guessing it starts checking at Channel#1 and goes up ).
Pleace do correct me if im wrong.
-
1 Attachment(s)
OK so here is the example ( see .mfa attachment at bottom of post ).
It has only 1 relevant Event 'Uppon pressing Speace' wich plays a specific Sample, and sets the specific Samples Volume to 0.
Further there are Counters displaying data about Audio Channels 1 - 4.
Specifically the data displays #1 if there is a sample playing on the Channel or not ( 0/ 1 ), and #2 the Channels Volum level ( 0 - 100 ).
...
What you can see from the example is that when you play a Sample, MMF2 automatically finds the first empty Channel and plays the Sample on that Channel.
The Event plays the Sample in the first empty Channel, but only changes the Volume of Channel#1.
-
1 Attachment(s)
Here is a better example ( see bottom of post for .mfa attachment ).
- Press "CTRL" to play Sample "Bonus2" 4 times.
- Press "SPACE" to set Sample "Bonus2" Volume to 0 ( mute ).
...
It seems that the Action 'Set Sample Volume' is somewhat flawed.
'Set Sample Volume' allways points to Channel#1 regardless of what Channel/s the Sample is being played on, so for Applications with multisamples ( checked by default in MMF2 ) this Action is missleading and bugged.
-
It may be a bit late (and of course it's always better to use different channels) but the problem can be solved by using:
+on event:
--> stop sample
--> play sample
--> set sample volume
-
Nope
When i 'Stop SampleA', all SampleA instances in any of the channels are stoped see, logical.
When i 'Set SampleA Volume', only the very first SampleA instance in the Channel list changes volume ( although there may be 10 other SampleAs playing on the other Channels ).
You see this is the problem
-
Yes, if you have a longish sample that needs to be triggered in quick succession this is a problem. My method works for short bursts like bullet fire but for your needs the only solution would be to use:
+start of frame
-> set channel (1 to 20) volume to whatever
+event
-> play sample on channel X
-> add 1 to X
+X > 20 (or however many channels you need, depending on the length of your sample and the trigger delay)
-> set X to 1
this would rotate your sample on 1-20 channels all with a set volume.
-
Yes thats true.
But if there are other samples playing ( wich there in most cases are ) on the other channels, there is no way of knowing on what Channels my SamplA Sample is playing and change the Volume of only the SampleA Samples, get it?
...
The best thing i can do is seperate Music and SoundEffects like this:
- Music is Playing on Channel#1
- SoundFX are Playing on Channel#2 -32
Whenever i play a SoundFX Sample ( any SoundFX Sample ) set Channnel#1 -32 Volume to 'Desired Volume'.
...
There is no way whatsoever for me to change the Volume of a Specific Sample, i can only change the Volume of the first Instance of a Specific Sample ( by using the 'Set Sample Volume Action' ).
If i have 5 Instances of EXPLOSION sample playing in the Channel que, ther is no way to know what specific Channels are playing EXPLOSION sampel, and no way of changing or Fading the Volume of just the EXPLOSION samples.
At least no easy way, and no way that i know of.
The Action for changing Sample Volume says
'Set Sample Volume'
when it should say
'Set Sample Volume Of First Sample Instance'
or
This Action should be fixed since it presents itself to do something it does not
-
Since "play sample" happens instantly, there's often delay until the "set sample volume" is applied even if it's the following action (usually as long as the audio buffer itself, 10 milliseconds). This can add a loud "pop" in the beginning of the sound you want to be played with a lower volume. This unfortunately makes "set sample volume" useless for the perfectionist who don't want annoying sound artifacts, even if what you're having a problem with is fixed. One should never play a sample and after set its initial volume, period. If MMF2 was designed right, you'd supply the initial volume/pan/frequency/position within the "play" action itself, and modifying it after would only be for continuous fades and effects. The workaround is that you must always do your own evented channel allocation in MMF2 games. If you're going to play a sound, allocate a channel, stop the channel (to prevent an old sample playing on it to have the new volume for 10 milliseconds), set the channel volume, and finally play the new sound on the channel.
Anyway, in order to fix your problem, have a look at Looki's sound player and use "play with parameters".
You should also have a look at the wrapper I created. In addition to working its way around all the MMF2 design flaws, it'll also solve all your sound problems easily. It probably takes a bit of effort to learn, but it's very powerful. Download it here.
-
Thanks man!
I realy appreciate this advice :D
I thought i was almost the only one who considdered this to be a valid problem/ issue.
...
Im looking forward to checking out these new objects, but i cant seem to get a hold of any of them at the moment.
When i try to download your Object ( Nifflas Sounds 5 or something ) by following your link, i get directed to a page displaying what i can only describe as a hightly encrypted text document.
How do i download your "wrapper"/ Extencion Object?
Again, thanks for the information
-
Just right click the link to the .mfa and select "save target as...", it's just your browser that's unsure how to deal with the file.
As for Looki's sound object, I'm not sure where to get it. Perhaps try ExtensionView?
-
It's in extension view, but it's not supported in Flash.
-
-
Ah, okay. You don't actually need the object for my advanced sound thing. The only reason I have it there is to let you pick sounds from an expression. On the downside, to make it work without Looki's object, you'll need to wrap separate "play sample on channel" events into the part that plays the sounds. One for each sound. Super annoying.