[beast: 8/14] TOOLS: use Bse diagnostics and BSE_CONVENIENCE
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 8/14] TOOLS: use Bse diagnostics and BSE_CONVENIENCE
- Date: Thu, 23 Mar 2017 17:14:01 +0000 (UTC)
commit 4a8c61695bf48674a474cdfc76bda6d383b2f5ca
Author: Tim Janik <timj gnu org>
Date: Tue Mar 14 00:46:53 2017 +0100
TOOLS: use Bse diagnostics and BSE_CONVENIENCE
Signed-off-by: Tim Janik <timj gnu org>
tools/Makefile.am | 2 +-
tools/bsefcompare.cc | 2 +
tools/bsefextract.cc | 50 +++++++++++++++++++++++++-----------------------
tools/bseloopfuncs.cc | 2 +
tools/bsewavetool.cc | 2 +-
tools/cutvorbis.cc | 2 +
tools/magictest.cc | 2 +
7 files changed, 36 insertions(+), 26 deletions(-)
---
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 9375d6c..84c22c9 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -5,7 +5,7 @@ SUBDIRS = . scripts
AM_CPPFLAGS += -I$(top_srcdir) -I$(top_builddir)
DEFS += @DEFINE__FILE_DIR__@ -DG_LOG_DOMAIN=\"BSE-TOOLS\" -DG_DISABLE_CONST_RETURNS
-AM_CXXFLAGS += $(BSE_CFLAGS) $(RAPICORN_CFLAGS) -DRAPICORN_CONVENIENCE
+AM_CXXFLAGS += $(BSE_CFLAGS) $(RAPICORN_CFLAGS) -DBSE_CONVENIENCE
noinst_PROGRAMS = $(ALLTESTS)
progs_ldadd = ../bse/libbse-@MAJOR@.la $(LIBBSE_LIBS)
diff --git a/tools/bsefcompare.cc b/tools/bsefcompare.cc
index edb23c0..cfa027b 100644
--- a/tools/bsefcompare.cc
+++ b/tools/bsefcompare.cc
@@ -18,6 +18,8 @@
#include <utility>
#include <algorithm>
+using namespace Bse;
+
using namespace std;
struct Options {
diff --git a/tools/bsefextract.cc b/tools/bsefextract.cc
index 2251d49..1fcf3b7 100644
--- a/tools/bsefextract.cc
+++ b/tools/bsefextract.cc
@@ -18,6 +18,8 @@
#include <list>
#include <complex>
+using namespace Bse;
+
// using namespace std;
using std::string;
using std::map;
@@ -49,7 +51,7 @@ struct Options {
void validate_int (const string& option, int value, int vmin, int vmax);
} options;
-class Signal
+class AudioSignal
{
vector<float> m_samples;
GslDataHandle *m_data_handle;
@@ -89,7 +91,7 @@ class Signal
}
public:
- Signal (GslDataHandle *data_handle) :
+ AudioSignal (GslDataHandle *data_handle) :
m_data_handle (data_handle)
{
m_n_channels = gsl_data_handle_n_channels (data_handle);
@@ -249,7 +251,7 @@ struct Feature
{
}
- virtual void compute (const Signal &signal) = 0;
+ virtual void compute (const AudioSignal &signal) = 0;
virtual void print_results() const = 0;
virtual ~Feature()
{
@@ -265,7 +267,7 @@ struct StartTimeFeature : public Feature
start_time = -1;
}
void
- compute (const Signal &signal)
+ compute (const AudioSignal &signal)
{
for (GslLong l = options.channel; l < signal.length(); l += signal.n_channels())
{
@@ -290,7 +292,7 @@ struct EndTimeFeature : public Feature
{
end_time = -1;
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
for (GslLong l = options.channel; l < signal.length(); l += signal.n_channels())
{
@@ -407,7 +409,7 @@ struct SpectrumFeature : public Feature
}
void
- compute (const Signal &signal)
+ compute (const AudioSignal &signal)
{
if (spectrum.size()) /* don't compute the same feature twice */
return;
@@ -483,7 +485,7 @@ struct AvgSpectrumFeature : public Feature
{
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
/*
* dependancy: we need the spectrum to compute the average spectrum
@@ -512,7 +514,7 @@ struct AvgEnergyFeature : public Feature
avg_energy = 0;
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
GslLong avg_energy_count = 0;
for (GslLong l = options.channel; l < signal.length(); l += signal.n_channels())
@@ -547,7 +549,7 @@ struct MinMaxPeakFeature : public Feature
max_peak = 0;
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
for (GslLong l = options.channel; l < signal.length(); l += signal.n_channels())
{
@@ -573,7 +575,7 @@ struct DCOffsetFeature : public Feature
dc_offset = 0;
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
double dc_offset_div = 0.0;
@@ -601,7 +603,7 @@ struct RawSignalFeature : public Feature
{
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
for (GslLong l = options.channel; l < signal.length(); l += signal.n_channels())
raw_signal.push_back (signal[l]);
@@ -681,7 +683,7 @@ struct ComplexSignalFeature : public Feature
}
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
if (complex_signal.size()) /* already finished? */
return;
@@ -743,7 +745,7 @@ struct BaseFreqFeature : public Feature
}
void
- compute (const Signal &signal)
+ compute (const AudioSignal &signal)
{
if (freq.size()) /* already finished? */
return;
@@ -843,7 +845,7 @@ struct BaseFreqFeature : public Feature
}
void
- compute_smear_and_wobble (const Signal &signal)
+ compute_smear_and_wobble (const AudioSignal &signal)
{
const int window_size = int (signal.mix_freq() / base_freq + 0.5);
const int window_step = max (window_size / 3, 30);
@@ -906,7 +908,7 @@ struct BaseFreqSmear : public Feature
{
}
- void compute (const Signal& signal)
+ void compute (const AudioSignal& signal)
{
/*
* dependancy: we need the base frequency feature to compute the base frequency smear
@@ -930,7 +932,7 @@ struct BaseFreqWobble : public Feature
{
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
/*
* dependancy: we need the base frequency feature to compute the base frequency smear
@@ -962,7 +964,7 @@ struct VolumeFeature : public Feature
volume_wobble = 0;
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
if (vol.size()) /* already finished? */
return;
@@ -989,7 +991,7 @@ struct VolumeFeature : public Feature
compute_smear_and_wobble (signal);
}
- void compute_smear_and_wobble (const Signal &signal)
+ void compute_smear_and_wobble (const AudioSignal &signal)
{
const double window_size_ms = 30; /* window size in milliseconds */
const int window_size = int (signal.mix_freq() * window_size_ms / 1000.0 + 0.5);
@@ -1048,7 +1050,7 @@ struct VolumeSmear : public Feature
{
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
// dependancy: we need the volume feature to compute the volume smear
volume_feature->compute (signal);
@@ -1071,7 +1073,7 @@ struct VolumeWobble : public Feature
{
}
- void compute (const Signal &signal)
+ void compute (const AudioSignal &signal)
{
// dependancy: we need the volume feature to compute the volume wobble
volume_feature->compute (signal);
@@ -1119,7 +1121,7 @@ struct TimingSlices
}
void
- compute (const Signal& signal)
+ compute (const AudioSignal& signal)
{
if (slices.size()) /* don't compute the same feature twice */
return;
@@ -1205,7 +1207,7 @@ struct AttackTimes : public Feature
}
void
- compute (const Signal &signal)
+ compute (const AudioSignal &signal)
{
timing_slices->compute (signal);
@@ -1234,7 +1236,7 @@ struct ReleaseTimes : public Feature
}
void
- compute (const Signal &signal)
+ compute (const AudioSignal &signal)
{
timing_slices->compute (signal);
@@ -1563,7 +1565,7 @@ main (int argc,
}
/* extract features */
- Signal signal (dhandle);
+ AudioSignal signal (dhandle);
if (options.channel >= signal.n_channels())
{
diff --git a/tools/bseloopfuncs.cc b/tools/bseloopfuncs.cc
index 3a24a4d..280824d 100644
--- a/tools/bseloopfuncs.cc
+++ b/tools/bseloopfuncs.cc
@@ -6,6 +6,8 @@
#include <stdio.h>
#include <math.h>
+using namespace Bse;
+
typedef struct {
gdouble score;
GslLong loop_start;
diff --git a/tools/bsewavetool.cc b/tools/bsewavetool.cc
index 66aef6c..63c229b 100644
--- a/tools/bsewavetool.cc
+++ b/tools/bsewavetool.cc
@@ -198,7 +198,7 @@ main (int argc,
static void
wavetool_print_version (void)
{
- printout ("bsewavetool version %s\n", Internal::buildid());
+ printout ("bsewavetool version %s\n", ::Internal::buildid());
printout ("Refer to beast --version for more version information.\n");
printout ("bsewavetool comes with ABSOLUTELY NO WARRANTY.\n");
printout ("You may redistribute copies of bsewavetool under the terms\n");
diff --git a/tools/cutvorbis.cc b/tools/cutvorbis.cc
index 691d876..ded9da3 100644
--- a/tools/cutvorbis.cc
+++ b/tools/cutvorbis.cc
@@ -9,6 +9,8 @@
#include <string.h>
#include <errno.h>
+using namespace Bse;
+
static GslVorbisCutterMode cutmode = GSL_VORBIS_CUTTER_NONE;
static SfiNum cutpoint = 0;
static guint filtered_serialno = 0;
diff --git a/tools/magictest.cc b/tools/magictest.cc
index b4b1000..3da09a2 100644
--- a/tools/magictest.cc
+++ b/tools/magictest.cc
@@ -7,6 +7,8 @@
#include <stdio.h>
#include <string.h>
+using namespace Bse;
+
static gint
help (gchar *arg)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]