AgsPiano

AgsPiano — A piano widget

Functions

Properties

guint base-key-code Read / Write
char * base-note Read / Write
guint key-count Read / Write
guint key-height Read / Write
guint key-width Read / Write

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── AgsPiano

Implemented Interfaces

AgsPiano implements AtkImplementorIface and GtkBuildable.

Includes

#include <ags/widget/ags_piano.h>

Description

AgsPiano is a widget representing a clavier.

Functions

ags_piano_set_button_state ()

void
ags_piano_set_button_state (AgsPiano *piano,
                            guint button_state);

Set button_state of piano .

Parameters

piano

the AgsPiano

 

button_state

the AgsPianoButtonState

 

Since: 3.6.6


ags_piano_get_button_state ()

guint
ags_piano_get_button_state (AgsPiano *piano);

Get mouse button state of piano .

Parameters

piano

the AgsPiano

 

Returns

the button state

Since: 3.6.6


ags_piano_set_layout ()

void
ags_piano_set_layout (AgsPiano *piano,
                      guint layout);

Set layout of piano .

Parameters

piano

the AgsPiano

 

layout

the AgsPianoButtonState

 

Since: 3.6.6


ags_piano_get_layout ()

guint
ags_piano_get_layout (AgsPiano *piano);

Get vertical or horizontal layout of piano .

Parameters

piano

the AgsPiano

 

Returns

the layout

Since: 3.6.6


ags_piano_set_base_note ()

void
ags_piano_set_base_note (AgsPiano *piano,
                         gchar *base_note);

Set base note of piano .

Parameters

piano

the AgsPiano

 

base_note

the base note

 

Since: 3.2.0


ags_piano_get_base_note ()

gchar *
ags_piano_get_base_note (AgsPiano *piano);

Get base note of piano .

Parameters

piano

the AgsPiano

 

Returns

the base note

Since: 3.2.0


ags_piano_set_base_key_code ()

void
ags_piano_set_base_key_code (AgsPiano *piano,
                             gint base_key_code);

Set base key code of piano .

Parameters

piano

the AgsPiano

 

base_key_code

the base key code

 

Since: 3.2.0


ags_piano_get_base_key_code ()

gint
ags_piano_get_base_key_code (AgsPiano *piano);

Get base key code of piano .

Parameters

piano

the AgsPiano

 

Returns

the base key code

Since: 3.2.0


ags_piano_set_key_width ()

void
ags_piano_set_key_width (AgsPiano *piano,
                         guint key_width);

Set key width of piano .

Parameters

piano

the AgsPiano

 

key_width

the base note

 

Since: 3.2.0


ags_piano_get_key_width ()

guint
ags_piano_get_key_width (AgsPiano *piano);

Get key width of piano .

Parameters

piano

the AgsPiano

 

Returns

the key width

Since: 3.2.0


ags_piano_set_key_height ()

void
ags_piano_set_key_height (AgsPiano *piano,
                          guint key_height);

Set key width of piano .

Parameters

piano

the AgsPiano

 

key_height

the key width

 

Since: 3.2.0


ags_piano_get_key_height ()

guint
ags_piano_get_key_height (AgsPiano *piano);

Get key height of piano .

Parameters

piano

the AgsPiano

 

Returns

the key height

Since: 3.2.0


ags_piano_set_key_count ()

void
ags_piano_set_key_count (AgsPiano *piano,
                         guint key_count);

Set key count of piano .

Parameters

piano

the AgsPiano

 

key_count

the key count

 

Since: 3.2.0


ags_piano_get_key_count ()

guint
ags_piano_get_key_count (AgsPiano *piano);

Get key count of piano .

Parameters

piano

the AgsPiano

 

Returns

the key count

Since: 3.2.0


ags_piano_key_code_to_note ()

gchar *
ags_piano_key_code_to_note (gint key_code);

Get note from key code.

Parameters

key_code

the key code

 

Returns

the note as string

Since: 3.0.0


ags_piano_key_pressed ()

void
ags_piano_key_pressed (AgsPiano *piano,
                       gchar *note,
                       gint key_code);

Emits ::key-pressed event.

Parameters

piano

the AgsPiano

 

note

the string representation of key

 

key_code

the key code

 

Since: 3.0.0


ags_piano_key_released ()

void
ags_piano_key_released (AgsPiano *piano,
                        gchar *note,
                        gint key_code);

Emits ::key-released event.

Parameters

piano

the AgsPiano

 

note

the string representation of key

 

key_code

the key code

 

Since: 3.0.0


ags_piano_key_clicked ()

void
ags_piano_key_clicked (AgsPiano *piano,
                       gchar *note,
                       gint key_code);

Emits ::key-clicked event.

Parameters

piano

the AgsPiano

 

note

the string representation of key

 

key_code

the key code

 

Since: 3.0.0


ags_piano_get_active_key ()

gint *
ags_piano_get_active_key (AgsPiano *piano,
                          guint *active_key_count);

Get active keys.

Parameters

piano

the AgsPiano

 

active_key_count

return location of count of active keys

 

Returns

the active keys as gint array

Since: 3.0.0


