SwamiguiPiano

SwamiguiPiano

Synopsis

#define             SWAMIGUI_PIANO_DEFAULT_WIDTH
#define             SWAMIGUI_PIANO_DEFAULT_HEIGHT
#define             SWAMIGUI_PIANO_DEFAULT_LOWER_OCTAVE
#define             SWAMIGUI_PIANO_DEFAULT_UPPER_OCTAVE
                    SwamiguiPiano;
void                swamigui_piano_note_on              (SwamiguiPiano *piano,
                                                         int note,
                                                         int velocity);
void                swamigui_piano_note_off             (SwamiguiPiano *piano,
                                                         int note,
                                                         int velocity);
int                 swamigui_piano_pos_to_note          (SwamiguiPiano *piano,
                                                         double x,
                                                         double y,
                                                         int *velocity,
                                                         gboolean *isblack);
double              swamigui_piano_note_to_pos          (SwamiguiPiano *piano,
                                                         int note,
                                                         int edge,
                                                         gboolean realnote,
                                                         gboolean *isblack);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GnomeCanvasItem
                     +----GnomeCanvasGroup
                           +----SwamiguiPiano

Properties

  "bg-color"                 guint                 : Read / Write
  "black-key-color"          guint                 : Read / Write
  "black-key-play-color"     guint                 : Read / Write
  "expression-control"       SwamiControl*         : Read
  "height-pixels"            gint                  : Read / Write
  "key-count"                gint                  : Read / Write / Construct Only
  "lower-octave"             gint                  : Read / Write
  "lower-velocity"           gint                  : Read / Write
  "midi-channel"             gint                  : Read / Write
  "midi-control"             SwamiControl*         : Read
  "shadow-edge-color"        guint                 : Read / Write
  "start-octave"             gint                  : Read / Write
  "upper-octave"             gint                  : Read / Write
  "upper-velocity"           gint                  : Read / Write
  "white-key-color"          guint                 : Read / Write
  "white-key-play-color"     guint                 : Read / Write
  "width-pixels"             gint                  : Read / Write

Signals

  "note-off"                                       : Run Last
  "note-on"                                        : Run Last

Description

Details

SWAMIGUI_PIANO_DEFAULT_WIDTH

#define SWAMIGUI_PIANO_DEFAULT_WIDTH  640 /* default width in pixels */

SWAMIGUI_PIANO_DEFAULT_HEIGHT

#define SWAMIGUI_PIANO_DEFAULT_HEIGHT 48 /* default hight in pixels */

SWAMIGUI_PIANO_DEFAULT_LOWER_OCTAVE

#define SWAMIGUI_PIANO_DEFAULT_LOWER_OCTAVE 3 /* default lower keys octave */

SWAMIGUI_PIANO_DEFAULT_UPPER_OCTAVE

#define SWAMIGUI_PIANO_DEFAULT_UPPER_OCTAVE 4 /* default upper keys octave */

SwamiguiPiano

typedef struct _SwamiguiPiano SwamiguiPiano;

swamigui_piano_note_on ()

void                swamigui_piano_note_on              (SwamiguiPiano *piano,
                                                         int note,
                                                         int velocity);

Piano note on. Turns on note visually on piano as well as sends an event to SwamiControl objects connected to piano MIDI event control.

piano :

Piano object

note :

MIDI note number to turn on

velocity :

MIDI velocity number (-1 to use current keyboard velocity)

swamigui_piano_note_off ()

void                swamigui_piano_note_off             (SwamiguiPiano *piano,
                                                         int note,
                                                         int velocity);

Piano note off. Turns off note visually on piano as well as sends an event to it's connected MIDI driver (if any).

piano :

Piano object

note :

MIDI note number to turn off

velocity :

MIDI note off velocity

swamigui_piano_pos_to_note ()

int                 swamigui_piano_pos_to_note          (SwamiguiPiano *piano,
                                                         double x,
                                                         double y,
                                                         int *velocity,
                                                         gboolean *isblack);

Get the MIDI note corresponding to a point on the piano. The velocity relates to the vertical axis of the note. Positions towards the tip of the key generate higher velocities.

piano :

Piano object

x :

X coordinate in canvas world units

y :

Y coordinate in canvas world units

velocity :

Location to store velocity or NULL

isblack :

Location to store a boolean if key is black/white, or NULL

Returns :

The MIDI note number or -1 if not a valid key.

swamigui_piano_note_to_pos ()

double              swamigui_piano_note_to_pos          (SwamiguiPiano *piano,
                                                         int note,
                                                         int edge,
                                                         gboolean realnote,
                                                         gboolean *isblack);

Property Details

The "bg-color" property

  "bg-color"                 guint                 : Read / Write

Color of border and between white keys.

Default value: 255


The "black-key-color" property

  "black-key-color"          guint                 : Read / Write

Black key color.

Default value: 255


The "black-key-play-color" property

  "black-key-play-color"     guint                 : Read / Write

Color of black key play highlight.

Default value: 2843738111


The "expression-control" property

  "expression-control"       SwamiControl*         : Read

Piano expression control (vertical mouse axis).


The "height-pixels" property

  "height-pixels"            gint                  : Read / Write

Height in pixels.

Allowed values: >= 1

Default value: 48


The "key-count" property

  "key-count"                gint                  : Read / Write / Construct Only

Size of piano in keys.

Allowed values: [1,128]

Default value: 128


The "lower-octave" property

  "lower-octave"             gint                  : Read / Write

Lower keyboard start octave.

Allowed values: [0,10]

Default value: 3


The "lower-velocity" property

  "lower-velocity"           gint                  : Read / Write

Lower keyboard velocity.

Allowed values: [0,127]

Default value: 127


The "midi-channel" property

  "midi-channel"             gint                  : Read / Write

MIDI channel to send events on.

Allowed values: [0,15]

Default value: 0


The "midi-control" property

  "midi-control"             SwamiControl*         : Read

Piano MIDI control.


The "shadow-edge-color" property

  "shadow-edge-color"        guint                 : Read / Write

Bottom shadow edge color.

Default value: 2155905279


The "start-octave" property

  "start-octave"             gint                  : Read / Write

Piano start octave (0 = MIDI note 0.

Allowed values: [0,10]

Default value: 0


The "upper-octave" property

  "upper-octave"             gint                  : Read / Write

Upper keyboard start octave.

Allowed values: [0,10]

Default value: 4


The "upper-velocity" property

  "upper-velocity"           gint                  : Read / Write

Upper keyboard velocity.

Allowed values: [0,127]

Default value: 127


The "white-key-color" property

  "white-key-color"          guint                 : Read / Write

White key color.

Default value: 4294967295


The "white-key-play-color" property

  "white-key-play-color"     guint                 : Read / Write

Color of white key play highlight.

Default value: 2843738111


The "width-pixels" property

  "width-pixels"             gint                  : Read / Write

Width in pixels.

Allowed values: >= 1

Default value: 640

Signal Details

The "note-off" signal

void                user_function                      (SwamiguiPiano *swamiguipiano,
                                                        guint          arg1,
                                                        gpointer       user_data)          : Run Last

The "note-on" signal

void                user_function                      (SwamiguiPiano *swamiguipiano,
                                                        guint          arg1,
                                                        gpointer       user_data)          : Run Last