libxputty  0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
xmidi_keyboard.h
Go to the documentation of this file.
1 /*
2  * 0BSD
3  *
4  * BSD Zero Clause License
5  *
6  * Copyright (c) 2019 Hermann Meyer
7  *
8  * Permission to use, copy, modify, and/or distribute this software for any
9  * purpose with or without fee is hereby granted.
10 
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  *
19  */
20 
21 #pragma once
22 
23 #ifndef XMIDI_KEYBOARD_H_
24 #define XMIDI_KEYBOARD_H_
25 
26 #include "xwidgets.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 typedef void (*midikeyfunc)(Widget_t *w,int *key, bool on_off);
33 typedef void (*midiwheelfunc)(Widget_t *w,int *value);
34 
35 typedef struct {
36  Pixmap *icon;
37 
38  int octave;
39  int layout;
40  int modwheel;
41  int detune;
42  int attack;
43  int sustain;
44  int release;
45  int volume;
46  int velocity;
51  int send_key;
52  unsigned long key_matrix[4];
53 
65 } MidiKeyboard;
66 
67 void keysym_azerty_to_midi_key(long inkey, float *midi_key);
68 
69 void keysym_qwertz_to_midi_key(long inkey, float *midi_key);
70 
71 void keysym_qwerty_to_midi_key(unsigned int inkey, float *midi_key);
72 
73 bool is_key_in_matrix(unsigned long *key_matrix, int key);
74 
75 bool have_key_in_matrix(unsigned long *key_matrix);
76 
77 void clear_key_matrix(unsigned long *key_matrix);
78 
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif //XMIDI_KEYBOARD_H_
MidiKeyboard::mk_send_volume
midiwheelfunc mk_send_volume
Definition: xmidi_keyboard.h:62
open_midi_keyboard
Widget_t * open_midi_keyboard(Widget_t *w)
Definition: xmidi_keyboard.c:793
MidiKeyboard::mk_send_detune
midiwheelfunc mk_send_detune
Definition: xmidi_keyboard.h:58
MidiKeyboard::icon
Pixmap * icon
Definition: xmidi_keyboard.h:36
xwidgets.h
MidiKeyboard::velocity
int velocity
Definition: xmidi_keyboard.h:46
MidiKeyboard::modwheel
int modwheel
Definition: xmidi_keyboard.h:40
midikeyfunc
void(* midikeyfunc)(Widget_t *w, int *key, bool on_off)
Definition: xmidi_keyboard.h:32
MidiKeyboard::mk_send_velocity
midiwheelfunc mk_send_velocity
Definition: xmidi_keyboard.h:63
MidiKeyboard::attack
int attack
Definition: xmidi_keyboard.h:42
MidiKeyboard::detune
int detune
Definition: xmidi_keyboard.h:41
MidiKeyboard::mk_send_all_sound_off
midiwheelfunc mk_send_all_sound_off
Definition: xmidi_keyboard.h:64
MidiKeyboard::send_key
int send_key
Definition: xmidi_keyboard.h:51
midiwheelfunc
void(* midiwheelfunc)(Widget_t *w, int *value)
Definition: xmidi_keyboard.h:33
MidiKeyboard::mk_send_release
midiwheelfunc mk_send_release
Definition: xmidi_keyboard.h:61
keysym_azerty_to_midi_key
void keysym_azerty_to_midi_key(long inkey, float *midi_key)
Definition: xmidi_keyboard.c:24
MidiKeyboard::octave
int octave
Definition: xmidi_keyboard.h:38
MidiKeyboard::pitchsensity
int pitchsensity
Definition: xmidi_keyboard.h:48
keysym_qwertz_to_midi_key
void keysym_qwertz_to_midi_key(long inkey, float *midi_key)
Definition: xmidi_keyboard.c:90
MidiKeyboard::mk_send_mod
midiwheelfunc mk_send_mod
Definition: xmidi_keyboard.h:57
MidiKeyboard
Definition: xmidi_keyboard.h:35
MidiKeyboard::mk_send_attack
midiwheelfunc mk_send_attack
Definition: xmidi_keyboard.h:59
clear_key_matrix
void clear_key_matrix(unsigned long *key_matrix)
Definition: xmidi_keyboard.c:221
MidiKeyboard::sustain
int sustain
Definition: xmidi_keyboard.h:43
MidiKeyboard::release
int release
Definition: xmidi_keyboard.h:44
MidiKeyboard::mk_send_pitchsensity
midiwheelfunc mk_send_pitchsensity
Definition: xmidi_keyboard.h:56
Widget_t
Widget_t - struct to hold the basic Widget_t info.
Definition: xwidget.h:298
keysym_qwerty_to_midi_key
void keysym_qwerty_to_midi_key(unsigned int inkey, float *midi_key)
Definition: xmidi_keyboard.c:157
have_key_in_matrix
bool have_key_in_matrix(unsigned long *key_matrix)
Definition: xmidi_keyboard.c:204
MidiKeyboard::mk_send_note
midikeyfunc mk_send_note
Definition: xmidi_keyboard.h:54
MidiKeyboard::volume
int volume
Definition: xmidi_keyboard.h:45
MidiKeyboard::mk_send_sustain
midiwheelfunc mk_send_sustain
Definition: xmidi_keyboard.h:60
is_key_in_matrix
bool is_key_in_matrix(unsigned long *key_matrix, int key)
Definition: xmidi_keyboard.c:183
MidiKeyboard::prelight_key
int prelight_key
Definition: xmidi_keyboard.h:49
MidiKeyboard::pitchwheel
int pitchwheel
Definition: xmidi_keyboard.h:47
MidiKeyboard::mk_send_pitch
midiwheelfunc mk_send_pitch
Definition: xmidi_keyboard.h:55
MidiKeyboard::layout
int layout
Definition: xmidi_keyboard.h:39
MidiKeyboard::active_key
int active_key
Definition: xmidi_keyboard.h:50