画钢琴
我已经开始研究软件合成器(或键盘)。由于可用的 Jfugue API,我决定使用 Java。我试图弄清楚如何创建键盘用户界面的实际按键(注释),但我陷入困境。我尝试通过将黑白矩形按钮拖放到面板上来创建界面,但这似乎不起作用。有人能指出我正确的方向吗?
I have started working on a software synthesizer (or keyboard). I have decided to use Java because of the available Jfugue API. I am trying to figure out how to go about creating the actual keys (notes) of the keyboard user interface, but I am stuck. I have tried to create an interface by dragging/dropping black and white rectangular buttons onto the panel, but that doesn't seem to work. Could someone point me into the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
查看此帖子的回复 9,了解简单的钢琴键盘这应该可以帮助你开始。您可能需要从头开始阅读该帖子,了解如何处理每个按钮所代表的注释。
Check out reply 9 of this posting for a simple piano keyboard that should get you started. You may want to read the posting from the beginning for ideas on how to handle the note represented by each button.
如果您使用 Java/swing,最好的选择是绘制键盘图像并将单击位置映射到各个键盘按键。
If you're using Java/swing, your best bet would be to draw an image of a keyboard and map click locations to the individual keyboard keys.
我曾经不得不做类似的事情......我发现的最好的解决方案是绘制面板并将其边框和背景设置为键。然后,我使用鼠标侦听器来确定单击了哪个面板以及单击的持续时间。
I once had to do something similar... the best solution I found was to draw panels and set their border and background as keys. I then used mouse listeners to determine which panel was clicked and the duration of the click.
我认为这就是您想要的:
我是 JFugue 的作者,我还想开始一个额外的工作,JFugueUI,它将提供诸如图形键盘之类的东西,人们可以将其包含在自己的应用程序中 - 所以,如果您愿意,请告诉我有兴趣贡献!
I think this is what you want to:
I'm the author of JFugue, and I've also wanted to start a side-effort, JFugueUI, that would provide things like graphical keyboards that people could include in their own applications - so, let me know if you're interested in contributing!