[beast/wip/timj/soundfont: 2/13] BSE: SF2: adapt code to c++ified beast codebase
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/wip/timj/soundfont: 2/13] BSE: SF2: adapt code to c++ified beast codebase
- Date: Mon, 19 Sep 2016 08:17:29 +0000 (UTC)
commit 710ba0783c5ec7e66041fbee6563d4c7f507b380
Author: Stefan Westerfeld <stefan space twc de>
Date: Fri Mar 8 20:10:34 2013 +0100
BSE: SF2: adapt code to c++ified beast codebase
bse/Makefile.am | 5 +-
bse/bseproject.cc | 16 ++--
bse/bseproject.proc | 4 +-
bse/{bsesoundfont.c => bsesoundfont.cc} | 63 +++++++-----------
bse/{bsesoundfont.h => bsesoundfont.hh} | 30 ++-------
bse/{bsesoundfontosc.c => bsesoundfontosc.cc} | 68 ++++++++------------
bse/{bsesoundfontosc.h => bsesoundfontosc.hh} | 28 ++------
...{bsesoundfontpreset.c => bsesoundfontpreset.cc} | 44 ++++---------
bse/bsesoundfontpreset.h | 54 ----------------
bse/bsesoundfontpreset.hh | 38 +++++++++++
bse/{bsesoundfontrepo.c => bsesoundfontrepo.cc} | 51 +++++----------
bse/{bsesoundfontrepo.h => bsesoundfontrepo.hh} | 32 ++-------
bse/bsesoundfontrepo.proc | 14 ++--
bse/bsestorage.cc | 4 +-
bse/bsetrack.cc | 10 ++--
15 files changed, 167 insertions(+), 294 deletions(-)
---
diff --git a/bse/Makefile.am b/bse/Makefile.am
index 0d16dbb..e752016 100644
--- a/bse/Makefile.am
+++ b/bse/Makefile.am
@@ -46,7 +46,7 @@ bse_public_headers = $(strip \
bsesnet.hh bsesnooper.hh bsesong.hh bsesequencer.hh \
bsesource.hh bsestandardosc.hh bsestandardsynths.hh bsestorage.hh \
bseinstrumentoutput.hh bsesubiport.hh bseinstrumentinput.hh bsesuboport.hh \
- bsesoundfont.h bsesoundfontpreset.h bsesoundfontosc.h \
+ bsesoundfont.hh bsesoundfontpreset.hh bsesoundfontosc.hh bsesoundfontrepo.hh \
bsesubsynth.hh bsesuper.hh bsetrack.hh bsetype.hh \
bseutils.hh bsemidivoice.hh bsewave.hh bsewaveosc.hh \
bsecsynth.hh bsewaverepo.hh bseladspamodule.hh bsepcmwriter.hh \
@@ -79,8 +79,7 @@ bse_sources = $(strip \
bsepcmdevice.cc bsepcmdevice-oss.cc bsepcmdevice-null.cc bseplugin.cc \
bseprocedure.cc bseproject.cc bsescripthelper.cc bseserver.cc \
bsesnet.cc bsesnooper.cc bsesong.cc bsesequencer.cc \
- bsesoundfont.c bsesoundfontrepo.c bsesoundfontpreset.c bsesoundfontosc.c \
- bsesoundfontrepo.c bsesoundfont.c bsesoundfontpreset.c bsesoundfontosc.c \
+ bsesoundfontrepo.cc bsesoundfont.cc bsesoundfontpreset.cc bsesoundfontosc.cc \
bsesource.cc bsestandardosc.cc bsestandardsynths.cc bsestorage.cc \
bseinstrumentoutput.cc bsesubiport.cc bseinstrumentinput.cc bsesuboport.cc \
bsesubsynth.cc bsesuper.cc bsetrack.cc bsetype.cc \
diff --git a/bse/bseproject.cc b/bse/bseproject.cc
index 039c21b..61c1dd3 100644
--- a/bse/bseproject.cc
+++ b/bse/bseproject.cc
@@ -16,7 +16,7 @@
#include "bsemidinotifier.hh"
#include "gslcommon.hh"
#include "bseengine.hh"
-#include "bsesoundfontrepo.h"
+#include "bsesoundfontrepo.hh"
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
@@ -182,12 +182,12 @@ bse_project_init (BseProject *self,
self->midi_receiver = bse_midi_receiver_new ("BseProjectReceiver");
bse_midi_receiver_enter_farm (self->midi_receiver);
/* we always have a wave-repo */
- BseWaveRepo *wrepo = bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_WAVE_REPO,
- "uname", "Wave-Repository",
- NULL);
- BseSoundFontRepo *sfrepo = bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_SOUND_FONT_REPO,
- "uname", "Sound-Font-Repository",
- NULL);
+ BseWaveRepo *wrepo = (BseWaveRepo*) bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_WAVE_REPO,
+ "uname", "Wave-Repository",
+ NULL);
+ BseSoundFontRepo *sfrepo = (BseSoundFontRepo*) bse_container_new_child (BSE_CONTAINER (self),
BSE_TYPE_SOUND_FONT_REPO,
+ "uname", "Sound-Font-Repository",
+ NULL);
/* with fixed uname */
BSE_OBJECT_SET_FLAGS (wrepo, BSE_OBJECT_FLAG_FIXED_UNAME);
BSE_OBJECT_SET_FLAGS (sfrepo, BSE_OBJECT_FLAG_FIXED_UNAME);
@@ -654,7 +654,7 @@ bse_project_get_sound_font_repo (BseProject *self)
GSList *slist;
for (slist = self->supers; slist; slist = slist->next)
if (BSE_IS_SOUND_FONT_REPO (slist->data))
- return slist->data;
+ return (BseSoundFontRepo *) slist->data;
return NULL;
}
diff --git a/bse/bseproject.proc b/bse/bseproject.proc
index 2dc1d52..7fe99a0 100644
--- a/bse/bseproject.proc
+++ b/bse/bseproject.proc
@@ -6,7 +6,7 @@
#include <bse/bsesong.hh>
#include <bse/bseundostack.hh>
#include <bse/bsewaverepo.hh>
-#include <bse/bsesoundfontrepo.h>
+#include <bse/bsesoundfontrepo.hh>
#include <bse/bsecsynth.hh>
#include <bse/bsemidisynth.hh>
#include <bse/bsedatapocket.hh>
@@ -298,7 +298,7 @@ METHOD (BseProject, get-sound-font-repo) {
GValue *out_values)
{
/* extract parameter values */
- BseProject *project = bse_value_get_object (in_values++);
+ BseProject *project = BSE_PROJECT (bse_value_get_object (in_values++));
BseSoundFontRepo *sfrepo = NULL;
/* check parameters */
diff --git a/bse/bsesoundfont.c b/bse/bsesoundfont.cc
similarity index 85%
rename from bse/bsesoundfont.c
rename to bse/bsesoundfont.cc
index 096d749..9768890 100644
--- a/bse/bsesoundfont.c
+++ b/bse/bsesoundfont.cc
@@ -1,29 +1,13 @@
-/* BSE - Bedevilled Sound Engine
- * Copyright (C) 1997-1999, 2000-2005 Tim Janik
- * Copyright (C) 2009 Stefan Westerfeld
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * A copy of the GNU Lesser General Public License should ship along
- * with this library; if not, see http://www.gnu.org/copyleft/.
- */
-#include "bsesoundfont.h"
-#include "bsesoundfontrepo.h"
-#include "bsesoundfontpreset.h"
-#include "bsemain.h"
-#include "bsestorage.h"
-#include "bseprocedure.h"
-#include "gsldatahandle.h"
-#include "bseserver.h"
-#include "bseloader.h"
+// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+#include "bsesoundfont.hh"
+#include "bsesoundfontrepo.hh"
+#include "bsesoundfontpreset.hh"
+#include "bsemain.hh"
+#include "bsestorage.hh"
+#include "bseprocedure.hh"
+#include "gsldatahandle.hh"
+#include "bseserver.hh"
+#include "bseloader.hh"
#include <string.h>
@@ -38,7 +22,7 @@ enum {
/* --- variables --- */
-static GTypeClass *parent_class = NULL;
+static void *parent_class = NULL;
static GQuark quark_load_sound_font = 0;
@@ -155,9 +139,10 @@ bse_sound_font_load_blob (BseSoundFont *self,
fluid_sfont->iteration_start (fluid_sfont);
while (fluid_sfont->iteration_next (fluid_sfont, &fluid_preset))
{
- BseSoundFontPreset *sound_font_preset = g_object_new (BSE_TYPE_SOUND_FONT_PRESET,
- "uname", fluid_preset.get_name
(&fluid_preset),
- NULL);
+ BseSoundFontPreset *sound_font_preset;
+ sound_font_preset = (BseSoundFontPreset *) g_object_new (BSE_TYPE_SOUND_FONT_PRESET,
+ "uname", fluid_preset.get_name
(&fluid_preset),
+ NULL);
bse_container_add_item (BSE_CONTAINER (self), BSE_ITEM (sound_font_preset));
bse_sound_font_preset_init_preset (sound_font_preset, &fluid_preset);
}
@@ -219,7 +204,7 @@ bse_sound_font_store_private (BseObject *object,
}
}
-static SfiTokenType
+static GTokenType
bse_sound_font_restore_private (BseObject *object,
BseStorage *storage,
GScanner *scanner)
@@ -258,7 +243,7 @@ bse_sound_font_restore_private (BseObject *object,
if (g_scanner_peek_next_token (scanner) != ')')
{
bse_storage_blob_unref (blob);
- return ')';
+ return GTokenType (')');
}
parse_or_return (scanner, ')');
error = bse_sound_font_load_blob (sound_font, blob, FALSE);
@@ -304,7 +289,7 @@ bse_sound_font_forall_items (BseContainer *container,
{
BseItem *item;
- item = list->data;
+ item = BSE_ITEM (list->data);
list = list->next;
if (!func (item, data))
return;
@@ -333,7 +318,7 @@ bse_sound_font_release_children (BseContainer *container)
BseSoundFont *self = BSE_SOUND_FONT (container);
while (self->presets)
- bse_container_remove_item (container, self->presets->data);
+ bse_container_remove_item (container, BSE_ITEM (self->presets->data));
/* chain parent class' handler */
BSE_CONTAINER_CLASS (parent_class)->release_children (container);
@@ -341,13 +326,13 @@ bse_sound_font_release_children (BseContainer *container)
static void
-bse_sound_font_class_init (BseSoundFontClass *class)
+bse_sound_font_class_init (BseSoundFontClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- BseObjectClass *object_class = BSE_OBJECT_CLASS (class);
- BseContainerClass *container_class = BSE_CONTAINER_CLASS (class);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
+ BseContainerClass *container_class = BSE_CONTAINER_CLASS (klass);
- parent_class = g_type_class_peek_parent (class);
+ parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = bse_sound_font_set_property;
gobject_class->get_property = bse_sound_font_get_property;
diff --git a/bse/bsesoundfont.h b/bse/bsesoundfont.hh
similarity index 57%
rename from bse/bsesoundfont.h
rename to bse/bsesoundfont.hh
index 6705f8e..af18a04 100644
--- a/bse/bsesoundfont.h
+++ b/bse/bsesoundfont.hh
@@ -1,25 +1,9 @@
-/* BSE - Bedevilled Sound Engine
- * Copyright (C) 1997-1999, 2000-2005 Tim Janik
- * Copyright (C) 2009 Stefan Westerfeld
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * A copy of the GNU Lesser General Public License should ship along
- * with this library; if not, see http://www.gnu.org/copyleft/.
- */
-#ifndef __BSE_SOUND_FONT_H__
-#define __BSE_SOUND_FONT_H__
-
-#include <bse/bsecontainer.h>
-#include <bse/bsestorage.h>
+// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+#ifndef __BSE_SOUND_FONT_HH__
+#define __BSE_SOUND_FONT_HH__
+
+#include <bse/bsecontainer.hh>
+#include <bse/bsestorage.hh>
G_BEGIN_DECLS
@@ -56,4 +40,4 @@ BseErrorType bse_sound_font_reload (BseSoundFont *sound_font)
G_END_DECLS
-#endif /* __BSE_SOUND_FONT_H__ */
+#endif /* __BSE_SOUND_FONT_HH__ */
diff --git a/bse/bsesoundfontosc.c b/bse/bsesoundfontosc.cc
similarity index 91%
rename from bse/bsesoundfontosc.c
rename to bse/bsesoundfontosc.cc
index 1ba2b9e..6f84701 100644
--- a/bse/bsesoundfontosc.c
+++ b/bse/bsesoundfontosc.cc
@@ -1,30 +1,14 @@
-/* BseSoundFontOsc - BSE Fluid Synth
- * Copyright (C) 1999-2002 Tim Janik
- * Copyright (C) 2009 Stefan Westerfeld
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * A copy of the GNU Lesser General Public License should ship along
- * with this library; if not, see http://www.gnu.org/copyleft/.
- */
-#include "bsesoundfontosc.h"
-
-#include <bse/bsecategories.h>
-#include <bse/bseengine.h>
-#include <bse/bseproject.h>
-#include <bse/bsesoundfontrepo.h>
-#include <bse/bsesoundfont.h>
-#include <bse/bsesnet.h>
-#include <bse/bsemidireceiver.h>
-#include "gslcommon.h"
+// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+#include "bsesoundfontosc.hh"
+
+#include <bse/bsecategories.hh>
+#include <bse/bseengine.hh>
+#include <bse/bseproject.hh>
+#include <bse/bsesoundfontrepo.hh>
+#include <bse/bsesoundfont.hh>
+#include <bse/bsesnet.hh>
+#include <bse/bsemidireceiver.hh>
+#include "gslcommon.hh"
#include <string.h>
@@ -38,7 +22,7 @@ enum
/* --- prototypes --- */
static void bse_sound_font_osc_init (BseSoundFontOsc *sound_font_osc);
-static void bse_sound_font_osc_class_init (BseSoundFontOscClass *class);
+static void bse_sound_font_osc_class_init (BseSoundFontOscClass *klass);
static void bse_sound_font_osc_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -94,15 +78,15 @@ BSE_BUILTIN_TYPE (BseSoundFontOsc)
}
static void
-bse_sound_font_osc_class_init (BseSoundFontOscClass *class)
+bse_sound_font_osc_class_init (BseSoundFontOscClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- BseObjectClass *object_class = BSE_OBJECT_CLASS (class);
- BseSourceClass *source_class = BSE_SOURCE_CLASS (class);
- BseItemClass *item_class = BSE_ITEM_CLASS (class);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
+ BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
+ BseItemClass *item_class = BSE_ITEM_CLASS (klass);
guint ochannel;
- parent_class = g_type_class_peek_parent (class);
+ parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = bse_sound_font_osc_set_property;
gobject_class->get_property = bse_sound_font_osc_get_property;
@@ -201,7 +185,7 @@ bse_sound_font_osc_set_property (GObject *object,
{
BseSoundFontPreset *preset;
case PARAM_PRESET:
- preset = bse_value_get_object (value);
+ preset = BSE_SOUND_FONT_PRESET (bse_value_get_object (value));
if (preset != self->preset)
{
self->preset = preset;
@@ -289,7 +273,7 @@ bse_sound_font_osc_update_modules (BseSoundFontOsc *sound_font_osc,
static void
sound_font_osc_reset (BseModule *module)
{
- SoundFontOscModule *flmod = module->user_data;
+ SoundFontOscModule *flmod = (SoundFontOscModule *) module->user_data;
flmod->last_update_preset = -1;
}
@@ -301,8 +285,8 @@ process_fluid_L (BseSoundFontRepo *sfrepo,
fluid_synth_t *fluid_synth,
guint64 now_tick_stamp)
{
- float **channel_values_left = g_alloca (sfrepo->n_fluid_channels * sizeof (float *));
- float **channel_values_right = g_alloca (sfrepo->n_fluid_channels * sizeof (float *));
+ float **channel_values_left = (float **) g_alloca (sfrepo->n_fluid_channels * sizeof (float *));
+ float **channel_values_right = (float **) g_alloca (sfrepo->n_fluid_channels * sizeof (float *));
float null_fx[BSE_STREAM_MAX_VALUES];
float *channel_fx_null[2] = { null_fx, null_fx };
int i;
@@ -379,7 +363,7 @@ static void
sound_font_osc_process (BseModule *module,
guint n_values)
{
- SoundFontOscModule *flmod = module->user_data;
+ SoundFontOscModule *flmod = (SoundFontOscModule *) module->user_data;
BseSoundFontRepo *sfrepo = flmod->config.sfrepo;
fluid_synth_t *fluid_synth = bse_sound_font_repo_lock_fluid_synth (sfrepo);
guint i;
@@ -442,7 +426,7 @@ sound_font_osc_process_midi (gpointer null,
const BseMidiEvent *event,
BseTrans *trans)
{
- SoundFontOscModule *flmod = module->user_data;
+ SoundFontOscModule *flmod = (SoundFontOscModule *) module->user_data;
bse_sound_font_repo_lock_fluid_synth (flmod->config.sfrepo);
int note = bse_note_from_freq (BSE_MUSICAL_TUNING_12_TET, event->data.note.frequency);
BseFluidEvent *fluid_event = NULL;
@@ -520,7 +504,7 @@ event_handler_setup_func (BseModule *module,
ehs->module);
/* setup program before first midi event */
- SoundFontOscModule *flmod = module->user_data;
+ SoundFontOscModule *flmod = (SoundFontOscModule *) module->user_data;
BseFluidEvent *fluid_event = g_new0 (BseFluidEvent, 1);
fluid_event->command = BSE_FLUID_SYNTH_PROGRAM_SELECT;
@@ -601,7 +585,7 @@ bse_sound_font_osc_context_dismiss (BseSource *source,
while (node)
{
SfiRing *next_node = sfi_ring_walk (node, fluid_events);
- BseFluidEvent *event = node->data;
+ BseFluidEvent *event = (BseFluidEvent *) node->data;
if (event->channel == self->config.sfrepo->channel_map[self->config.osc_id])
{
g_free (event);
diff --git a/bse/bsesoundfontosc.h b/bse/bsesoundfontosc.hh
similarity index 62%
rename from bse/bsesoundfontosc.h
rename to bse/bsesoundfontosc.hh
index 395e217..a4c7764 100644
--- a/bse/bsesoundfontosc.h
+++ b/bse/bsesoundfontosc.hh
@@ -1,25 +1,9 @@
-/* BseSoundFontOsc - BSE Fluid Synth sound font player
- * Copyright (C) 1999-2002 Tim Janik
- * Copyright (C) 2009 Stefan Westerfeld
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * A copy of the GNU Lesser General Public License should ship along
- * with this library; if not, see http://www.gnu.org/copyleft/.
- */
-#ifndef __BSE_SOUND_FONT_OSC_H__
-#define __BSE_SOUND_FONT_OSC_H__
+// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+#ifndef __BSE_SOUND_FONT_OSC_HH__
+#define __BSE_SOUND_FONT_OSC_HH__
-#include <bse/bsesource.h>
-#include <bse/bsesoundfontpreset.h>
+#include <bse/bsesource.hh>
+#include <bse/bsesoundfontpreset.hh>
#ifdef __cplusplus
extern "C" {
@@ -75,4 +59,4 @@ struct _BseSoundFontOscClass
}
#endif /* __cplusplus */
-#endif /* __BSE_SOUND_FONT_OSC_H__ */
+#endif /* __BSE_SOUND_FONT_OSC_HH__ */
diff --git a/bse/bsesoundfontpreset.c b/bse/bsesoundfontpreset.cc
similarity index 79%
rename from bse/bsesoundfontpreset.c
rename to bse/bsesoundfontpreset.cc
index 9de08b3..307d161 100644
--- a/bse/bsesoundfontpreset.c
+++ b/bse/bsesoundfontpreset.cc
@@ -1,27 +1,11 @@
-/* BSE - Bedevilled Sound Engine
- * Copyright (C) 1997-1999, 2000-2005 Tim Janik
- * Copyright (C) 2009 Stefan Westerfeld
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * A copy of the GNU Lesser General Public License should ship along
- * with this library; if not, see http://www.gnu.org/copyleft/.
- */
-#include "bsesoundfontpreset.h"
-#include "bsemain.h"
-#include "bsestorage.h"
-#include "bseprocedure.h"
-#include "gsldatahandle.h"
-#include "bseserver.h"
-#include "bseloader.h"
+// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+#include "bsesoundfontpreset.hh"
+#include "bsemain.hh"
+#include "bsestorage.hh"
+#include "bseprocedure.hh"
+#include "gsldatahandle.hh"
+#include "bseserver.hh"
+#include "bseloader.hh"
#include <string.h>
#include <fluidsynth.h>
@@ -29,7 +13,7 @@
#define parse_or_return bse_storage_scanner_parse_or_return
/* --- variables --- */
-static GTypeClass *parent_class = NULL;
+static void *parent_class = NULL;
static GQuark quark_program = 0;
static GQuark quark_bank = 0;
@@ -63,7 +47,7 @@ bse_sound_font_preset_store_private (BseObject *object,
bse_storage_printf (storage, "(program %d)", self->program);
}
-static SfiTokenType
+static GTokenType
bse_sound_font_preset_restore_private (BseObject *object,
BseStorage *storage,
GScanner *scanner)
@@ -152,12 +136,12 @@ bse_sound_font_preset_finalize (GObject *object)
}
static void
-bse_sound_font_preset_class_init (BseSoundFontPresetClass *class)
+bse_sound_font_preset_class_init (BseSoundFontPresetClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- BseObjectClass *object_class = BSE_OBJECT_CLASS (class);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (class);
+ parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = bse_sound_font_preset_set_property;
gobject_class->get_property = bse_sound_font_preset_get_property;
diff --git a/bse/bsesoundfontpreset.hh b/bse/bsesoundfontpreset.hh
new file mode 100644
index 0000000..76c60d2
--- /dev/null
+++ b/bse/bsesoundfontpreset.hh
@@ -0,0 +1,38 @@
+// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+#ifndef __BSE_SOUND_FONT_PRESET_HH__
+#define __BSE_SOUND_FONT_PRESET_HH__
+
+#include <bse/bseitem.hh>
+#include <fluidsynth.h>
+
+G_BEGIN_DECLS
+
+/* --- BSE type macros --- */
+#define BSE_TYPE_SOUND_FONT_PRESET (BSE_TYPE_ID (BseSoundFontPreset))
+#define BSE_SOUND_FONT_PRESET(object) (G_TYPE_CHECK_INSTANCE_CAST ((object),
BSE_TYPE_SOUND_FONT_PRESET, BseSoundFontPreset))
+#define BSE_SOUND_FONT_PRESET_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class),
BSE_TYPE_SOUND_FONT_PRESET, BseSoundFontPresetClass))
+#define BSE_IS_SOUND_FONT_PRESET(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object),
BSE_TYPE_SOUND_FONT_PRESET))
+#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;
+ int program;
+ int bank;
+};
+struct _BseSoundFontPresetClass
+{
+ BseItemClass parent_class;
+};
+
+
+/* --- prototypes -- */
+void bse_sound_font_preset_init_preset (BseSoundFontPreset *self,
+ fluid_preset_t *fluid_preset);
+
+G_END_DECLS
+
+#endif /* __BSE_SOUND_FONT_PRESET_HH__ */
diff --git a/bse/bsesoundfontrepo.c b/bse/bsesoundfontrepo.cc
similarity index 87%
rename from bse/bsesoundfontrepo.c
rename to bse/bsesoundfontrepo.cc
index 00c321b..31eb19d 100644
--- a/bse/bsesoundfontrepo.c
+++ b/bse/bsesoundfontrepo.cc
@@ -1,24 +1,8 @@
-/* BSE - Bedevilled Sound Engine
- * Copyright (C) 1996-1999, 2000-2003 Tim Janik
- * Copyright (C) 2009 Stefan Westerfeld
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * A copy of the GNU Lesser General Public License should ship along
- * with this library; if not, see http://www.gnu.org/copyleft/.
- */
-#include "bsesoundfontrepo.h"
-#include "bsesoundfont.h"
-#include "bsesoundfontpreset.h"
-#include "bsedefs.h"
+// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+#include "bsesoundfontrepo.hh"
+#include "bsesoundfont.hh"
+#include "bsesoundfontpreset.hh"
+#include "bsedefs.hh"
#include "bseblockutils.hh"
@@ -30,7 +14,7 @@ enum
/* --- prototypes --- */
-static void bse_sound_font_repo_class_init (BseSoundFontRepoClass *class);
+static void bse_sound_font_repo_class_init (BseSoundFontRepoClass *klass);
static void bse_sound_font_repo_init (BseSoundFontRepo *wrepo);
static void bse_sound_font_repo_dispose (GObject *object);
static void bse_sound_font_repo_release_children (BseContainer *container);
@@ -53,7 +37,7 @@ static void bse_sound_font_repo_prepare (BseSource *source)
/* --- variables --- */
-static GTypeClass *parent_class = NULL;
+static gpointer parent_class = NULL;
/* --- functions --- */
@@ -84,13 +68,13 @@ BSE_BUILTIN_TYPE (BseSoundFontRepo)
}
static void
-bse_sound_font_repo_class_init (BseSoundFontRepoClass *class)
+bse_sound_font_repo_class_init (BseSoundFontRepoClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- BseContainerClass *container_class = BSE_CONTAINER_CLASS (class);
- BseSourceClass *source_class = BSE_SOURCE_CLASS (class);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ BseContainerClass *container_class = BSE_CONTAINER_CLASS (klass);
+ BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
- parent_class = g_type_class_peek_parent (class);
+ parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = bse_sound_font_repo_set_property;
gobject_class->get_property = bse_sound_font_repo_get_property;
@@ -201,7 +185,7 @@ bse_sound_font_repo_release_children (BseContainer *container)
BseSoundFontRepo *sfrepo = BSE_SOUND_FONT_REPO (container);
while (sfrepo->sound_fonts)
- bse_container_remove_item (container, sfrepo->sound_fonts->data);
+ bse_container_remove_item (container, BSE_ITEM (sfrepo->sound_fonts->data));
/* chain parent class' handler */
BSE_CONTAINER_CLASS (parent_class)->release_children (container);
@@ -308,7 +292,7 @@ bse_sound_font_repo_forall_items (BseContainer *container,
{
BseItem *item;
- item = list->data;
+ item = BSE_ITEM (list->data);
list = list->next;
if (!func (item, data))
return;
@@ -332,9 +316,10 @@ bse_sound_font_repo_remove_item (BseContainer *container,
}
static gboolean
-gather_presets (BseItem *item,
- gpointer items)
+gather_presets (BseItem *item,
+ void *pitems)
{
+ BseItemSeq *items = (BseItemSeq *) pitems;
if (BSE_IS_SOUND_FONT (item) || BSE_IS_SOUND_FONT_REPO (item))
bse_container_forall_items (BSE_CONTAINER (item), gather_presets, items);
else if (BSE_IS_SOUND_FONT_PRESET (item))
@@ -379,7 +364,7 @@ bse_sound_font_repo_add_osc (BseSoundFontRepo *sfrepo,
}
sfrepo->oscs = (BseSoundFontOsc **)g_realloc (sfrepo->oscs, sizeof (BseSoundFontOsc *) * (i + 1));
sfrepo->oscs[i] = osc;
- sfrepo->channel_map = g_realloc (sfrepo->channel_map, sizeof (guint) * (i + 1));
+ sfrepo->channel_map = (guint *) g_realloc (sfrepo->channel_map, sizeof (guint) * (i + 1));
return sfrepo->n_oscs++;
}
diff --git a/bse/bsesoundfontrepo.h b/bse/bsesoundfontrepo.hh
similarity index 72%
rename from bse/bsesoundfontrepo.h
rename to bse/bsesoundfontrepo.hh
index 312d624..d0cf44b 100644
--- a/bse/bsesoundfontrepo.h
+++ b/bse/bsesoundfontrepo.hh
@@ -1,27 +1,11 @@
-/* BSE - Bedevilled Sound Engine
- * Copyright (C) 1996-1999, 2000-2003 Tim Janik
- * Copyright (C) 2009 Stefan Westerfeld
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * A copy of the GNU Lesser General Public License should ship along
- * with this library; if not, see http://www.gnu.org/copyleft/.
- */
-#ifndef __BSE_SOUND_FONT_REPO_H__
-#define __BSE_SOUND_FONT_REPO_H__
-
-#include <bse/bsesuper.h>
+// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+#ifndef __BSE_SOUND_FONT_REPO_HH__
+#define __BSE_SOUND_FONT_REPO_HH__
+
+#include <bse/bsesuper.hh>
#include <fluidsynth.h>
-#include <bse/bsesoundfontosc.h>
-#include <bse/bseengine.h>
+#include <bse/bsesoundfontosc.hh>
+#include <bse/bseengine.hh>
G_BEGIN_DECLS
@@ -91,4 +75,4 @@ void bse_sound_font_repo_remove_osc (BseSoundFontRepo *sfrepo,
G_END_DECLS
-#endif /* __BSE_SOUND_FONT_REPO_H__ */
+#endif /* __BSE_SOUND_FONT_REPO_HH__ */
diff --git a/bse/bsesoundfontrepo.proc b/bse/bsesoundfontrepo.proc
index 8281837..aa2ea93 100644
--- a/bse/bsesoundfontrepo.proc
+++ b/bse/bsesoundfontrepo.proc
@@ -14,11 +14,11 @@
* A copy of the GNU Lesser General Public License should ship along
* with this library; if not, see http://www.gnu.org/copyleft/.
*/
-#include <bse/bseplugin.h>
-#include <bse/bseprocedure.h>
-#include <bse/bsesoundfontrepo.h>
-#include <bse/bsesoundfont.h>
-#include <bse/bseloader.h>
+#include <bse/bseplugin.hh>
+#include <bse/bseprocedure.hh>
+#include <bse/bsesoundfontrepo.hh>
+#include <bse/bsesoundfont.hh>
+#include <bse/bseloader.hh>
#include <sys/types.h>
#include <sys/stat.h>
@@ -33,7 +33,7 @@ load_file (BseSoundFontRepo *sfrepo,
BseSoundFont **sound_font_p)
{
gchar *fname = g_path_get_basename (file_name);
- BseSoundFont *sound_font = g_object_new (BSE_TYPE_SOUND_FONT, "uname", fname, NULL);
+ BseSoundFont *sound_font = (BseSoundFont *) g_object_new (BSE_TYPE_SOUND_FONT, "uname", fname, NULL);
g_free (fname);
bse_container_add_item (BSE_CONTAINER (sfrepo), BSE_ITEM (sound_font));
@@ -74,7 +74,7 @@ BODY (BseProcedureClass *proc,
{
/* extract parameter values */
BseSoundFontRepo *self = (BseSoundFontRepo*) bse_value_get_object (in_values++);
- gchar *file_name = sfi_value_get_string (in_values++);
+ const gchar *file_name = sfi_value_get_string (in_values++);
BseUndoStack *ustack;
BseErrorType error;
BseSoundFont *sound_font;
diff --git a/bse/bsestorage.cc b/bse/bsestorage.cc
index e62eb4e..c0c3e23 100644
--- a/bse/bsestorage.cc
+++ b/bse/bsestorage.cc
@@ -1746,7 +1746,7 @@ wstore_blob_reader (gpointer data,
void *buffer,
guint blength)
{
- WStoreBlob *wsb = data;
+ WStoreBlob *wsb = (WStoreBlob *) data;
if (wsb->fd == -1)
{
do
@@ -1771,7 +1771,7 @@ wstore_blob_reader (gpointer data,
static void
wstore_blob_destroy (gpointer data)
{
- WStoreBlob *wblob = data;
+ WStoreBlob *wblob = (WStoreBlob *) data;
if (wblob->fd >= 0)
close (wblob->fd);
bse_storage_blob_unref (wblob->blob);
diff --git a/bse/bsetrack.cc b/bse/bsetrack.cc
index b1fbba9..824b6f1 100644
--- a/bse/bsetrack.cc
+++ b/bse/bsetrack.cc
@@ -15,9 +15,9 @@
#include "bsemidivoice.hh"
#include "bsemidireceiver.hh"
#include "bsewaverepo.hh"
-#include "bsesoundfontrepo.h"
-#include "bsesoundfontpreset.h"
-#include "bsesoundfont.h"
+#include "bsesoundfontrepo.hh"
+#include "bsesoundfontpreset.hh"
+#include "bsesoundfont.hh"
#include "bsecxxplugin.hh"
#include <string.h>
@@ -484,7 +484,7 @@ clear_snet_and_wave_and_sfpreset (BseTrack *self)
bse_object_unproxy_notifies (self->sound_font_preset, self, "changed");
bse_item_cross_unlink (BSE_ITEM (self), BSE_ITEM (self->sound_font_preset),
track_uncross_sound_font_preset);
self->sound_font_preset = NULL;
- g_object_notify (self, "sound_font_preset");
+ g_object_notify ((GObject *) self, "sound_font_preset");
}
if (self->sound_font_net)
{
@@ -552,7 +552,7 @@ bse_track_set_property (GObject *object,
case PROP_SOUND_FONT_PRESET:
if (!self->sub_synth || !BSE_SOURCE_PREPARED (self->sub_synth))
{
- BseSoundFontPreset *sound_font_preset = bse_value_get_object (value);
+ BseSoundFontPreset *sound_font_preset = (BseSoundFontPreset *) bse_value_get_object (value);
if (sound_font_preset || self->sound_font_preset)
{
clear_snet_and_wave_and_sfpreset (self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]