[beast: 3/11] BSE: move Source automation methods and enum MidiControl into bseapi.idl



commit ba90a0a2e6bf345e2d225111cdcb0fec6dedad7b
Author: Tim Janik <timj gnu org>
Date:   Mon Sep 4 01:44:25 2017 +0200

    BSE: move Source automation methods and enum MidiControl into bseapi.idl
    
    Signed-off-by: Tim Janik <timj gnu org>

 bse/bseapi.idl     |  178 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 bse/bsebasics.idl  |  168 -------------------------------------------------
 bse/bsesource.cc   |   52 +++++++++++++---
 bse/bsesource.hh   |    2 +
 bse/bsesource.proc |   73 ---------------------
 bse/bsestorage.cc  |   10 ++--
 6 files changed, 226 insertions(+), 257 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index d987d29..89b8855 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -274,6 +274,175 @@ enum MidiSignal {
   CONTROL_127               = Enum (255, _("Control 127 Polyphonic Mode On ITrigger")),
 };
 
+enum MidiControl {
+  // special cased signals
+  NONE                  = Enum (0, _("None")),
+  // 14bit, continuous controls
+  CONTINUOUS_0          = Enum (64,  _("Bank Select"), _("Continuous MIDI Control #1 - Bank Select")),
+  CONTINUOUS_1          = Enum (65,  _("Modulation Depth")),
+  CONTINUOUS_2          = Enum (66,  _("Breath Control")),
+  CONTINUOUS_3          = Enum (67,  _("Continuous 3")),
+  CONTINUOUS_4          = Enum (68,  _("Foot Controller")),
+  CONTINUOUS_5          = Enum (69,  _("Portamento Time")),
+  CONTINUOUS_6          = Enum (70,  _("Data Entry")),
+  CONTINUOUS_7          = Enum (71,  _("Volume")),
+  CONTINUOUS_8          = Enum (72,  _("Balance")),
+  CONTINUOUS_9          = Enum (73,  _("Continuous 9")),
+  CONTINUOUS_10         = Enum (74,  _("Panorama")),
+  CONTINUOUS_11         = Enum (75,  _("Expression")),
+  CONTINUOUS_12         = Enum (76,  _("Effect Control 1")),
+  CONTINUOUS_13         = Enum (77,  _("Effect Control 2")),
+  CONTINUOUS_14         = Enum (78,  _("Continuous 14")),
+  CONTINUOUS_15         = Enum (79,  _("Continuous 15")),
+  CONTINUOUS_16         = Enum (80,  _("General Purpose Controller 1")),
+  CONTINUOUS_17         = Enum (81,  _("General Purpose Controller 2")),
+  CONTINUOUS_18         = Enum (82,  _("General Purpose Controller 3")),
+  CONTINUOUS_19         = Enum (83,  _("General Purpose Controller 4")),
+  CONTINUOUS_20         = Enum (84,  _("Continuous 20")),
+  CONTINUOUS_21         = Enum (85,  _("Continuous 21")),
+  CONTINUOUS_22         = Enum (86,  _("Continuous 22")),
+  CONTINUOUS_23         = Enum (87,  _("Continuous 23")),
+  CONTINUOUS_24         = Enum (88,  _("Continuous 24")),
+  CONTINUOUS_25         = Enum (89,  _("Continuous 25")),
+  CONTINUOUS_26         = Enum (90,  _("Continuous 26")),
+  CONTINUOUS_27         = Enum (91,  _("Continuous 27")),
+  CONTINUOUS_28         = Enum (92,  _("Continuous 28")),
+  CONTINUOUS_29         = Enum (93,  _("Continuous 29")),
+  CONTINUOUS_30         = Enum (94,  _("Continuous 30")),
+  CONTINUOUS_31         = Enum (95,  _("Continuous 31")),
+  // 7bit, literal channel controls, MSB values
+  CONTROL_0             = Enum (128, _("Control 0 Bank Select MSB")),
+  CONTROL_1             = Enum (129, _("Control 1 Modulation Depth MSB")),
+  CONTROL_2             = Enum (130, _("Control 2 Breath Control MSB")),
+  CONTROL_3             = Enum (131, _("control-3")),
+  CONTROL_4             = Enum (132, _("Control 4 Foot Controller MSB")),
+  CONTROL_5             = Enum (133, _("Control 5 Portamento Time MSB")),
+  CONTROL_6             = Enum (134, _("Control 6 Data Entry MSB")),
+  CONTROL_7             = Enum (135, _("Control 7 Volume MSB")),
+  CONTROL_8             = Enum (136, _("Control 8 Balance MSB")),
+  CONTROL_9             = Enum (137, _("control-9")),
+  CONTROL_10            = Enum (138, _("Control 10 Panorama MSB")),
+  CONTROL_11            = Enum (139, _("Control 11 Expression MSB")),
+  CONTROL_12            = Enum (140, _("Control 12 Effect Control 1 MSB")),
+  CONTROL_13            = Enum (141, _("Control 13 Effect Control 2 MSB")),
+  CONTROL_14            = Enum (142, _("control-14")),
+  CONTROL_15            = Enum (143, _("control-15")),
+  CONTROL_16            = Enum (144, _("Control 16 General Purpose Controller 1 MSB")),
+  CONTROL_17            = Enum (145, _("Control 17 General Purpose Controller 2 MSB")),
+  CONTROL_18            = Enum (146, _("Control 18 General Purpose Controller 3 MSB")),
+  CONTROL_19            = Enum (147, _("Control 19 General Purpose Controller 4 MSB")),
+  CONTROL_20            = Enum (148, _("control-20")),
+  CONTROL_21            = Enum (149, _("control-21")),
+  CONTROL_22            = Enum (150, _("control-22")),
+  CONTROL_23            = Enum (151, _("control-23")),
+  CONTROL_24            = Enum (152, _("control-24")),
+  CONTROL_25            = Enum (153, _("control-25")),
+  CONTROL_26            = Enum (154, _("control-26")),
+  CONTROL_27            = Enum (155, _("control-27")),
+  CONTROL_28            = Enum (156, _("control-28")),
+  CONTROL_29            = Enum (157, _("control-29")),
+  CONTROL_30            = Enum (158, _("control-30")),
+  CONTROL_31            = Enum (159, _("control-31")),
+  // 7bit, literal channel controls, LSB values
+  CONTROL_32            = Enum (160, _("Control 32 Bank Select LSB")),
+  CONTROL_33            = Enum (161, _("Control 33 Modulation Depth LSB")),
+  CONTROL_34            = Enum (162, _("Control 34 Breath Control LSB")),
+  CONTROL_35            = Enum (163, _("control-35")),
+  CONTROL_36            = Enum (164, _("Control 36 Foot Controller LSB")),
+  CONTROL_37            = Enum (165, _("Control 37 Portamento Time LSB")),
+  CONTROL_38            = Enum (166, _("Control 38 Data Entry LSB")),
+  CONTROL_39            = Enum (167, _("Control 39 Volume LSB")),
+  CONTROL_40            = Enum (168, _("Control 40 Balance LSB")),
+  CONTROL_41            = Enum (169, _("control-41")),
+  CONTROL_42            = Enum (170, _("Control 42 Panorama LSB")),
+  CONTROL_43            = Enum (171, _("Control 43 Expression LSB")),
+  CONTROL_44            = Enum (172, _("Control 44 Effect Control 1 LSB")),
+  CONTROL_45            = Enum (173, _("Control 45 Effect Control 2 LSB")),
+  CONTROL_46            = Enum (174, _("control-46")),
+  CONTROL_47            = Enum (175, _("control-47")),
+  CONTROL_48            = Enum (176, _("Control 48 General Purpose Controller 1 LSB")),
+  CONTROL_49            = Enum (177, _("Control 49 General Purpose Controller 2 LSB")),
+  CONTROL_50            = Enum (178, _("Control 50 General Purpose Controller 3 LSB")),
+  CONTROL_51            = Enum (179, _("Control 51 General Purpose Controller 4 LSB")),
+  CONTROL_52            = Enum (180, _("control-52")),
+  CONTROL_53            = Enum (181, _("control-53")),
+  CONTROL_54            = Enum (182, _("control-54")),
+  CONTROL_55            = Enum (183, _("control-55")),
+  CONTROL_56            = Enum (184, _("control-56")),
+  CONTROL_57            = Enum (185, _("control-57")),
+  CONTROL_58            = Enum (186, _("control-58")),
+  CONTROL_59            = Enum (187, _("control-59")),
+  CONTROL_60            = Enum (188, _("control-60")),
+  CONTROL_61            = Enum (189, _("control-61")),
+  CONTROL_62            = Enum (190, _("control-62")),
+  CONTROL_63            = Enum (191, _("control-63")),
+  // 7bit, literal channel controls
+  CONTROL_64            = Enum (192, _("Control 64 Damper Pedal Switch (Sustain)")),
+  CONTROL_65            = Enum (193, _("Control 65 Portamento Switch")),
+  CONTROL_66            = Enum (194, _("Control 66 Sustenuto Switch")),
+  CONTROL_67            = Enum (195, _("Control 67 Soft Switch")),
+  CONTROL_68            = Enum (196, _("Control 68 Legato Pedal Switch")),
+  CONTROL_69            = Enum (197, _("Control 69 Hold Pedal Switch")),
+  CONTROL_70            = Enum (198, _("Control 70 Sound Variation")),
+  CONTROL_71            = Enum (199, _("Control 71 Filter Resonance (Timbre)")),
+  CONTROL_72            = Enum (200, _("Control 72 Sound Release Time")),
+  CONTROL_73            = Enum (201, _("Control 73 Sound Attack Time")),
+  CONTROL_74            = Enum (202, _("Control 74 Sound Brightness")),
+  CONTROL_75            = Enum (203, _("Control 75 Sound Decay Time")),
+  CONTROL_76            = Enum (204, _("Control 76 Vibrato Rate")),
+  CONTROL_77            = Enum (205, _("Control 77 Vibrato Depth")),
+  CONTROL_78            = Enum (206, _("Control 78 Vibrato Delay")),
+  CONTROL_79            = Enum (207, _("Control 79 Sound Control 10")),
+  CONTROL_80            = Enum (208, _("Control 80 General Purpose Switch 5")),
+  CONTROL_81            = Enum (209, _("Control 81 General Purpose Switch 6")),
+  CONTROL_82            = Enum (210, _("Control 82 General Purpose Switch 7")),
+  CONTROL_83            = Enum (211, _("Control 83 General Purpose Switch 8")),
+  CONTROL_84            = Enum (212, _("Control 84 Portamento Control (Note)")),
+  CONTROL_85            = Enum (213, _("control-85")),
+  CONTROL_86            = Enum (214, _("control-86")),
+  CONTROL_87            = Enum (215, _("control-87")),
+  CONTROL_88            = Enum (216, _("control-88")),
+  CONTROL_89            = Enum (217, _("control-89")),
+  CONTROL_90            = Enum (218, _("control-90")),
+  CONTROL_91            = Enum (219, _("Control 91 Reverb Depth")),
+  CONTROL_92            = Enum (220, _("Control 92 Tremolo Depth")),
+  CONTROL_93            = Enum (221, _("Control 93 Chorus Depth")),
+  CONTROL_94            = Enum (222, _("Control 93 Detune Depth")),
+  CONTROL_95            = Enum (223, _("Control 95 Phase Depth")),
+  CONTROL_96            = Enum (224, _("Control 96 Data Increment Trigger")),
+  CONTROL_97            = Enum (225, _("Control 97 Data Decrement Trigger")),
+  CONTROL_98            = Enum (226, _("Control 98 Non-Registered Parameter MSB")),
+  CONTROL_99            = Enum (227, _("Control 99 Non-Registered Parameter LSB")),
+  CONTROL_100           = Enum (228, _("Control 100 Registered Parameter MSB")),
+  CONTROL_101           = Enum (229, _("Control 101 Registered Parameter LSB")),
+  CONTROL_102           = Enum (230, _("control-102")),
+  CONTROL_103           = Enum (231, _("control-103")),
+  CONTROL_104           = Enum (232, _("control-104")),
+  CONTROL_105           = Enum (233, _("control-105")),
+  CONTROL_106           = Enum (234, _("control-106")),
+  CONTROL_107           = Enum (235, _("control-107")),
+  CONTROL_108           = Enum (236, _("control-108")),
+  CONTROL_109           = Enum (237, _("control-109")),
+  CONTROL_110           = Enum (238, _("control-110")),
+  CONTROL_111           = Enum (239, _("control-111")),
+  CONTROL_112           = Enum (240, _("control-112")),
+  CONTROL_113           = Enum (241, _("control-113")),
+  CONTROL_114           = Enum (242, _("control-114")),
+  CONTROL_115           = Enum (243, _("control-115")),
+  CONTROL_116           = Enum (244, _("control-116")),
+  CONTROL_117           = Enum (245, _("control-117")),
+  CONTROL_118           = Enum (246, _("control-118")),
+  CONTROL_119           = Enum (247, _("control-119")),
+  CONTROL_120           = Enum (248, _("Control 120 All Sound Off ITrigger")),
+  CONTROL_121           = Enum (249, _("Control 121 All Controllers Off ITrigger")),
+  CONTROL_122           = Enum (250, _("Control 122 Local Control Switch")),
+  CONTROL_123           = Enum (251, _("Control 123 All Notes Off ITrigger")),
+  CONTROL_124           = Enum (252, _("Control 124 Omni Mode Off ITrigger")),
+  CONTROL_125           = Enum (253, _("Control 125 Omni Mode On ITrigger")),
+  CONTROL_126           = Enum (254, _("Control 126 Monophonic Voices Mode")),
+  CONTROL_127           = Enum (255, _("Control 127 Polyphonic Mode On ITrigger")),
+};
+
 // For musical tunings, see: http://en.wikipedia.org/wiki/Musical_tuning
 enum MusicalTuning {
   // Equal Temperament: http://en.wikipedia.org/wiki/Equal_temperament
@@ -585,7 +754,6 @@ interface Source : Item {
   // void clear_inputs (); ///< Disconnect all module inputs.
   // void clear_outputs (); ///< Disconnect all module outputs.
   // int32 get_automation_channel (String property_name); ///< Get MIDI channel from an automation property.
-  // MidiControlType get_automation_control (String property_name); ///< Get control type from an automation 
property.
   bool has_output (int32 ochannel); ///< Check whether a module's output channel is connected.
   bool has_outputs (); ///< Check whether a module has output channel connections.
   String ichannel_blurb (int32 input_channel); ///< Get input channel description.
@@ -601,7 +769,13 @@ interface Source : Item {
   String ochannel_blurb (int32 output_channel); ///< Get output channel description.
   String ochannel_ident (int32 output_channel); ///< Get canonical output channel name.
   String ochannel_label (int32 output_channel); ///< Get output channel name.
-  // Error set_automation (String property_name, int32 midi_channel, MidiControlType control_type); ///< 
Setup automation parameters for a property.
+
+  /** Setup automation parameters for a property.
+   * @param midi_channel The MIDI Channel from which automation events should be received, 0 designates the 
default MIDI channel
+   * @param control_type The type of control events used for automation
+   */
+  Error set_automation (String property_name, int32 midi_channel, MidiControl control_type);
+  MidiControl get_automation_control (String property_name); ///< Get control type from an automation 
property.
   Error set_input (String input_channel, Source omodule, String output_channel); ///< Connect a module input 
to another module's output.
   Error set_input_by_id (int32 input_channel, Source omodule, int32 output_channel); ///< Connect a module 
input to another module's output.
   Error unset_input (String input_channel, Source omodule, String output_channel); ///< Disconnect a module 
input.
diff --git a/bse/bsebasics.idl b/bse/bsebasics.idl
index 7386ae7..52fa70b 100644
--- a/bse/bsebasics.idl
+++ b/bse/bsebasics.idl
@@ -26,174 +26,6 @@ sequence TypeSeq {
 sequence Flo4tSeq {
   Real values;
 };
-enum MidiControlType {
-  /* special cased signals */
-  MIDI_CONTROL_NONE                            = Enum (0, _("None")),
-  /* 14bit, continuous controls */
-  MIDI_CONTROL_CONTINUOUS_0                    = Enum (64,  _("Bank Select"), _("Continuous MIDI Control #1 
- Bank Select")),
-  MIDI_CONTROL_CONTINUOUS_1                    = Enum (65,  _("Modulation Depth")),
-  MIDI_CONTROL_CONTINUOUS_2                    = Enum (66,  _("Breath Control")),
-  MIDI_CONTROL_CONTINUOUS_3                    = Enum (67,  _("Continuous 3")),
-  MIDI_CONTROL_CONTINUOUS_4                    = Enum (68,  _("Foot Controller")),
-  MIDI_CONTROL_CONTINUOUS_5                    = Enum (69,  _("Portamento Time")),
-  MIDI_CONTROL_CONTINUOUS_6                    = Enum (70,  _("Data Entry")),
-  MIDI_CONTROL_CONTINUOUS_7                    = Enum (71,  _("Volume")),
-  MIDI_CONTROL_CONTINUOUS_8                    = Enum (72,  _("Balance")),
-  MIDI_CONTROL_CONTINUOUS_9                    = Enum (73,  _("Continuous 9")),
-  MIDI_CONTROL_CONTINUOUS_10                   = Enum (74,  _("Panorama")),
-  MIDI_CONTROL_CONTINUOUS_11                   = Enum (75,  _("Expression")),
-  MIDI_CONTROL_CONTINUOUS_12                   = Enum (76,  _("Effect Control 1")),
-  MIDI_CONTROL_CONTINUOUS_13                   = Enum (77,  _("Effect Control 2")),
-  MIDI_CONTROL_CONTINUOUS_14                   = Enum (78,  _("Continuous 14")),
-  MIDI_CONTROL_CONTINUOUS_15                   = Enum (79,  _("Continuous 15")),
-  MIDI_CONTROL_CONTINUOUS_16                   = Enum (80,  _("General Purpose Controller 1")),
-  MIDI_CONTROL_CONTINUOUS_17                   = Enum (81,  _("General Purpose Controller 2")),
-  MIDI_CONTROL_CONTINUOUS_18                   = Enum (82,  _("General Purpose Controller 3")),
-  MIDI_CONTROL_CONTINUOUS_19                   = Enum (83,  _("General Purpose Controller 4")),
-  MIDI_CONTROL_CONTINUOUS_20                   = Enum (84,  _("Continuous 20")),
-  MIDI_CONTROL_CONTINUOUS_21                   = Enum (85,  _("Continuous 21")),
-  MIDI_CONTROL_CONTINUOUS_22                   = Enum (86,  _("Continuous 22")),
-  MIDI_CONTROL_CONTINUOUS_23                   = Enum (87,  _("Continuous 23")),
-  MIDI_CONTROL_CONTINUOUS_24                   = Enum (88,  _("Continuous 24")),
-  MIDI_CONTROL_CONTINUOUS_25                   = Enum (89,  _("Continuous 25")),
-  MIDI_CONTROL_CONTINUOUS_26                   = Enum (90,  _("Continuous 26")),
-  MIDI_CONTROL_CONTINUOUS_27                   = Enum (91,  _("Continuous 27")),
-  MIDI_CONTROL_CONTINUOUS_28                   = Enum (92,  _("Continuous 28")),
-  MIDI_CONTROL_CONTINUOUS_29                   = Enum (93,  _("Continuous 29")),
-  MIDI_CONTROL_CONTINUOUS_30                   = Enum (94,  _("Continuous 30")),
-  MIDI_CONTROL_CONTINUOUS_31                   = Enum (95,  _("Continuous 31")),
-  /* 7bit, literal channel controls, MSB values */
-  MIDI_CONTROL_0                               = Enum (128, _("Control 0 Bank Select MSB")),
-  MIDI_CONTROL_1                               = Enum (129, _("Control 1 Modulation Depth MSB")),
-  MIDI_CONTROL_2                               = Enum (130, _("Control 2 Breath Control MSB")),
-  MIDI_CONTROL_3                               = Enum (131, _("control-3")),
-  MIDI_CONTROL_4                               = Enum (132, _("Control 4 Foot Controller MSB")),
-  MIDI_CONTROL_5                               = Enum (133, _("Control 5 Portamento Time MSB")),
-  MIDI_CONTROL_6                               = Enum (134, _("Control 6 Data Entry MSB")),
-  MIDI_CONTROL_7                               = Enum (135, _("Control 7 Volume MSB")),
-  MIDI_CONTROL_8                               = Enum (136, _("Control 8 Balance MSB")),
-  MIDI_CONTROL_9                               = Enum (137, _("control-9")),
-  MIDI_CONTROL_10                              = Enum (138, _("Control 10 Panorama MSB")),
-  MIDI_CONTROL_11                              = Enum (139, _("Control 11 Expression MSB")),
-  MIDI_CONTROL_12                              = Enum (140, _("Control 12 Effect Control 1 MSB")),
-  MIDI_CONTROL_13                              = Enum (141, _("Control 13 Effect Control 2 MSB")),
-  MIDI_CONTROL_14                              = Enum (142, _("control-14")),
-  MIDI_CONTROL_15                              = Enum (143, _("control-15")),
-  MIDI_CONTROL_16                              = Enum (144, _("Control 16 General Purpose Controller 1 
MSB")),
-  MIDI_CONTROL_17                              = Enum (145, _("Control 17 General Purpose Controller 2 
MSB")),
-  MIDI_CONTROL_18                              = Enum (146, _("Control 18 General Purpose Controller 3 
MSB")),
-  MIDI_CONTROL_19                              = Enum (147, _("Control 19 General Purpose Controller 4 
MSB")),
-  MIDI_CONTROL_20                              = Enum (148, _("control-20")),
-  MIDI_CONTROL_21                              = Enum (149, _("control-21")),
-  MIDI_CONTROL_22                              = Enum (150, _("control-22")),
-  MIDI_CONTROL_23                              = Enum (151, _("control-23")),
-  MIDI_CONTROL_24                              = Enum (152, _("control-24")),
-  MIDI_CONTROL_25                              = Enum (153, _("control-25")),
-  MIDI_CONTROL_26                              = Enum (154, _("control-26")),
-  MIDI_CONTROL_27                              = Enum (155, _("control-27")),
-  MIDI_CONTROL_28                              = Enum (156, _("control-28")),
-  MIDI_CONTROL_29                              = Enum (157, _("control-29")),
-  MIDI_CONTROL_30                              = Enum (158, _("control-30")),
-  MIDI_CONTROL_31                              = Enum (159, _("control-31")),
-  /* 7bit, literal channel controls, LSB values */
-  MIDI_CONTROL_32                              = Enum (160, _("Control 32 Bank Select LSB")),
-  MIDI_CONTROL_33                              = Enum (161, _("Control 33 Modulation Depth LSB")),
-  MIDI_CONTROL_34                              = Enum (162, _("Control 34 Breath Control LSB")),
-  MIDI_CONTROL_35                              = Enum (163, _("control-35")),
-  MIDI_CONTROL_36                              = Enum (164, _("Control 36 Foot Controller LSB")),
-  MIDI_CONTROL_37                              = Enum (165, _("Control 37 Portamento Time LSB")),
-  MIDI_CONTROL_38                              = Enum (166, _("Control 38 Data Entry LSB")),
-  MIDI_CONTROL_39                              = Enum (167, _("Control 39 Volume LSB")),
-  MIDI_CONTROL_40                              = Enum (168, _("Control 40 Balance LSB")),
-  MIDI_CONTROL_41                              = Enum (169, _("control-41")),
-  MIDI_CONTROL_42                              = Enum (170, _("Control 42 Panorama LSB")),
-  MIDI_CONTROL_43                              = Enum (171, _("Control 43 Expression LSB")),
-  MIDI_CONTROL_44                              = Enum (172, _("Control 44 Effect Control 1 LSB")),
-  MIDI_CONTROL_45                              = Enum (173, _("Control 45 Effect Control 2 LSB")),
-  MIDI_CONTROL_46                              = Enum (174, _("control-46")),
-  MIDI_CONTROL_47                              = Enum (175, _("control-47")),
-  MIDI_CONTROL_48                              = Enum (176, _("Control 48 General Purpose Controller 1 
LSB")),
-  MIDI_CONTROL_49                              = Enum (177, _("Control 49 General Purpose Controller 2 
LSB")),
-  MIDI_CONTROL_50                              = Enum (178, _("Control 50 General Purpose Controller 3 
LSB")),
-  MIDI_CONTROL_51                              = Enum (179, _("Control 51 General Purpose Controller 4 
LSB")),
-  MIDI_CONTROL_52                              = Enum (180, _("control-52")),
-  MIDI_CONTROL_53                              = Enum (181, _("control-53")),
-  MIDI_CONTROL_54                              = Enum (182, _("control-54")),
-  MIDI_CONTROL_55                              = Enum (183, _("control-55")),
-  MIDI_CONTROL_56                              = Enum (184, _("control-56")),
-  MIDI_CONTROL_57                              = Enum (185, _("control-57")),
-  MIDI_CONTROL_58                              = Enum (186, _("control-58")),
-  MIDI_CONTROL_59                              = Enum (187, _("control-59")),
-  MIDI_CONTROL_60                              = Enum (188, _("control-60")),
-  MIDI_CONTROL_61                              = Enum (189, _("control-61")),
-  MIDI_CONTROL_62                              = Enum (190, _("control-62")),
-  MIDI_CONTROL_63                              = Enum (191, _("control-63")),
-  /* 7bit, literal channel controls */
-  MIDI_CONTROL_64                              = Enum (192, _("Control 64 Damper Pedal Switch (Sustain)")),
-  MIDI_CONTROL_65                              = Enum (193, _("Control 65 Portamento Switch")),
-  MIDI_CONTROL_66                              = Enum (194, _("Control 66 Sustenuto Switch")),
-  MIDI_CONTROL_67                              = Enum (195, _("Control 67 Soft Switch")),
-  MIDI_CONTROL_68                              = Enum (196, _("Control 68 Legato Pedal Switch")),
-  MIDI_CONTROL_69                              = Enum (197, _("Control 69 Hold Pedal Switch")),
-  MIDI_CONTROL_70                              = Enum (198, _("Control 70 Sound Variation")),
-  MIDI_CONTROL_71                              = Enum (199, _("Control 71 Filter Resonance (Timbre)")),
-  MIDI_CONTROL_72                              = Enum (200, _("Control 72 Sound Release Time")),
-  MIDI_CONTROL_73                              = Enum (201, _("Control 73 Sound Attack Time")),
-  MIDI_CONTROL_74                              = Enum (202, _("Control 74 Sound Brightness")),
-  MIDI_CONTROL_75                              = Enum (203, _("Control 75 Sound Decay Time")),
-  MIDI_CONTROL_76                              = Enum (204, _("Control 76 Vibrato Rate")),
-  MIDI_CONTROL_77                              = Enum (205, _("Control 77 Vibrato Depth")),
-  MIDI_CONTROL_78                              = Enum (206, _("Control 78 Vibrato Delay")),
-  MIDI_CONTROL_79                              = Enum (207, _("Control 79 Sound Control 10")),
-  MIDI_CONTROL_80                              = Enum (208, _("Control 80 General Purpose Switch 5")),
-  MIDI_CONTROL_81                              = Enum (209, _("Control 81 General Purpose Switch 6")),
-  MIDI_CONTROL_82                              = Enum (210, _("Control 82 General Purpose Switch 7")),
-  MIDI_CONTROL_83                              = Enum (211, _("Control 83 General Purpose Switch 8")),
-  MIDI_CONTROL_84                              = Enum (212, _("Control 84 Portamento Control (Note)")),
-  MIDI_CONTROL_85                              = Enum (213, _("control-85")),
-  MIDI_CONTROL_86                              = Enum (214, _("control-86")),
-  MIDI_CONTROL_87                              = Enum (215, _("control-87")),
-  MIDI_CONTROL_88                              = Enum (216, _("control-88")),
-  MIDI_CONTROL_89                              = Enum (217, _("control-89")),
-  MIDI_CONTROL_90                              = Enum (218, _("control-90")),
-  MIDI_CONTROL_91                              = Enum (219, _("Control 91 Reverb Depth")),
-  MIDI_CONTROL_92                              = Enum (220, _("Control 92 Tremolo Depth")),
-  MIDI_CONTROL_93                              = Enum (221, _("Control 93 Chorus Depth")),
-  MIDI_CONTROL_94                              = Enum (222, _("Control 93 Detune Depth")),
-  MIDI_CONTROL_95                              = Enum (223, _("Control 95 Phase Depth")),
-  MIDI_CONTROL_96                              = Enum (224, _("Control 96 Data Increment Trigger")),
-  MIDI_CONTROL_97                              = Enum (225, _("Control 97 Data Decrement Trigger")),
-  MIDI_CONTROL_98                              = Enum (226, _("Control 98 Non-Registered Parameter MSB")),
-  MIDI_CONTROL_99                              = Enum (227, _("Control 99 Non-Registered Parameter LSB")),
-  MIDI_CONTROL_100                             = Enum (228, _("Control 100 Registered Parameter MSB")),
-  MIDI_CONTROL_101                             = Enum (229, _("Control 101 Registered Parameter LSB")),
-  MIDI_CONTROL_102                             = Enum (230, _("control-102")),
-  MIDI_CONTROL_103                             = Enum (231, _("control-103")),
-  MIDI_CONTROL_104                             = Enum (232, _("control-104")),
-  MIDI_CONTROL_105                             = Enum (233, _("control-105")),
-  MIDI_CONTROL_106                             = Enum (234, _("control-106")),
-  MIDI_CONTROL_107                             = Enum (235, _("control-107")),
-  MIDI_CONTROL_108                             = Enum (236, _("control-108")),
-  MIDI_CONTROL_109                             = Enum (237, _("control-109")),
-  MIDI_CONTROL_110                             = Enum (238, _("control-110")),
-  MIDI_CONTROL_111                             = Enum (239, _("control-111")),
-  MIDI_CONTROL_112                             = Enum (240, _("control-112")),
-  MIDI_CONTROL_113                             = Enum (241, _("control-113")),
-  MIDI_CONTROL_114                             = Enum (242, _("control-114")),
-  MIDI_CONTROL_115                             = Enum (243, _("control-115")),
-  MIDI_CONTROL_116                             = Enum (244, _("control-116")),
-  MIDI_CONTROL_117                             = Enum (245, _("control-117")),
-  MIDI_CONTROL_118                             = Enum (246, _("control-118")),
-  MIDI_CONTROL_119                             = Enum (247, _("control-119")),
-  MIDI_CONTROL_120                             = Enum (248, _("Control 120 All Sound Off ITrigger")),
-  MIDI_CONTROL_121                             = Enum (249, _("Control 121 All Controllers Off ITrigger")),
-  MIDI_CONTROL_122                             = Enum (250, _("Control 122 Local Control Switch")),
-  MIDI_CONTROL_123                             = Enum (251, _("Control 123 All Notes Off ITrigger")),
-  MIDI_CONTROL_124                             = Enum (252, _("Control 124 Omni Mode Off ITrigger")),
-  MIDI_CONTROL_125                             = Enum (253, _("Control 125 Omni Mode On ITrigger")),
-  MIDI_CONTROL_126                             = Enum (254, _("Control 126 Monophonic Voices Mode")),
-  MIDI_CONTROL_127                             = Enum (255, _("Control 127 Polyphonic Mode On ITrigger")),
-};
 enum MidiChannelEventType {
   MIDI_EVENT_NONE = 0,
   /* channel voice messages */
diff --git a/bse/bsesource.cc b/bse/bsesource.cc
index 8234ab7..092c89a 100644
--- a/bse/bsesource.cc
+++ b/bse/bsesource.cc
@@ -469,19 +469,19 @@ bse_source_set_automation_property (BseSource        *source,
                                     guint             midi_channel,
                                     Bse::MidiSignal signal_type)
 {
-  static_assert (BSE_MIDI_CONTROL_NONE          == BseMidiControlType (0) &&
-                 BSE_MIDI_CONTROL_CONTINUOUS_0  == BseMidiControlType (Bse::MidiSignal::CONTINUOUS_0) &&
-                 BSE_MIDI_CONTROL_CONTINUOUS_31 == BseMidiControlType (Bse::MidiSignal::CONTINUOUS_31) &&
-                 BSE_MIDI_CONTROL_0             == BseMidiControlType (Bse::MidiSignal::CONTROL_0) &&
-                 BSE_MIDI_CONTROL_127           == BseMidiControlType (Bse::MidiSignal::CONTROL_127), "");
+  static_assert (Bse::MidiControl::NONE          == 0 &&
+                 Bse::MidiControl::CONTINUOUS_0  == int64 (Bse::MidiSignal::CONTINUOUS_0) &&
+                 Bse::MidiControl::CONTINUOUS_31 == int64 (Bse::MidiSignal::CONTINUOUS_31) &&
+                 Bse::MidiControl::CONTROL_0     == int64 (Bse::MidiSignal::CONTROL_0) &&
+                 Bse::MidiControl::CONTROL_127   == int64 (Bse::MidiSignal::CONTROL_127), "");
   assert_return (BSE_IS_SOURCE (source), Bse::Error::INTERNAL);
   assert_return (prop_name != NULL, Bse::Error::INTERNAL);
   if (BSE_SOURCE_PREPARED (source))
     return Bse::Error::SOURCE_BUSY;
-  const BseMidiControlType control_type = BseMidiControlType (signal_type);
-  if (control_type != BSE_MIDI_CONTROL_NONE &&
-      (control_type < BSE_MIDI_CONTROL_CONTINUOUS_0 || control_type > BSE_MIDI_CONTROL_CONTINUOUS_31) &&
-      (control_type < BSE_MIDI_CONTROL_0 || control_type > BSE_MIDI_CONTROL_127))
+  const Bse::MidiControl control_type = Bse::MidiControl (signal_type);
+  if (control_type != Bse::MidiControl::NONE &&
+      (control_type < Bse::MidiControl::CONTINUOUS_0 || control_type > Bse::MidiControl::CONTINUOUS_31) &&
+      (control_type < Bse::MidiControl::CONTROL_0 || control_type > Bse::MidiControl::CONTROL_127))
     return Bse::Error::INVALID_MIDI_CONTROL;
   source_class_collect_properties (BSE_SOURCE_GET_CLASS (source));
   GParamSpec *pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (source), prop_name);
@@ -2336,4 +2336,38 @@ SourceImpl::set_pos (double x_pos, double y_pos)
     }
 }
 
+MidiControl
+SourceImpl::get_automation_control (const String &property_name)
+{
+  BseSource *self = as<BseSource*>();
+  MidiSignal control_type = MidiSignal (0);
+  bse_source_get_automation_property (self, property_name.c_str(), NULL, &control_type);
+  return MidiControl (control_type);                            // MidiControl values are identical to 
MidiSignal valus
+}
+
+Error
+SourceImpl::set_automation (const String &property_name, int midi_channel, MidiControl control_type)
+{
+  BseSource *self = as<BseSource*>();
+  MidiSignal control_signal = MidiSignal (control_type);        // MidiControl values are identical to 
MidiSignal valuas
+  if (midi_channel < 0 || property_name.empty())
+    return Error::PROC_PARAM_INVAL;
+  uint old_midi_channel = 0;
+  MidiSignal old_control_type = MidiSignal (0);
+  bse_source_get_automation_property (self, property_name.c_str(), &old_midi_channel, &old_control_type);
+  Error error = Error::NONE;
+  if (old_midi_channel != uint (midi_channel) || old_control_type != uint (control_type))
+    {
+      error = bse_source_set_automation_property (self, property_name.c_str(), midi_channel, control_signal);
+      if (error == Error::NONE)
+        {
+          auto lambda = [property_name, old_midi_channel, old_control_type] (SourceImpl &self, BseUndoStack 
*ustack) -> Error {
+            return self.set_automation (property_name, old_midi_channel, MidiControl (old_control_type));
+          };
+          push_undo (__func__, *this, lambda);
+        }
+    }
+  return error;
+}
+
 } // Bse
diff --git a/bse/bsesource.hh b/bse/bsesource.hh
index 06cf427..da33f7c 100644
--- a/bse/bsesource.hh
+++ b/bse/bsesource.hh
@@ -297,6 +297,8 @@ public:
   virtual Error        unset_input             (const String &input_channel, SourceIface &omodule, const 
String &output_channel) override;
   virtual Error        unset_input_by_id       (int input_channel, SourceIface &omodule, int output_channel) 
override;
   virtual void         set_pos                 (double x_pos, double y_pos) override;
+  virtual MidiControl  get_automation_control  (const String &property_name) override;
+  virtual Error        set_automation          (const String &property_name, int midi_channel, MidiControl 
control_type) override;
 };
 
 } // Bse
diff --git a/bse/bsesource.proc b/bse/bsesource.proc
index 2226f4d..be03c87 100644
--- a/bse/bsesource.proc
+++ b/bse/bsesource.proc
@@ -66,50 +66,6 @@ BODY (BseProcedureClass *proc,
   return Bse::Error::NONE;
 }
 
-METHOD (BseSource, set-automation) {
-  HELP = "Setup automation parameters for a property.";
-  IN   = bse_param_spec_object ("source", NULL, NULL,
-                                BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
-  IN    = sfi_pspec_string ("property_name", NULL, "Item property name",
-                            NULL, SFI_PARAM_STANDARD);
-  IN    = sfi_pspec_int ("midi_channel", _("MIDI Channel"), _("The MIDI Channel from which automation events 
should be received, 0 designates the default MIDI channel"),
-                         0, 0, BSE_MIDI_MAX_CHANNELS, 1, SFI_PARAM_STANDARD ":scale:unprepared");
-  IN    = bse_param_spec_genum ("control_type", _("Control Type"), _("The type of control events used for 
automation"),
-                                BSE_TYPE_MIDI_CONTROL_TYPE, BSE_MIDI_CONTROL_CONTINUOUS_16, 
SFI_PARAM_STANDARD);
-  OUT   = bse_param_spec_genum ("error", "Error", NULL, BSE_TYPE_ERROR_TYPE, Bse::Error::NONE, 
SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
-      const GValue      *in_values,
-      GValue            *out_values)
-{
-  /* extract parameter values */
-  BseSource *source = (BseSource*) bse_value_get_object (in_values++);
-  const char *property = sfi_value_get_string (in_values++);
-  guint      midi_channel = sfi_value_get_int (in_values++);
-  Bse::MidiSignal control_type = (Bse::MidiSignal) g_value_get_enum (in_values++);
-  Bse::Error error = Bse::Error::NONE;
-
-  /* check parameters */
-  if (!BSE_IS_SOURCE (source) || !property)
-    return Bse::Error::PROC_PARAM_INVAL;
-
-  /* connect */
-  guint old_midi_channel = 0;
-  Bse::MidiSignal old_control_type = Bse::MidiSignal (0);
-  bse_source_get_automation_property (source, property, &old_midi_channel, &old_control_type);
-  if (old_midi_channel != midi_channel || old_control_type != control_type)
-    {
-      error = bse_source_set_automation_property (source, property, midi_channel, control_type);
-      if (error == Bse::Error::NONE)
-        bse_item_push_undo_proc (source, "set-automation", property, old_midi_channel, old_control_type);
-    }
-
-  /* set output parameters */
-  g_value_set_enum (out_values++, int (error));
-
-  return Bse::Error::NONE;
-}
-
 METHOD (BseSource, get-automation-channel) {
   HELP = "Get MIDI channel from an automation property.";
   IN   = bse_param_spec_object ("source", NULL, NULL,
@@ -138,32 +94,3 @@ BODY (BseProcedureClass *proc,
 
   return Bse::Error::NONE;
 }
-
-METHOD (BseSource, get-automation-control) {
-  HELP = "Get control type from an automation property.";
-  IN   = bse_param_spec_object ("source", NULL, NULL,
-                                BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
-  IN    = sfi_pspec_string ("property_name", NULL, "Item property name",
-                            NULL, SFI_PARAM_STANDARD);
-  OUT   = bse_param_spec_genum ("control_type", NULL, NULL, BSE_TYPE_MIDI_CONTROL_TYPE, 
BSE_MIDI_CONTROL_CONTINUOUS_16, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
-      const GValue      *in_values,
-      GValue            *out_values)
-{
-  /* extract parameter values */
-  BseSource *source = (BseSource*) bse_value_get_object (in_values++);
-  const char *property = sfi_value_get_string (in_values++);
-
-  /* check parameters */
-  if (!BSE_IS_SOURCE (source) || !property)
-    return Bse::Error::PROC_PARAM_INVAL;
-
-  /* connect */
-  Bse::MidiSignal control_type = Bse::MidiSignal (0);
-  bse_source_get_automation_property (source, property, NULL, &control_type);
-  /* set output parameters */
-  g_value_set_enum (out_values++, int (control_type));
-
-  return Bse::Error::NONE;
-}
diff --git a/bse/bsestorage.cc b/bse/bsestorage.cc
index a99ffef..ccbdefc 100644
--- a/bse/bsestorage.cc
+++ b/bse/bsestorage.cc
@@ -869,7 +869,7 @@ restore_source_automation (BseItem    *item,
   gint midi_channel = scanner->value.v_int64;
   /* parse control type */
   parse_or_return (scanner, G_TOKEN_IDENTIFIER);
-  BseMidiControlType control_type = (BseMidiControlType) sfi_choice2enum (scanner->value.v_identifier, 
BSE_TYPE_MIDI_CONTROL_TYPE);
+  Bse::MidiControl control_type = Aida::enum_value_from_string<Bse::MidiControl> 
(scanner->value.v_identifier);
   /* close statement */
   parse_or_return (scanner, ')');
   Bse::Error error = bse_source_set_automation_property (BSE_SOURCE (item), pspec->name, midi_channel, 
Bse::MidiSignal (control_type));
@@ -1222,12 +1222,12 @@ bse_source_store_automation (BseSource  *source,
   guint midi_channel = 0;
   Bse::MidiSignal signal_type = Bse::MidiSignal (0);
   bse_source_get_automation_property (source, pspec->name, &midi_channel, &signal_type);
-  BseMidiControlType control_type = BseMidiControlType (signal_type);
-  if (control_type)
+  Bse::MidiControl control_type = Bse::MidiControl (signal_type);
+  if (control_type != 0)
     {
       bse_storage_break (storage);
-      bse_storage_printf (storage, "(source-automate \"%s\" %u %s)", pspec->name,
-                          midi_channel, sfi_enum2choice (control_type, BSE_TYPE_MIDI_CONTROL_TYPE));
+      bse_storage_printf (storage, "(source-automate \"%s\" %u %s)", pspec->name, midi_channel,
+                          Aida::enum_value_to_string (control_type));
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]