[beast/wip/soundfont: 820/832] BSE: SF2: use C++ inheritance for GObject struct derivation
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/wip/soundfont: 820/832] BSE: SF2: use C++ inheritance for GObject struct derivation
- Date: Sun, 6 Nov 2016 11:51:38 +0000 (UTC)
commit 75e5a0cfc04a2a96e1941911fdd2d2218182dd7d
Author: Tim Janik <timj gnu org>
Date: Fri Mar 22 01:17:28 2013 +0100
BSE: SF2: use C++ inheritance for GObject struct derivation
bse/bsedefs.hh | 12 ++++++------
bse/bsesoundfont.hh | 14 +++-----------
bse/bsesoundfontosc.hh | 23 ++++-------------------
bse/bsesoundfontpreset.hh | 14 +++-----------
bse/bsesoundfontrepo.hh | 20 +++++---------------
5 files changed, 21 insertions(+), 62 deletions(-)
---
diff --git a/bse/bsedefs.hh b/bse/bsedefs.hh
index f1f962e..69e1674 100644
--- a/bse/bsedefs.hh
+++ b/bse/bsedefs.hh
@@ -65,12 +65,12 @@ struct BseSNetClass;
struct BseSong;
struct BseSongClass;
typedef struct _BseSongSequencer BseSongSequencer;
-typedef struct _BseSoundFont BseSoundFont;
-typedef struct _BseSoundFontClass BseSoundFontClass;
-typedef struct _BseSoundFontPreset BseSoundFontPreset;
-typedef struct _BseSoundFontPresetClass BseSoundFontPresetClass;
-typedef struct _BseSoundFontRepo BseSoundFontRepo;
-typedef struct _BseSoundFontRepoClass BseSoundFontRepoClass;
+struct BseSoundFont;
+struct BseSoundFontClass;
+struct BseSoundFontPreset;
+struct BseSoundFontPresetClass;
+struct BseSoundFontRepo;
+struct BseSoundFontRepoClass;
struct BseSource;
struct BseSourceClass;
struct BseStorage;
diff --git a/bse/bsesoundfont.hh b/bse/bsesoundfont.hh
index af18a04..13f724c 100644
--- a/bse/bsesoundfont.hh
+++ b/bse/bsesoundfont.hh
@@ -15,23 +15,15 @@ G_BEGIN_DECLS
#define BSE_IS_SOUND_FONT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_SOUND_FONT))
#define BSE_SOUND_FONT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_SOUND_FONT,
BseSoundFontClass))
-
-/* --- BseSoundFont --- */
-struct _BseSoundFont
-{
- BseContainer parent_object;
+struct BseSoundFont : BseContainer {
BseStorageBlob *blob;
int sfont_id;
BseSoundFontRepo *sfrepo;
GList *presets;
};
-struct _BseSoundFontClass
-{
- BseContainerClass parent_class;
-};
-
+struct BseSoundFontClass : BseContainerClass
+{};
-/* --- prototypes -- */
BseErrorType bse_sound_font_load_blob (BseSoundFont *sound_font,
BseStorageBlob *blob,
gboolean init_presets);
diff --git a/bse/bsesoundfontosc.hh b/bse/bsesoundfontosc.hh
index 92b11cf..746fdcf 100644
--- a/bse/bsesoundfontosc.hh
+++ b/bse/bsesoundfontosc.hh
@@ -9,10 +9,6 @@
extern "C" {
#endif /* __cplusplus */
-
-
-
-/* --- object type macros --- */
#define BSE_TYPE_SOUND_FONT_OSC (BSE_TYPE_ID (BseSoundFontOsc))
#define BSE_SOUND_FONT_OSC(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_SOUND_FONT_OSC,
BseSoundFontOsc))
#define BSE_SOUND_FONT_OSC_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class),
BSE_TYPE_SOUND_FONT_OSC, BseSoundFontOscClass))
@@ -28,12 +24,7 @@ enum
BSE_SOUND_FONT_OSC_N_OCHANNELS
};
-/* --- BseSoundFontOsc source --- */
-typedef struct _BseSoundFontOsc BseSoundFontOsc;
-typedef struct _BseSoundFontOscClass BseSoundFontOscClass;
-typedef struct _BseSoundFontOscConfig BseSoundFontOscConfig;
-struct _BseSoundFontOscConfig
-{
+struct BseSoundFontOscConfig {
int osc_id;
int sfont_id;
int bank;
@@ -43,18 +34,12 @@ struct _BseSoundFontOscConfig
int update_preset; /* preset changed indicator */
};
-struct _BseSoundFontOsc
-{
- BseSource parent_object;
+struct BseSoundFontOsc : BseSource {
BseSoundFontPreset *preset;
BseSoundFontOscConfig config;
};
-struct _BseSoundFontOscClass
-{
- BseSourceClass parent_class;
-};
-
-
+struct BseSoundFontOscClass : BseSourceClass
+{};
#ifdef __cplusplus
}
diff --git a/bse/bsesoundfontpreset.hh b/bse/bsesoundfontpreset.hh
index 76c60d2..1edde67 100644
--- a/bse/bsesoundfontpreset.hh
+++ b/bse/bsesoundfontpreset.hh
@@ -15,21 +15,13 @@ G_BEGIN_DECLS
#define BSE_IS_SOUND_FONT_PRESET_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class),
BSE_TYPE_SOUND_FONT_PRESET))
#define BSE_SOUND_FONT_PRESET_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object),
BSE_TYPE_SOUND_FONT_PRESET, BseSoundFontPresetClass))
-
-/* --- BseSoundFontPreset --- */
-struct _BseSoundFontPreset
-{
- BseItem parent_object;
+struct BseSoundFontPreset : BseItem {
int program;
int bank;
};
-struct _BseSoundFontPresetClass
-{
- BseItemClass parent_class;
-};
-
+struct BseSoundFontPresetClass : BseItemClass
+{};
-/* --- prototypes -- */
void bse_sound_font_preset_init_preset (BseSoundFontPreset *self,
fluid_preset_t *fluid_preset);
diff --git a/bse/bsesoundfontrepo.hh b/bse/bsesoundfontrepo.hh
index 0a431ff..d69cb6a 100644
--- a/bse/bsesoundfontrepo.hh
+++ b/bse/bsesoundfontrepo.hh
@@ -7,11 +7,8 @@
#include <bse/bsesoundfontosc.hh>
#include <bse/bseengine.hh>
-
G_BEGIN_DECLS
-
-/* --- object type macros --- */
#define BSE_TYPE_SOUND_FONT_REPO (BSE_TYPE_ID (BseSoundFontRepo))
#define BSE_SOUND_FONT_REPO(object) (G_TYPE_CHECK_INSTANCE_CAST ((object),
BSE_TYPE_SOUND_FONT_REPO, BseSoundFontRepo))
#define BSE_SOUND_FONT_REPO_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_SOUND_FONT_REPO,
BseSoundFontRepoClass))
@@ -19,12 +16,9 @@ G_BEGIN_DECLS
#define BSE_IS_SOUND_FONT_REPO_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_SOUND_FONT_REPO))
#define BSE_SOUND_FONT_REPO_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object),
BSE_TYPE_SOUND_FONT_REPO, BseSoundFontRepoClass))
-
-/* --- BseSoundFontRepo object --- */
#define BSE_FLUID_SYNTH_PROGRAM_SELECT -1
-typedef struct _BseFluidEvent BseFluidEvent;
-struct _BseFluidEvent
-{
+
+struct BseFluidEvent {
guint64 tick_stamp;
int channel;
int command;
@@ -32,10 +26,8 @@ struct _BseFluidEvent
int arg2;
int sfont_id; /* required for program selection only */
};
-struct _BseSoundFontRepo
-{
- BseSuper parent_object;
+struct BseSoundFontRepo : BseSuper {
Bse::Mutex fluid_synth_mutex;
fluid_settings_t *fluid_settings;
fluid_synth_t *fluid_synth;
@@ -57,10 +49,8 @@ struct _BseSoundFontRepo
GList *sound_fonts;
};
-struct _BseSoundFontRepoClass
-{
- BseSuperClass parent_class;
-};
+struct BseSoundFontRepoClass : BseSuperClass
+{};
/* --- prototypes --- */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]