Multiple panned samples?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I want to use sounds in my game to alert the player that an enemy is nearby. I know it is possible to play a sound, and then pan the sound/set the volume according to the position of an object. But is this possible with multiple objects?

    Say I want a bunch of zombies as an example. I want to hear them "moan" before I get around the corner, and that each zombie makes different randomized sounds. As they get closer, the sounds get louder and panned closer to you. This would make a game like this much more "disturbing" :P

  • It is possible, but MMF's sound support could be better when it comes to seperate channels. The basic idea is that you play each moan sample on a separate channel, and then you pan that channel relative to a zombie's position. MMF2 supports 32 channels, so this means that you could do this with up to 32 zombies (and no other sounds). To make it dynamic you'd have to do some looping through "free" channels and your zombies. Alternatively, one of the other sound playing extensions might help.

    Currently working on Please login to see this link..
    Creator of Faerie Solitaire, Stray Whisker, and Dungeon Dash. Known on TDC as AssaultAndy.
    Please login to see this link. | Please login to see this link.

  • Try using multiple sound channels. Have a counter, let's call it sound_channel, that keeps track of the 'current' sound channel. Whenever a zombie groans, play a groan noise on channel number (sound_channel), and set the volume and panning of channel number (sound_channel) to fit the zombie. Then, add 1 to sound_channel. This way, each zombie groan will be assigned to a different (but specific) channel.

    (I guess you could set just the sample position/volume. Either way should work.)

    When sound_channel is greater than 32, set it back to 0 so you don't run out.

    "Now and then we had a hope that if we lived and were good, God would permit us to be pirates." -MT

  • Thanks! But I see one huge flaw though. If I play zombie sounds on all channels like that, no other sounds can be played. My game has a lot of other sounds, like different pistol shell sounds, riccochet sounds, shooting sounds, etc. From what I have figured out, MMF2 randomly plays sounds on different channels if multi-samples is on. I never figured out why it played a sound on a random channel instead of just choosing the sound channel with the lowest number that was free. Anyhow, thanks for the help :) I may be able to use some sort of loop to check for the lowest free sound channel, and play zombie noises on those. Too bad MMF2 only has 32 channels though. That is NOT a lot!

  • Another question, and this has been bothering me for a long time. There are ways of checking if a specific sound channel is not playing anything. But is there a way to check if a specific channel IS playing something? I can't find such a condition in MMF2 :/

  • Why not use 2 sound channels. 1 for left and 1 for right. When you want to play a sample, play it on both and set the sample volumes (not the channel volume) depending on the distance of the sound source from your player?

  • Yikes + SergeantBiscuits - that's the exact technique I used for sounds in Faerie Solitaire. I have a "current sound" value, and whenever I play a sound I play it on the "current sound" value channel, then I add one to that value, and make sure it's mod 32. 32 Channels is actually a lot, you'd be surprised but you would rarely have that many sounds playing at once.

    Currently working on Please login to see this link..
    Creator of Faerie Solitaire, Stray Whisker, and Dungeon Dash. Known on TDC as AssaultAndy.
    Please login to see this link. | Please login to see this link.

  • That's not a bad idea, actually. Instead of using a loop to check for the lowest available sound channel to play on, I should just play sounds on the next channel every time. The problem though, is that I have certain sounds that loop constantly, like a wind sound. I don't want to interrupt that. But then again, I could just reserve a couple of channels for that kind of stuff :P

    And btw: I wrote earlier that MMF2 chooses a random sound channel to play a sound on. After some testing, I figured out that it actually DOES choose the lowest available sound channel to play on. That's a relief :)

    Still I need an answer on how to check if a channel is playing a sound though :P

    Edited once, last by Yikes (May 1, 2012 at 10:16 AM).

  • Yikes - I did forget to mention the whole point of me doing that system :P It was because I had music and sound effects, and I wanted to be able to set the volume of them independently. Using the channel system outlined above it means I can reserve channel 0 for music, and set the volume of that when I need to. All the other channels are sound effects and I can set the volume for those too, knowing they're always sound effects.

    To make it work, you do the same system I described above, but instead of simply using mod 32, you set the minimum to be say 2. Then you can use 0 and 1 for music/ambiance, and 2-32 are used for SFX.

    Currently working on Please login to see this link..
    Creator of Faerie Solitaire, Stray Whisker, and Dungeon Dash. Known on TDC as AssaultAndy.
    Please login to see this link. | Please login to see this link.

  • That's what I thought :) Could work!
    Allthough I still would need a way to tell a sound channel that it "belongs" to one enemy for one sample playthrough (for proper panning according to enemy's position), and that if that enemy dies, the panning of that channel may be assigned to another enemy :P
    Wonder if I should set a value on the enemy to be the same as the next free sound channel, so that I can say; If an enemy has the same channel value as the next channel's number, set the pan of that channel according to that enemy (or something along that line).

  • That's what I thought :) Could work!
    Wonder if I should set a value on the enemy to be the same as the next free sound channel, so that I can say; If an enemy has the same channel value as the next channel's number, set the pan of that channel according to that enemy (or something along that line).

    That sounds good. That's what I'd do.

    Currently working on Please login to see this link..
    Creator of Faerie Solitaire, Stray Whisker, and Dungeon Dash. Known on TDC as AssaultAndy.
    Please login to see this link. | Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!