commit 7496d6818acd7376f9503598fb57a8ba2610dc17
parent 96a2b9f1674b511ed058b4a8628475f4e3701a5f
Author: falkTX <falktx@gmail.com>
Date: Sat, 16 Jan 2016 17:31:18 +0100
Merge branch 'master' of ssh://git.code.sf.net/p/zynaddsubfx/code into dpf-plugin
Diffstat:
4 files changed, 97 insertions(+), 0 deletions(-)
diff --git a/src/Effects/EffectMgr.cpp b/src/Effects/EffectMgr.cpp
@@ -241,6 +241,7 @@ int EffectMgr::geteffect(void)
// Initialize An Effect in RT context
void EffectMgr::init(void)
{
+ kill();
changeeffectrt(nefx, true);
changepresetrt(preset, true);
for(int i=0; i<128; ++i)
diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp
@@ -1030,6 +1030,14 @@ static rtosc::Ports middwareSnoopPorts = {
else
midi.map(addr.c_str(), true);
rEnd},
+ {"unlearn:s", 0, 0,
+ rBegin;
+ string addr = rtosc_argument(msg, 0).s;
+ auto &midi = impl.midi_mapper;
+ auto map = midi.getMidiMappingStrings();
+ midi.unMap(addr.c_str(), false);
+ midi.unMap(addr.c_str(), true);
+ rEnd},
//drop this message into the abyss
{"ui/title:", 0, 0, [](const char *msg, RtData &d) {}}
};
diff --git a/src/Tests/CMakeLists.txt b/src/Tests/CMakeLists.txt
@@ -20,6 +20,7 @@ CXXTEST_ADD_TEST(MqTest MqTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/MqTest.h)
#CXXTEST_ADD_TEST(RtAllocTest RtAllocTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/RtAllocTest.h)
CXXTEST_ADD_TEST(AllocatorTest AllocatorTest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AllocatorTest.h)
+CXXTEST_ADD_TEST(EffectTest EffectTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/EffectTest.h)
CXXTEST_ADD_TEST(KitTest KitTest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/KitTest.h)
CXXTEST_ADD_TEST(MemoryStressTest MemoryStressTest.cpp
@@ -54,6 +55,7 @@ target_link_libraries(UnisonTest ${test_lib})
target_link_libraries(AllocatorTest ${test_lib})
target_link_libraries(KitTest ${test_lib})
target_link_libraries(MemoryStressTest ${test_lib})
+target_link_libraries(EffectTest ${test_lib})
#Testbed app
add_executable(ins-test InstrumentStats.cpp)
diff --git a/src/Tests/EffectTest.h b/src/Tests/EffectTest.h
@@ -0,0 +1,86 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ EffectTest.h - CxxTest for General Effect Stuff
+ Copyright (C) 2015 Mark McCurry
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program 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 General Public License (version 2 or later) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+#include <cxxtest/TestSuite.h>
+#include <cmath>
+#include <cstdio>
+#include "../Misc/Allocator.h"
+#include "../Misc/Stereo.h"
+#include "../Effects/EffectMgr.h"
+#include "../Effects/Reverb.h"
+#include "../Effects/Echo.h"
+#include "../globals.h"
+SYNTH_T *synth;
+
+class EchoTest:public CxxTest::TestSuite
+{
+ public:
+ void setUp() {
+ synth = new SYNTH_T;
+ alloc = new AllocatorClass;
+ mgr = new EffectMgr(*alloc, *synth, true);
+ }
+
+ void tearDown() {
+ delete mgr;
+ delete alloc;
+ delete synth;
+ }
+
+ void testInit() {
+ TS_ASSERT_EQUALS(mgr->nefx, 0);
+ mgr->changeeffect(1);
+ TS_ASSERT_EQUALS(mgr->nefx, 1);
+ TS_ASSERT_EQUALS(mgr->efx, nullptr);
+ mgr->init();
+ TS_ASSERT_DIFFERS(mgr->efx, nullptr);
+ }
+
+ void testClear() {
+ mgr->changeeffect(1);
+ mgr->init();
+ TS_ASSERT_DIFFERS(mgr->efx, nullptr);
+ mgr->changeeffect(0);
+ mgr->init();
+ TS_ASSERT_EQUALS(mgr->efx, nullptr);
+ }
+
+ void testSwap() {
+ //Initially the effect is NULL
+ TS_ASSERT_EQUALS(mgr->efx, nullptr);
+
+ //A Reverb is selected
+ mgr->changeeffect(1);
+ mgr->init();
+ TS_ASSERT_DIFFERS(dynamic_cast<Reverb*>(mgr->efx), nullptr);
+ TS_ASSERT_EQUALS(dynamic_cast<Echo*>(mgr->efx), nullptr);
+
+ //An Echo is selected
+ mgr->changeeffect(2);
+ mgr->init();
+ TS_ASSERT_EQUALS(dynamic_cast<Reverb*>(mgr->efx), nullptr);
+ TS_ASSERT_DIFFERS(dynamic_cast<Echo*>(mgr->efx), nullptr);
+ }
+
+ private:
+ EffectMgr *mgr;
+ Allocator *alloc;
+ SYNTH_T *synth;
+};