Obtaining multiple touch or "Down" events for musical instrument

1.6k Views Asked by At

I am trying to detect multiple taps on the screen basically to create piano like app using the B4A SoundPool control and panel.touch event to trigger sounds.
My problem is that once the screen (or one panel of many representing keyboard) is touched and held others don't register.
I guess I would need to use a multitouch library but I can't figure out how I would use it to just detect multiple panels being touched. I don't need motion detection.

Here is my current code. One sub for all panels using Sender.Tag as unique identifier. Is one Sub my problem?

    Sub pnl_Touch (Action As Int, X As Float, Y As Float)  
        If Action = Activity.ACTION_DOWN Then  
            Dim key As Panel  
            key = Sender  
            Dim note As Int  
            note = key.Tag  
            Dim PlayID As Int  
            PlayID = SP.Play(note,1,1,1,0,1)  
        End If  
    End Sub  
1

There are 1 best solutions below

0
On

Yes, Multi-Touch is the way forward. See Andrew Graham's multi-touch library. Here is a working example - Multi-Touch tutorial