开发者

Obtaining multiple touch or "Down" events for musical instrument

开发者 https://www.devze.com 2023-04-13 00:04 出处:网络
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.

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开发者_JAVA百科 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  


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号