summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2013-01-25 22:00:38 +0800
committerrekado <rekado@elephly.net>2013-01-25 22:00:38 +0800
commit07778ea88bbd4f49b97ad491c58b2065e191a9b3 (patch)
tree0cb1688c6872af13347bcde5764fee1c49fefe53
parent3d774a0e75df5b0f256c4480344f989186c4eddf (diff)
define number of samples as NSAMPLES
-rw-r--r--src/mdaPiano.cpp2
-rw-r--r--src/mdaPiano.h6
-rw-r--r--src/mdaPianoCommon.h1
3 files changed, 5 insertions, 4 deletions
diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp
index 6e3d8e7..837626c 100644
--- a/src/mdaPiano.cpp
+++ b/src/mdaPiano.cpp
@@ -32,7 +32,7 @@ mdaPiano::mdaPiano(double rate)
, "4c.raw", "4e.raw", "4a.raw"
};
- for (unsigned char i=0; i<15; ++i) {
+ for (unsigned char i=0; i<NSAMPLES; ++i) {
load_sample(&samples[i], sample_names[i]);
}
diff --git a/src/mdaPiano.h b/src/mdaPiano.h
index 018dadb..f848919 100644
--- a/src/mdaPiano.h
+++ b/src/mdaPiano.h
@@ -13,16 +13,16 @@ class mdaPiano : public LV2::Synth<mdaPianoVoice, mdaPiano> {
public:
mdaPiano(double);
~mdaPiano() {
- for (unsigned char i = 0; i < 15; i++) {
+ for (unsigned char i = 0; i < NSAMPLES; i++) {
free(samples[i].buffer);
}
free(samples);
}
bool sustain;
- KGRP kgrp[16];
+ KGRP kgrp[NSAMPLES];
mdaPianoVoice *voices[NVOICES];
- Sample *samples = (Sample*) malloc (15 * sizeof(Sample));
+ Sample *samples = (Sample*) malloc (NSAMPLES * sizeof(Sample));
void load_kgrp(KGRP*);
void load_sample(Sample*, const char*);
diff --git a/src/mdaPianoCommon.h b/src/mdaPianoCommon.h
index ce41fbd..8168044 100644
--- a/src/mdaPianoCommon.h
+++ b/src/mdaPianoCommon.h
@@ -8,6 +8,7 @@
#define SILENCE 0.0001f //voice choking
#define PARAM_OFFSET 3 //offset for param enum
#define SAMPLES_PER_NOTE 1
+#define NSAMPLES 15
struct KGRP //keygroup
{