Android Question Small button on a larger one?

Tjitte Dijkstra

Member
Licensed User
Longtime User
Is it possible to put a small button on a larger one? In one of my projects, I am creating something like a piano keyboard. The white keys are in line and the black keys are half the width of the white ones and the black keys are in the foreground.
But if I click on a white key, the neighbouring black key is not yet in the foreground.
How to solve this problem?
 

zed

Active Member
Licensed User
It's a bad idea to use buttons.
Look at this code

I deleted the sound files because the zip file is too big
 

Attachments

  • vpiano.jpg
    vpiano.jpg
    215.6 KB · Views: 124
  • vPiano.zip
    126.9 KB · Views: 98
Last edited:
Upvote 0

zed

Active Member
Licensed User
Yes, the signs seem like a good idea.
How do you plan to manage keys?

My first idea would be to put all the keyboard keys in a panel then use GetAllViewRecursive to find out which key is pressed.
But the problem you will encounter is pressing multiple keys at the same time.
This is the reason why I created objects and linked sounds to these objects.
In this case, you can press several keys at the same time.
I wish you good luck.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Well, I didn't try your code but just judging by the looks, the piano could very well be published. I imagine there are crazy amount of piano apps, but perhaps a basic one for $1 with no ads would be interesting for the market. Just saying... :)

Looking forward to seeing your drum machines.
 
Upvote 0

zed

Active Member
Licensed User
VDrum. Uses the same principle as the piano.
Drum and Piano, uses lists

I deleted the sound files. App too big to publish

The apps are not finished

Free Source code and royalty free
 

Attachments

  • drumandpiano.jpg
    drumandpiano.jpg
    88.7 KB · Views: 103
  • vdrum.jpg
    vdrum.jpg
    24.5 KB · Views: 104
  • vdrum.zip
    183.4 KB · Views: 95
  • DrumAndPiano.zip
    480.6 KB · Views: 105
Last edited:
Upvote 0

zed

Active Member
Licensed User

Mini synthétiseur

Excellent work.
In fact, I stopped DrumAndPiano development because I don't know how to generate live sound and if it's only used clips in lists, it's less interesting
 
Upvote 0

Tjitte Dijkstra

Member
Licensed User
Longtime User
Zed,
Although the thread went a long way from my first question, I read all the answers with interrest.
In the meantime I discovered a new problem:
If I use the Mediaplayer to give a sound, after touching a key (panel) and that works fine, but after 50 - 70 tones, the mediaplayer stops and no sound is heard anymore. Is it a question of memory? (BTW: anytime the mediaplayer is used, I intialize it.)
 
Upvote 0

zed

Active Member
Licensed User
If I use the Mediaplayer to give a sound, after touching a key
It is best to use SoundPool. This allows multiple short sounds to be loaded and then played back those files with low latency.
MediaPlayer would be used to play the final recording. Otherwise, you have to have as many MediaPlayers as sound and the latency will be much higher.
If you have a 38-key keyboard, it's going to be a bit complicated.
On the other hand, you will only have one soundpool.
after 50 - 70 tones, the mediaplayer stops
Can you post a project. Like that, I can't tell you why? I never had this problem
 
Upvote 0
Top