playing music with startSound

  • #1, by SteveDayMonday, 15. September 2014, 23:56 6 years ago
    I'd like to implement a playlist player für background music. As I unterstand it there are three channels for sound: music, effects and speech. How can a start an new song with StartSound in the music channel?
    How many sounds can I play in parallel? Is there an event that gets triggered, when a sound has stopped? (so that i can start the next song)

    Newbie

    6 Posts


  • #2, by SimonSWednesday, 17. September 2014, 13:07 6 years ago
    You can't control which channel the sound takes, it will always be in the sound channel.
    You can query the offset of the sound to see if it's through:
    local offset = getSoundProperty(id, "offset")
    If the offset is -1, the sound is through. Many cards handle up to 256 sources (channels, stereo means 2 channels), some cards even 1024 sources, but other cards can only do 16. You often are better off using not so much audio channels, as it will be hard on the cpu after some channels.

    Thread Captain

    1369 Posts

  • #3, by SimonSWednesday, 17. September 2014, 13:22 6 years ago

    Thread Captain

    1369 Posts

  • #4, by SteveDayWednesday, 17. September 2014, 19:12 6 years ago
    Cool, thx! Ok, so there is more than one sound possible per channel. I just wanted to make sure that I dont block every other sound with my music.But what is the point of having a music "channel" when I can't play music on it? Hmm, I'll probably just read the mixer setting for the music "channel" and apply it to my player in the main loop. The read offset trick is pretty cool. Someone should update the documentation with it - and probably add your script to the documentation, too. Generally someone should take the answers from the forum an add them to the docs... ;-)

    Newbie

    6 Posts

Write post