diff options
| -rw-r--r-- | configure.ac | 8 | ||||
| -rw-r--r-- | drumgizmo/output/oss.cc | 3 | ||||
| -rw-r--r-- | plugin/drumgizmo_plugin.cc | 6 | ||||
| -rw-r--r-- | src/drumgizmo.cc | 2 | ||||
| -rw-r--r-- | src/drumgizmo.h | 9 | ||||
| -rw-r--r-- | test/lv2.cc | 6 | 
6 files changed, 24 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac index ff226d0..5d8652a 100644 --- a/configure.ac +++ b/configure.ac @@ -203,6 +203,14 @@ AM_CONDITIONAL([ENABLE_PUGL_X11], [test "x$enable_gui" = "xpugl-x11"])  AM_CONDITIONAL([ENABLE_PUGL_WIN32], [test "x$enable_gui" = "xpugl-win32"])  AM_CONDITIONAL([ENABLE_PUGL_COCOA], [test "x$enable_gui" = "xpugl-cocoa"]) +dnl =========================== +dnl Custom number of outputs? +dnl =========================== +AC_ARG_ENABLE([custom-channel-count], +	AS_HELP_STRING([--enable-custom-channel-count[=count]], [Compile with specified number of output channels [default=16]]),, +        [enable_custom_channel_count="16"]) +AC_DEFINE_UNQUOTED([NUM_CHANNELS], [$enable_custom_channel_count], [Number of output channels]) +  dnl ======================  dnl Compile unit tests  dnl ====================== diff --git a/drumgizmo/output/oss.cc b/drumgizmo/output/oss.cc index 80d8d2b..cb0b896 100644 --- a/drumgizmo/output/oss.cc +++ b/drumgizmo/output/oss.cc @@ -31,10 +31,11 @@  #include <unistd.h>  #include <iostream> +#include <config.h>  OSSOutputEngine::OSSOutputEngine()  	: dev{"/dev/dsp"} -	, num_channels{16} +	, num_channels{NUM_CHANNELS}  	, srate{44100}  	, format{AFMT_S32_NE}  	, data{} diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc index 1d03fd2..e7bc29e 100644 --- a/plugin/drumgizmo_plugin.cc +++ b/plugin/drumgizmo_plugin.cc @@ -26,6 +26,8 @@   */  #include "drumgizmo_plugin.h" +#include <config.h> +  #include <cstring>  #include <algorithm>  #include <string> @@ -110,7 +112,7 @@ size_t DrumGizmoPlugin::getNumberOfAudioInputs()  size_t DrumGizmoPlugin::getNumberOfAudioOutputs()  { -	return 16; +	return NUM_CHANNELS;  }  std::string DrumGizmoPlugin::getId() @@ -148,7 +150,7 @@ PluginCategory DrumGizmoPlugin::getPluginCategory()  	return PluginCategory::Synth;  } -static float g_samples[16*  4096]; +static float g_samples[NUM_CHANNELS *  4096];  void DrumGizmoPlugin::process(size_t pos,                                const std::vector<MidiEvent>& input_events, diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index 1e1974f..dcbb7bd 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -446,7 +446,7 @@ void DrumGizmo::setSamplerate(float samplerate)  		buf.reset(new sample_t[MAX_RESAMPLER_BUFFER_SIZE]);  	} -	for(int c = 0; c < MAX_NUM_CHANNELS; ++c) +	for(int c = 0; c < NUM_CHANNELS; ++c)  	{  		zita[c].reset();  		auto nchan = 1u; // mono diff --git a/src/drumgizmo.h b/src/drumgizmo.h index 4592143..9d2e661 100644 --- a/src/drumgizmo.h +++ b/src/drumgizmo.h @@ -26,6 +26,8 @@   */  #pragma once +#include <config.h> +  #include <string>  #include <list>  #include <array> @@ -74,7 +76,6 @@ public:  	void setRandomSeed(unsigned int seed);  private: -	static constexpr int MAX_NUM_CHANNELS = 64;  	static constexpr int MAX_RESAMPLER_BUFFER_SIZE = 4096 * 8;  protected: @@ -83,7 +84,7 @@ protected:  	AudioOutputEngine& oe;  	AudioInputEngine& ie; -	std::list< Event* > activeevents[MAX_NUM_CHANNELS]; +	std::list< Event* > activeevents[NUM_CHANNELS];  	bool enable_resampling{true}; @@ -101,8 +102,8 @@ protected:  	SettingsGetter settings_getter;  	Random rand; -	std::array<Resampler, MAX_NUM_CHANNELS> zita; -	std::array<std::unique_ptr<sample_t>, MAX_NUM_CHANNELS> resampler_input_buffer; +	std::array<Resampler, NUM_CHANNELS> zita; +	std::array<std::unique_ptr<sample_t>, NUM_CHANNELS> resampler_input_buffer;  	double ratio = 1.0;  }; diff --git a/test/lv2.cc b/test/lv2.cc index 0f80dea..0c86ad2 100644 --- a/test/lv2.cc +++ b/test/lv2.cc @@ -26,6 +26,8 @@   */  #include "dgunit.h" +#include <config.h> +  #include <thread>  #include <chrono>  #include <memory.h> @@ -379,7 +381,7 @@ public:  		// Port buffers:  		char sequence_buffer[4096]; -		float pcm_buffer[16][10]; +		float pcm_buffer[NUM_CHANNELS][10];  		bool freeWheel = true;  		// Free wheel port @@ -389,7 +391,7 @@ public:  		res = h.connectPort((int)Ports::MidiPort, seq.data());  		DGUNIT_ASSERT_EQUAL(0, res); -		for(int i = 0; i < 16; ++i) +		for(int i = 0; i < NUM_CHANNELS; ++i)  		{  			for(int j = 0; j < 10; ++j)  			{  | 
