summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drumgizmo/drumgizmoc.cc2
-rw-r--r--lv2/lv2.cc2
-rw-r--r--lv2/output_lv2.cc9
-rw-r--r--lv2/output_lv2.h4
-rw-r--r--src/audiooutputengine.h5
-rw-r--r--src/drumgizmo.cc11
6 files changed, 12 insertions, 21 deletions
diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc
index c96736f..d5fa817 100644
--- a/drumgizmo/drumgizmoc.cc
+++ b/drumgizmo/drumgizmoc.cc
@@ -248,6 +248,8 @@ int main(int argc, char *argv[])
return 1;
}
+ gizmo.setSamplerate(oe->samplerate());
+
if(!gizmo.init(preload)) {
printf("Failed init engine.\n");
return 1;
diff --git a/lv2/lv2.cc b/lv2/lv2.cc
index 9ec7706..3aeb5f0 100644
--- a/lv2/lv2.cc
+++ b/lv2/lv2.cc
@@ -248,7 +248,7 @@ LV2_Handle instantiate(const struct _LV2_Descriptor *descriptor,
dg_descriptor.get_pci = dg_get_pci;
dglv2->in = new InputLV2();
- dglv2->out = new OutputLV2(sample_rate);
+ dglv2->out = new OutputLV2();
dglv2->buffer = NULL;
dglv2->buffer_size = 0;
diff --git a/lv2/output_lv2.cc b/lv2/output_lv2.cc
index b4a6877..ef2500b 100644
--- a/lv2/output_lv2.cc
+++ b/lv2/output_lv2.cc
@@ -28,9 +28,8 @@
#include <string.h>
-OutputLV2::OutputLV2(double sample_rate)
+OutputLV2::OutputLV2()
{
- this->sample_rate = sample_rate;
for(size_t i = 0; i < NUM_OUTPUTS; i++) {
outputPorts[i].size = 0;
outputPorts[i].samples = NULL;
@@ -83,9 +82,3 @@ sample_t *OutputLV2::getBuffer(int ch)
if(ch < NUM_OUTPUTS) return outputPorts[ch].samples;
return NULL;
}
-
-size_t OutputLV2::samplerate()
-{
- return sample_rate;
-}
-
diff --git a/lv2/output_lv2.h b/lv2/output_lv2.h
index 272a78c..c23cf2f 100644
--- a/lv2/output_lv2.h
+++ b/lv2/output_lv2.h
@@ -39,7 +39,7 @@ public:
class OutputLV2 : public AudioOutputEngine {
public:
- OutputLV2(double sample_rate);
+ OutputLV2();
~OutputLV2();
bool init(Channels channels);
@@ -59,8 +59,6 @@ public:
// sample_t *outputPort[NUM_OUTPUTS];
OutputPort outputPorts[NUM_OUTPUTS];
-
- double sample_rate;
};
#endif/*__DRUMGIZMO_OUTPUT_LV2_H__*/
diff --git a/src/audiooutputengine.h b/src/audiooutputengine.h
index 25b6ea0..eafafe9 100644
--- a/src/audiooutputengine.h
+++ b/src/audiooutputengine.h
@@ -57,11 +57,6 @@ public:
* Overload this method to force engine to use different buffer size.
*/
virtual size_t getBufferSize() { return 1024; }
-
- /**
- * Overload this method to report output engine samplerate.
- */
- virtual size_t samplerate() { return UNKNOWN_SAMPLERATE; }
};
#endif/*__DRUMGIZMO_AUDIOOUTPUTENGINE_H__*/
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index 9252afc..60ced09 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -74,14 +74,11 @@ bool DrumGizmo::loadkit(std::string file)
loader.loadKit(&kit);
#ifdef WITH_RESAMPLER
- unsigned int output_fs = kit.samplerate();
- if(oe->samplerate() != UNKNOWN_SAMPLERATE) output_fs = oe->samplerate();
for(int i = 0; i < MAX_NUM_CHANNELS; i++) {
- resampler[i].setup(kit.samplerate(), output_fs);
+ resampler[i].setup(kit.samplerate(), Conf::samplerate);
}
#endif/*WITH_RESAMPLER*/
-
DEBUG(loadkit, "loadkit: Success\n");
return true;
@@ -443,6 +440,12 @@ int DrumGizmo::samplerate()
void DrumGizmo::setSamplerate(int samplerate)
{
Conf::samplerate = samplerate;
+#ifdef WITH_RESAMPLER
+ for(int i = 0; i < MAX_NUM_CHANNELS; i++) {
+ resampler[i].setup(kit.samplerate(), Conf::samplerate);
+ }
+#endif/*WITH_RESAMPLER*/
+
}
std::string float2str(float a)