Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Playing multiple sound files simultaneously.



  • Posts: 797

    @Scotty You might want to try updating

    if t.state==ENDED then


    if t.state==ENDED or t.state==CANCELLED then

    If you run the multi touch demo as it is and do a five fingered pinch to close, then reopen Codea, you will see all (some) of the old finger circles frozen to the screen. If you update to include "or touch.state==CANCELLED" these old circles get flushed on the restart. You may be experiencing something similar?

  • dave1707dave1707 Mod
    Posts: 8,943

    @West @Scotty I added CANCELLED to my test code and when I try the 4 finger touch that allows me to slide the current screen left or right, all of the sounds do stop even though I still have my fingers on the keys. So I’m not sure which way is better, a stuck key or all the sounds suddenly stop. I don’t think there’s a way to override the 4 or 5 finger options. Maybe we just need to find a better option.

  • Posts: 797

    Yes it will depend on preference.

    You can switch the 4/5 finger option off in the settings menu under Gestures. Other things (eg incoming calls and maybe notifications) might still cause an issue

  • dave1707dave1707 Mod
    Posts: 8,943

    @West Thanks for the Gestures info. I thought there was an option, but I couldn’t find it when I was looking for it yesterday. It seems like anytime there’s an iOS update, something gets moved and you have to start looking thru everything. If the Gestures are turned off, that might take care of the stuck key when using or not using the CANCELLED update.

  • Posts: 509

    In case it's of help with designing your own solution, here's an old write-up of how my touch handler code works.

  • Posts: 75

    Sorry for the delayed response to all of your suggestions but a stretch of fine weather got me outdoors doing projects.

    @West 's suggestion of changing the if statement to include CANCELLED as in: "if t.state==ENDED or t.state==CANCELLED then" seems to work. I don't mind the sounds stopping if I slide off the keys, that's way better than embarrassingly "stuck" key. Yes, without the "CANCELLED" portion of the if statement things behave in a bizarre fashion if I 4-finger gesture the app off the screen as West describes.

    As a reminder, my program has a total of 29 keys: 21 treble keys and 8 base keys. It represents all the keys, or buttons, on my melodeon. Think small accordion. If you follow this link: you'll get the idea of the instrument I'm trying to simulate. The sounds I use in my project were sampled from my melodeon and uploaded to Dropbox (all 58 sounds) so it sounds nearly identical to to the real thing.

    I've tested the program by pressing the keys with four fingers of both left and right hand and tilting the iPad left and right, to simulate pushing and pulling. I've done this in both a wild, random fashion and by playing simple tunes. After three days of testing I've had NO key lockups!

    Thank You, @dave1707 and @West . All your help if greatly appreciated. I still have much to learn but have learned a great deal on this project.

    As for @LoopSpace , thank you as well, I will study your tutorial and, no doubt, learn more.

    Thanks again.

  • Posts: 75

    By the way, that is NOT me playing that melodeon on YouTube.

Sign In or Register to comment.