ags_piano_new ()

AgsPiano *
ags_piano_new ();

Create a new instance of AgsPiano.

Returns

the new AgsPiano instance

Since: 3.0.0


AGS_IS_PIANO()

#define AGS_IS_PIANO(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_PIANO))

AGS_IS_PIANO_CLASS()

#define AGS_IS_PIANO_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_PIANO))

AGS_PIANO()

#define AGS_PIANO(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_PIANO, AgsPiano))

AGS_PIANO_CLASS()

#define AGS_PIANO_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_PIANO, AgsPianoClass))

AGS_PIANO_GET_CLASS()

#define AGS_PIANO_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_PIANO, AgsPianoClass))

ags_piano_get_type ()

GType
ags_piano_get_type (void);

Types and Values

AGS_PIANO_DEFAULT_BASE_NOTE

#define AGS_PIANO_DEFAULT_BASE_NOTE AGS_PIANO_KEYS_OCTAVE_0_C

AGS_PIANO_DEFAULT_BASE_KEY_CODE

#define AGS_PIANO_DEFAULT_BASE_KEY_CODE (0)

AGS_PIANO_DEFAULT_KEY_WIDTH

#define AGS_PIANO_DEFAULT_KEY_WIDTH (60)

AGS_PIANO_DEFAULT_KEY_HEIGHT

#define AGS_PIANO_DEFAULT_KEY_HEIGHT (14)

AGS_PIANO_DEFAULT_KEY_COUNT

#define AGS_PIANO_DEFAULT_KEY_COUNT (128)

enum AgsPianoFlags

Members

AGS_PIANO_DRAW_FULL_SCALE

   

AGS_PIANO_DRAW_OCTAVE_SCALE

   

enum AgsPianoButtonState

Members

AGS_PIANO_BUTTON_1_PRESSED

   

enum AgsPianoLayout

Members

AGS_PIANO_LAYOUT_VERTICAL

   

AGS_PIANO_LAYOUT_HORIZONTAL

   

enum AgsPianoAction

Members

AGS_PIANO_MOVE_CURSOR_UP

   

AGS_PIANO_MOVE_CURSOR_DOWN

   

AGS_PIANO_HIT_KEY

   

enum AgsPianoOctave

Members

AGS_PIANO_NOTE_C

   

AGS_PIANO_NOTE_CIS

   

AGS_PIANO_NOTE_D

   

AGS_PIANO_NOTE_DIS

   

AGS_PIANO_NOTE_E

   

AGS_PIANO_NOTE_F

   

AGS_PIANO_NOTE_FIS

   

AGS_PIANO_NOTE_G

   

AGS_PIANO_NOTE_GIS

   

AGS_PIANO_NOTE_A

   

AGS_PIANO_NOTE_AIS

   

AGS_PIANO_NOTE_H

   

AGS_TYPE_PIANO

#define AGS_TYPE_PIANO                (ags_piano_get_type())

struct AgsPiano

struct AgsPiano;

struct AgsPianoClass

struct AgsPianoClass {
  GtkWidgetClass widget;

  void (*key_pressed)(AgsPiano *piano,
		      gchar *note, gint key_code);
  void (*key_released)(AgsPiano *piano,
		       gchar *note, gint key_code);

  void (*key_clicked)(AgsPiano *piano,
		      gchar *note, gint key_code);
};

Property Details

The “base-key-code” property

  “base-key-code”            guint

The base key code.

Owner: AgsPiano

Flags: Read / Write

Default value: 0

Since: 3.0.0


The “base-note” property

  “base-note”                char *

The base note to use as lower.

Owner: AgsPiano

Flags: Read / Write

Default value: "C,,"

Since: 3.0.0


The “key-count” property

  “key-count”                guint

The count of keys to be drawn.

Owner: AgsPiano

Flags: Read / Write

Default value: 128

Since: 3.0.0


The “key-height” property

  “key-height”               guint

The key height to use for drawing a key.

Owner: AgsPiano

Flags: Read / Write

Default value: 14

Since: 3.0.0


The “key-width” property

  “key-width”                guint

The key width to use for drawing a key.

Owner: AgsPiano

Flags: Read / Write

Default value: 60

Since: 3.0.0

Signal Details

The “key-clicked” signal

void
user_function (AgsPiano *piano,
               char     *note,
               int       key_code,
               gpointer  user_data)

The ::key-clicked signal notifies about key clicked.

Parameters

piano

the AgsPiano

 

note

the note as string

 

key_code

the numeric representation of the note

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.0.0


The “key-pressed” signal

void
user_function (AgsPiano *piano,
               char     *note,
               int       key_code,
               gpointer  user_data)

The ::key-pressed signal notifies about key pressed.

Parameters

piano

the AgsPiano

 

note

the note as string

 

key_code

the numeric representation of the note

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.0.0


The “key-released” signal

void
user_function (AgsPiano *piano,
               char     *note,
               int       key_code,
               gpointer  user_data)

The ::key-released signal notifies about key released.

Parameters

piano

the AgsPiano

 

note

the note as string

 

key_code

the numeric representation of the note

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.0.0