PianoKeyBoard | 自定义的钢琴键盘 从A0 - C8 一共88个键 支持多点触控和多点滑动 | Keyboard library
kandi X-RAY | PianoKeyBoard Summary
kandi X-RAY | PianoKeyBoard Summary
自定义的钢琴键盘 从A0 - C8 一共88个键 支持多点触控和多点滑动(如果与系统手势快捷方式冲突则不支持 比如miui (三指下拉截屏) 不支持三指及以上滑动) 支持键盘移动.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initializes this instance
- Initialize SoundPlayUtils
- Move to position
- Show next button
- Handles a new touch event
- Fire a key up event
- Process a finger
- Process a new touch event
- Set the white keyed drawable
- Initializes the list of keys
- Draws the keys on the canvas
- Draws the key
- Initializes the prekeyboard style
- Re - invalidates the font and measures
- Get Key by code
- Gets the key code
- Suspend the dimensions of the image
- Measure the size
- Set the black key drawable
- Set the black key height ratio
- Set the black keyed drawable
- Set black key width
- Set key count
- Set the white key drawable
- Reset the size of the map
- Sets the pronunc text
PianoKeyBoard Key Features
PianoKeyBoard Examples and Code Snippets
/**
* 设置是否播放音效
*/
public void setIsPlaySound(boolean isPlaySound) {
}
/**
* 根据黑/白键的code 获取黑/白键 code从21-108 和midi键盘对应
*/
public Key getKeyByKeycode(int code) {
}
/**
* 移动键盘到当前位置 即键盘显示的第一个白键为当前位置
/**
* 键盘的监听
*/
public interface KeyListener {
/**
* 键盘被按下的回调
*
* @param key 被按下的键
*/
void onKeyPressed(Key key);
/**
* 键盘被按松开的回调
*
Community Discussions
Trending Discussions on PianoKeyBoard
QUESTION
I am trying to use the WPF Grid as an ItemsControl using attached properties for the purposes of creating a scalable Piano Keyboard. Each key in the keyboard may span 1 to three columns depending upon what precedes and succeeds it and will span 1 row if sharp or 2 if natural. I already have 2 attached properties for setting the Grid's Column Count and Row Count dynamically (albeit these will need to be adjusted to support the setting of each column/row's width/height).
What I now need to implement are two attachable properties for the ItemsSource
(Keys) and the ItemTemplate
(PianoKeyView). I need to use this on the Grid control because ItemsControl
only supports UniformGrid
as a Grid for its ItemsPanel
and also doesn't assignment of specific items to specific columns/rows. My Piano Keyboard would require 17 columns per octave of keys but an ItemsControl would only create 12 columns in a UniformGrid
as there would only be 12 keys passed to it. I have included an image of a 1-octave Piano Keyboard with the index of each required column included.
This is my code for the keyboard as it currently stands, I am missing the implementation for GridExtensions.ItemsSource
and GridExtensions.ItemTemplate
. GridExtensions
is a static class containing attachable properties.
ANSWER
Answered 2017-Nov-06 at 18:23What I was trying to achieve with the Grid
directly could be achieved with an ItemsControl
with an ItemsPanel
of Grid
.
It turns out the missing piece that was needed was a Style
with a TargetType
of ContentPresenter
. In this style, the attachable Grid
properties such as Grid.RowSpan
, Grid.Column
and Grid.ColumnSpan
are settable via the appropriate converters which take in the ItemsControl and Key's DataContext and return the required integer. The Z-Index of the keys is also settable here so that the sharp keys appear above the natural keys.
QUESTION
This is totally mysterious. I checked everything, googled everything, but looks like this should work. I've done same things in my code with others html elements and they all give me the values, but this time I'm getting undefined for this particular HTML element. The snippet of code below:
...ANSWER
Answered 2017-Aug-13 at 19:57That is because
value
attribute. It is only for a selected subset of elements:
,
,
,
,
,
, and
.
You can store the value as a HTML5 data-
attribute, i.e.:
QUESTION
I am trying to write a XAML control for a Piano Keyboard in WPF which responds to NoteOn and NoteOff MIDI events from an external MIDI keyboard. I am using Tom Lokovic's midi-dot-net to raise NoteOn and NoteOff events triggered by the hardware but I need a way to get these events to raise the NoteOn and NoteOff events of my XAML Key class (derived from the WPF Button). The colour of a key should change when it is on and the event should be subscribable to so that a user of the Piano Keyboard control can play a sound the key is pressed.
I could do this by passing every Midi.InputDevice to every single key on the keyboard so that each one can subscribe to the NoteOn and NoteOff events of every InputDevice then, in turn raise their own NoteOn and NoteOff events but the problem with this is that the PianoKeyboard control (an ItemsControl which holds Keys) and its nested Key controls all become tightly coupled to the implementation of midi-dot-net. If I have to do this I will, but it seemed like there should be a better way of doing this in WPF moving the dependency on midi-dot-net higher up in the call stack.
I have too much code to paste in its entirety here and still be readable so here's a sample of one of the DataTemplates I'm using as my PianoKeyboard's ItemTemplate.
Essentially what I'm asking is: given an input device is not supported to trigger a WPF button with the button's built in behaviour (e.g. a mouse click), how does one get it to trigger the button without coupling it to a derived class of the button?
...ANSWER
Answered 2017-Apr-18 at 12:17You could raise the Click
event programmatically:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PianoKeyBoard
You can use PianoKeyBoard like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the PianoKeyBoard component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page