[beast: 7/9] BSE: cleanup IIR filter enumeration
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 7/9] BSE: cleanup IIR filter enumeration
- Date: Wed, 9 Sep 2015 08:14:52 +0000 (UTC)
commit 553409627b11b76c4c89eb33fcc26466bfaa403a
Author: Tim Janik <timj gnu org>
Date: Sun Sep 6 13:05:25 2015 +0200
BSE: cleanup IIR filter enumeration
bse/bseenums.hh | 16 +++++++++-------
bse/bsefilter.hh | 18 +-----------------
plugins/bseiirfilter.cc | 20 ++++++++++----------
plugins/bseiirfilter.hh | 3 ++-
4 files changed, 22 insertions(+), 35 deletions(-)
---
diff --git a/bse/bseenums.hh b/bse/bseenums.hh
index c2be615..e17bc15 100644
--- a/bse/bseenums.hh
+++ b/bse/bseenums.hh
@@ -14,15 +14,17 @@ G_BEGIN_DECLS
typedef enum
{
BSE_IIR_FILTER_BUTTERWORTH = 1,
- BSE_IIR_FILTER_CHEBYCHEFF1,
- BSE_IIR_FILTER_CHEBYCHEFF2
-} BseIIRFilterAlgorithm;
+ BSE_IIR_FILTER_BESSEL = 2,
+ BSE_IIR_FILTER_CHEBYSHEV1 = 3,
+ BSE_IIR_FILTER_CHEBYSHEV2 = 4,
+ BSE_IIR_FILTER_ELLIPTIC = 5,
+} BseIIRFilterKind;
typedef enum
{
- BSE_IIR_FILTER_LOW_PASS = 1,
- BSE_IIR_FILTER_HIGH_PASS,
- BSE_IIR_FILTER_BAND_PASS,
- BSE_IIR_FILTER_BAND_STOP
+ BSE_IIR_FILTER_LOW_PASS = 1,
+ BSE_IIR_FILTER_BAND_PASS = 2,
+ BSE_IIR_FILTER_HIGH_PASS = 3,
+ BSE_IIR_FILTER_BAND_STOP = 4,
} BseIIRFilterType;
typedef enum
{
diff --git a/bse/bsefilter.hh b/bse/bsefilter.hh
index 4e616ad..333d5b5 100644
--- a/bse/bsefilter.hh
+++ b/bse/bsefilter.hh
@@ -2,26 +2,10 @@
#ifndef BSE_FILTER_H__
#define BSE_FILTER_H__
#include <bse/bsemath.hh>
+#include <bse/bseenums.hh>
extern "C" {
-typedef enum /*< skip >*/
-{
- BSE_IIR_FILTER_BUTTERWORTH = 1,
- BSE_IIR_FILTER_BESSEL = 2,
- BSE_IIR_FILTER_CHEBYSHEV1 = 3,
- BSE_IIR_FILTER_CHEBYSHEV2 = 4,
- BSE_IIR_FILTER_ELLIPTIC = 5,
-} BseIIRFilterKind;
-
-typedef enum /*< skip >*/
-{
- BSE_IIR_FILTER_LOW_PASS = 1,
- BSE_IIR_FILTER_BAND_PASS = 2,
- BSE_IIR_FILTER_HIGH_PASS = 3,
- BSE_IIR_FILTER_BAND_STOP = 4,
-} BseIIRFilterType;
-
typedef struct {
BseIIRFilterKind kind;
BseIIRFilterType type;
diff --git a/plugins/bseiirfilter.cc b/plugins/bseiirfilter.cc
index d50203d..d275e39 100644
--- a/plugins/bseiirfilter.cc
+++ b/plugins/bseiirfilter.cc
@@ -71,7 +71,7 @@ bse_iir_filter_class_init (BseIIRFilterClass *klass)
bse_object_class_add_param (object_class, _("Filter Choice"),
PARAM_FILTER_ALGO,
bse_param_spec_genum ("filter_algorithm", _("Filter Algorithm"), _("The filter
design type"),
- BSE_TYPE_IIR_FILTER_ALGORITHM,
+ BSE_TYPE_IIR_FILTER_KIND,
BSE_IIR_FILTER_BUTTERWORTH,
SFI_PARAM_STANDARD));
bse_object_class_add_param (object_class, _("Filter Choice"),
@@ -142,7 +142,7 @@ bse_iir_filter_set_property (GObject *object,
switch (param_id)
{
case PARAM_FILTER_ALGO:
- self->filter_algo = (BseIIRFilterAlgorithm) g_value_get_enum (value);
+ self->filter_algo = (BseIIRFilterKind) g_value_get_enum (value);
self->algo_type_change = TRUE;
bse_iir_filter_update_modules (self);
break;
@@ -301,37 +301,37 @@ bse_iir_filter_update_modules (BseIIRFilter *filt)
case BSE_IIR_FILTER_BUTTERWORTH << 16 | BSE_IIR_FILTER_LOW_PASS:
gsl_filter_butter_lp (filt->order, freq1, filt->epsilon, filt->a, filt->b);
break;
- case BSE_IIR_FILTER_CHEBYCHEFF1 << 16 | BSE_IIR_FILTER_LOW_PASS:
+ case BSE_IIR_FILTER_CHEBYSHEV1 << 16 | BSE_IIR_FILTER_LOW_PASS:
gsl_filter_tscheb1_lp (filt->order, freq1, filt->epsilon, filt->a, filt->b);
break;
- case BSE_IIR_FILTER_CHEBYCHEFF2 << 16 | BSE_IIR_FILTER_LOW_PASS:
+ case BSE_IIR_FILTER_CHEBYSHEV2 << 16 | BSE_IIR_FILTER_LOW_PASS:
gsl_filter_tscheb2_lp (filt->order, freq1, steepness, filt->epsilon, filt->a, filt->b);
break;
case BSE_IIR_FILTER_BUTTERWORTH << 16 | BSE_IIR_FILTER_HIGH_PASS:
gsl_filter_butter_hp (filt->order, freq1, filt->epsilon, filt->a, filt->b);
break;
- case BSE_IIR_FILTER_CHEBYCHEFF1 << 16 | BSE_IIR_FILTER_HIGH_PASS:
+ case BSE_IIR_FILTER_CHEBYSHEV1 << 16 | BSE_IIR_FILTER_HIGH_PASS:
gsl_filter_tscheb1_hp (filt->order, freq1, filt->epsilon, filt->a, filt->b);
break;
- case BSE_IIR_FILTER_CHEBYCHEFF2 << 16 | BSE_IIR_FILTER_HIGH_PASS:
+ case BSE_IIR_FILTER_CHEBYSHEV2 << 16 | BSE_IIR_FILTER_HIGH_PASS:
gsl_filter_tscheb2_hp (filt->order, freq1, steepness, filt->epsilon, filt->a, filt->b);
break;
case BSE_IIR_FILTER_BUTTERWORTH << 16 | BSE_IIR_FILTER_BAND_PASS:
gsl_filter_butter_bp (filt->order & ~1, freq1, freq2, filt->epsilon, filt->a, filt->b);
break;
- case BSE_IIR_FILTER_CHEBYCHEFF1 << 16 | BSE_IIR_FILTER_BAND_PASS:
+ case BSE_IIR_FILTER_CHEBYSHEV1 << 16 | BSE_IIR_FILTER_BAND_PASS:
gsl_filter_tscheb1_bp (filt->order & ~1, freq1, freq2, filt->epsilon, filt->a, filt->b);
break;
- case BSE_IIR_FILTER_CHEBYCHEFF2 << 16 | BSE_IIR_FILTER_BAND_PASS:
+ case BSE_IIR_FILTER_CHEBYSHEV2 << 16 | BSE_IIR_FILTER_BAND_PASS:
gsl_filter_tscheb2_bp (filt->order & ~1, freq1, freq2, steepness, filt->epsilon, filt->a, filt->b);
break;
case BSE_IIR_FILTER_BUTTERWORTH << 16 | BSE_IIR_FILTER_BAND_STOP:
gsl_filter_butter_bs (filt->order & ~1, freq1, freq2, filt->epsilon, filt->a, filt->b);
break;
- case BSE_IIR_FILTER_CHEBYCHEFF1 << 16 | BSE_IIR_FILTER_BAND_STOP:
+ case BSE_IIR_FILTER_CHEBYSHEV1 << 16 | BSE_IIR_FILTER_BAND_STOP:
gsl_filter_tscheb1_bs (filt->order & ~1, freq1, freq2, filt->epsilon, filt->a, filt->b);
break;
- case BSE_IIR_FILTER_CHEBYCHEFF2 << 16 | BSE_IIR_FILTER_BAND_STOP:
+ case BSE_IIR_FILTER_CHEBYSHEV2 << 16 | BSE_IIR_FILTER_BAND_STOP:
gsl_filter_tscheb2_bs (filt->order & ~1, freq1, freq2, steepness, filt->epsilon, filt->a, filt->b);
break;
default:
diff --git a/plugins/bseiirfilter.hh b/plugins/bseiirfilter.hh
index 3796431..8343b15 100644
--- a/plugins/bseiirfilter.hh
+++ b/plugins/bseiirfilter.hh
@@ -2,6 +2,7 @@
#ifndef __BSE_IIR_FILTER_H__
#define __BSE_IIR_FILTER_H__
#include <bse/bsesource.hh>
+#include <bse/bseenums.hh>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -19,7 +20,7 @@ struct BseIIRFilterVars {
gdouble b[BSE_IIR_FILTER_MAX_ORDER];
};
struct BseIIRFilter : BseSource {
- BseIIRFilterAlgorithm filter_algo;
+ BseIIRFilterKind filter_algo;
BseIIRFilterType filter_type;
guint algo_type_change : 1;
guint order;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]