Mercurial > hg > piper-cpp
comparison test/vamp-client/tst_PluginStub.cpp @ 202:c9471a9f4b71
Fix typo and use actual data in all process calls.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Thu, 09 Feb 2017 12:06:43 +0000 |
parents | 5f71b038d193 |
children | a69724686f0b |
comparison
equal
deleted
inserted
replaced
201:e07c05ea8952 | 202:c9471a9f4b71 |
---|---|
78 stubParam.description = "Scales the preferred framing sizes"; | 78 stubParam.description = "Scales the preferred framing sizes"; |
79 stubParam.maxValue = 2.0; | 79 stubParam.maxValue = 2.0; |
80 | 80 |
81 PluginStaticData staticData; | 81 PluginStaticData staticData; |
82 staticData.pluginKey = "stub"; | 82 staticData.pluginKey = "stub"; |
83 staticData.basic = {"stub:param-init", "Stub", "Testing init"}; | 83 staticData.basic = {"param-init", "Stub", "Testing init"}; |
84 staticData.maker = "Lucas Thompson"; | 84 staticData.maker = "Lucas Thompson"; |
85 staticData.copyright = "GPL"; | 85 staticData.copyright = "GPL"; |
86 staticData.pluginVersion = 1; | 86 staticData.pluginVersion = 1; |
87 staticData.category = {"Test"}; | 87 staticData.category = {"Test"}; |
88 staticData.minChannelCount = 1; | 88 staticData.minChannelCount = 1; |
108 vampPiperAdapter.getPreferredStepSize(), | 108 vampPiperAdapter.getPreferredStepSize(), |
109 vampPiperAdapter.getPreferredBlockSize() | 109 vampPiperAdapter.getPreferredBlockSize() |
110 ); | 110 ); |
111 }; | 111 }; |
112 | 112 |
113 const AudioBuffer monoAudio { | |
114 std::vector<float>(vampPiperAdapter.getPreferredBlockSize()) | |
115 }; | |
116 const std::vector<const float*> channelPtrs { | |
117 monoAudio[0].data() | |
118 }; | |
119 | |
113 SECTION("Initialises with default parameters") | 120 SECTION("Initialises with default parameters") |
114 { | 121 { |
115 REQUIRE( initWithPreferredFraming() ); | 122 REQUIRE( initWithPreferredFraming() ); |
116 } | 123 } |
117 | 124 |
129 SECTION("Cannot process after a failed init call (due to framing)") | 136 SECTION("Cannot process after a failed init call (due to framing)") |
130 { | 137 { |
131 const float scalingFactor = 2.0; | 138 const float scalingFactor = 2.0; |
132 vampPiperAdapter.setParameter("framing-scale", scalingFactor); | 139 vampPiperAdapter.setParameter("framing-scale", scalingFactor); |
133 REQUIRE( initWithPreferredFraming() == false ); | 140 REQUIRE( initWithPreferredFraming() == false ); |
134 REQUIRE_THROWS( vampPiperAdapter.process(nullptr, {}) ); | 141 REQUIRE_THROWS( vampPiperAdapter.process(channelPtrs.data(), {}) ); |
135 REQUIRE_THROWS( initWithPreferredFraming() ); | 142 REQUIRE_THROWS( initWithPreferredFraming() ); |
136 } | 143 } |
137 | 144 |
138 SECTION("Can process after correctly initialising framing") | 145 SECTION("Can process after correctly initialising framing") |
139 { | 146 { |
140 const float scalingFactor = 2.0; | 147 const float scalingFactor = 2.0; |
141 vampPiperAdapter.setParameter("framing-scale", scalingFactor); | 148 vampPiperAdapter.setParameter("framing-scale", scalingFactor); |
142 REQUIRE( initWithPreferredFraming() == false ); | 149 REQUIRE( initWithPreferredFraming() == false ); |
143 REQUIRE( initWithPreferredFraming() ); | 150 REQUIRE( initWithPreferredFraming() ); |
144 | |
145 const AudioBuffer monoAudio { | |
146 std::vector<float>(vampPiperAdapter.getPreferredBlockSize()) | |
147 }; | |
148 const std::vector<const float*> channelPtrs { | |
149 monoAudio[0].data() | |
150 }; | |
151 REQUIRE( vampPiperAdapter.process(channelPtrs.data(), {}).empty() ); | 151 REQUIRE( vampPiperAdapter.process(channelPtrs.data(), {}).empty() ); |
152 } | 152 } |
153 } | 153 } |