diff --git a/app/src/main/cpp/Instrument.cpp b/app/src/main/cpp/Instrument.cpp
index 985e93e..09d83d5 100644
--- a/app/src/main/cpp/Instrument.cpp
+++ b/app/src/main/cpp/Instrument.cpp
@@ -18,6 +18,12 @@
}
}
+void multiply(float *target, float value, uint32_t size) {
+ for (uint32_t i = 0; i < size; i++) {
+ target[i] *= value;
+ }
+}
+
void add(float *target, float *other, uint32_t size) {
for (uint32_t i = 0; i < size; i++) {
target[i] += other[i];
@@ -30,7 +36,10 @@
multiply(waveform, modulation, count);
lowPass->input = waveform;
float *filtered = lowPass->render(count);
- add(buffer, filtered, count);
+ multiply(filtered, lowPass->influence, count);
+ multiply(waveform, 1 - lowPass->influence, count);
+ add(waveform, filtered, count);
+ add(buffer, waveform, count);
}
void Instrument::startNote(float frequency) {
diff --git a/app/src/main/cpp/Instrument.cpp b/app/src/main/cpp/Instrument.cpp
index 985e93e..09d83d5 100644
--- a/app/src/main/cpp/Instrument.cpp
+++ b/app/src/main/cpp/Instrument.cpp
@@ -18,6 +18,12 @@
}
}
+void multiply(float *target, float value, uint32_t size) {
+ for (uint32_t i = 0; i < size; i++) {
+ target[i] *= value;
+ }
+}
+
void add(float *target, float *other, uint32_t size) {
for (uint32_t i = 0; i < size; i++) {
target[i] += other[i];
@@ -30,7 +36,10 @@
multiply(waveform, modulation, count);
lowPass->input = waveform;
float *filtered = lowPass->render(count);
- add(buffer, filtered, count);
+ multiply(filtered, lowPass->influence, count);
+ multiply(waveform, 1 - lowPass->influence, count);
+ add(waveform, filtered, count);
+ add(buffer, waveform, count);
}
void Instrument::startNote(float frequency) {
diff --git a/app/src/main/cpp/JavaFunctions.cpp b/app/src/main/cpp/JavaFunctions.cpp
index cb732f2..b39abb1 100644
--- a/app/src/main/cpp/JavaFunctions.cpp
+++ b/app/src/main/cpp/JavaFunctions.cpp
@@ -98,6 +98,7 @@
Java_com_lukas_music_instruments_InternalInstrument_applyEffectAttributes(JNIEnv *env, jobject thiz,
jint id,
jint effect_number,
+ jfloat influence,
jfloat parameter1) {
Instrument *instrument = getInstrument(id);
Effect *effect;
@@ -106,6 +107,7 @@
effect = instrument->lowPass;
break;
}
+ effect->influence = influence;
effect->parameter1 = parameter1;
}
}
\ No newline at end of file
diff --git a/app/src/main/cpp/Instrument.cpp b/app/src/main/cpp/Instrument.cpp
index 985e93e..09d83d5 100644
--- a/app/src/main/cpp/Instrument.cpp
+++ b/app/src/main/cpp/Instrument.cpp
@@ -18,6 +18,12 @@
}
}
+void multiply(float *target, float value, uint32_t size) {
+ for (uint32_t i = 0; i < size; i++) {
+ target[i] *= value;
+ }
+}
+
void add(float *target, float *other, uint32_t size) {
for (uint32_t i = 0; i < size; i++) {
target[i] += other[i];
@@ -30,7 +36,10 @@
multiply(waveform, modulation, count);
lowPass->input = waveform;
float *filtered = lowPass->render(count);
- add(buffer, filtered, count);
+ multiply(filtered, lowPass->influence, count);
+ multiply(waveform, 1 - lowPass->influence, count);
+ add(waveform, filtered, count);
+ add(buffer, waveform, count);
}
void Instrument::startNote(float frequency) {
diff --git a/app/src/main/cpp/JavaFunctions.cpp b/app/src/main/cpp/JavaFunctions.cpp
index cb732f2..b39abb1 100644
--- a/app/src/main/cpp/JavaFunctions.cpp
+++ b/app/src/main/cpp/JavaFunctions.cpp
@@ -98,6 +98,7 @@
Java_com_lukas_music_instruments_InternalInstrument_applyEffectAttributes(JNIEnv *env, jobject thiz,
jint id,
jint effect_number,
+ jfloat influence,
jfloat parameter1) {
Instrument *instrument = getInstrument(id);
Effect *effect;
@@ -106,6 +107,7 @@
effect = instrument->lowPass;
break;
}
+ effect->influence = influence;
effect->parameter1 = parameter1;
}
}
\ No newline at end of file
diff --git a/app/src/main/cpp/effects/Effect.h b/app/src/main/cpp/effects/Effect.h
index d4777f9..80ba84c 100644
--- a/app/src/main/cpp/effects/Effect.h
+++ b/app/src/main/cpp/effects/Effect.h
@@ -7,7 +7,7 @@
class Effect : public Processable {
public:
- float parameter1, frequency;
+ float parameter1, frequency, influence;
float *input;
AudioHost *host;
diff --git a/app/src/main/cpp/Instrument.cpp b/app/src/main/cpp/Instrument.cpp
index 985e93e..09d83d5 100644
--- a/app/src/main/cpp/Instrument.cpp
+++ b/app/src/main/cpp/Instrument.cpp
@@ -18,6 +18,12 @@
}
}
+void multiply(float *target, float value, uint32_t size) {
+ for (uint32_t i = 0; i < size; i++) {
+ target[i] *= value;
+ }
+}
+
void add(float *target, float *other, uint32_t size) {
for (uint32_t i = 0; i < size; i++) {
target[i] += other[i];
@@ -30,7 +36,10 @@
multiply(waveform, modulation, count);
lowPass->input = waveform;
float *filtered = lowPass->render(count);
- add(buffer, filtered, count);
+ multiply(filtered, lowPass->influence, count);
+ multiply(waveform, 1 - lowPass->influence, count);
+ add(waveform, filtered, count);
+ add(buffer, waveform, count);
}
void Instrument::startNote(float frequency) {
diff --git a/app/src/main/cpp/JavaFunctions.cpp b/app/src/main/cpp/JavaFunctions.cpp
index cb732f2..b39abb1 100644
--- a/app/src/main/cpp/JavaFunctions.cpp
+++ b/app/src/main/cpp/JavaFunctions.cpp
@@ -98,6 +98,7 @@
Java_com_lukas_music_instruments_InternalInstrument_applyEffectAttributes(JNIEnv *env, jobject thiz,
jint id,
jint effect_number,
+ jfloat influence,
jfloat parameter1) {
Instrument *instrument = getInstrument(id);
Effect *effect;
@@ -106,6 +107,7 @@
effect = instrument->lowPass;
break;
}
+ effect->influence = influence;
effect->parameter1 = parameter1;
}
}
\ No newline at end of file
diff --git a/app/src/main/cpp/effects/Effect.h b/app/src/main/cpp/effects/Effect.h
index d4777f9..80ba84c 100644
--- a/app/src/main/cpp/effects/Effect.h
+++ b/app/src/main/cpp/effects/Effect.h
@@ -7,7 +7,7 @@
class Effect : public Processable {
public:
- float parameter1, frequency;
+ float parameter1, frequency, influence;
float *input;
AudioHost *host;
diff --git a/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt b/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
index c5f565c..6682cfe 100644
--- a/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
+++ b/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
@@ -79,7 +79,12 @@
}
fun applyEffectAttributes(effect: Effect) {
- applyEffectAttributes(id, effect.type.ordinal, effect.parameters[0].value)
+ applyEffectAttributes(
+ id,
+ effect.type.ordinal,
+ effect.influence.value,
+ effect.parameters[0].value
+ )
}
private external fun createInstrument(): Int
@@ -96,5 +101,10 @@
release: Float
)
- private external fun applyEffectAttributes(id: Int, effectNumber: Int, parameter1: Float)
+ private external fun applyEffectAttributes(
+ id: Int,
+ effectNumber: Int,
+ influence: Float,
+ parameter1: Float
+ )
}
\ No newline at end of file
diff --git a/app/src/main/cpp/Instrument.cpp b/app/src/main/cpp/Instrument.cpp
index 985e93e..09d83d5 100644
--- a/app/src/main/cpp/Instrument.cpp
+++ b/app/src/main/cpp/Instrument.cpp
@@ -18,6 +18,12 @@
}
}
+void multiply(float *target, float value, uint32_t size) {
+ for (uint32_t i = 0; i < size; i++) {
+ target[i] *= value;
+ }
+}
+
void add(float *target, float *other, uint32_t size) {
for (uint32_t i = 0; i < size; i++) {
target[i] += other[i];
@@ -30,7 +36,10 @@
multiply(waveform, modulation, count);
lowPass->input = waveform;
float *filtered = lowPass->render(count);
- add(buffer, filtered, count);
+ multiply(filtered, lowPass->influence, count);
+ multiply(waveform, 1 - lowPass->influence, count);
+ add(waveform, filtered, count);
+ add(buffer, waveform, count);
}
void Instrument::startNote(float frequency) {
diff --git a/app/src/main/cpp/JavaFunctions.cpp b/app/src/main/cpp/JavaFunctions.cpp
index cb732f2..b39abb1 100644
--- a/app/src/main/cpp/JavaFunctions.cpp
+++ b/app/src/main/cpp/JavaFunctions.cpp
@@ -98,6 +98,7 @@
Java_com_lukas_music_instruments_InternalInstrument_applyEffectAttributes(JNIEnv *env, jobject thiz,
jint id,
jint effect_number,
+ jfloat influence,
jfloat parameter1) {
Instrument *instrument = getInstrument(id);
Effect *effect;
@@ -106,6 +107,7 @@
effect = instrument->lowPass;
break;
}
+ effect->influence = influence;
effect->parameter1 = parameter1;
}
}
\ No newline at end of file
diff --git a/app/src/main/cpp/effects/Effect.h b/app/src/main/cpp/effects/Effect.h
index d4777f9..80ba84c 100644
--- a/app/src/main/cpp/effects/Effect.h
+++ b/app/src/main/cpp/effects/Effect.h
@@ -7,7 +7,7 @@
class Effect : public Processable {
public:
- float parameter1, frequency;
+ float parameter1, frequency, influence;
float *input;
AudioHost *host;
diff --git a/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt b/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
index c5f565c..6682cfe 100644
--- a/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
+++ b/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
@@ -79,7 +79,12 @@
}
fun applyEffectAttributes(effect: Effect) {
- applyEffectAttributes(id, effect.type.ordinal, effect.parameters[0].value)
+ applyEffectAttributes(
+ id,
+ effect.type.ordinal,
+ effect.influence.value,
+ effect.parameters[0].value
+ )
}
private external fun createInstrument(): Int
@@ -96,5 +101,10 @@
release: Float
)
- private external fun applyEffectAttributes(id: Int, effectNumber: Int, parameter1: Float)
+ private external fun applyEffectAttributes(
+ id: Int,
+ effectNumber: Int,
+ influence: Float,
+ parameter1: Float
+ )
}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt b/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
index ea81afb..dc20f7c 100644
--- a/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
+++ b/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
@@ -16,4 +16,11 @@
val parameters = Array(type.parameterDescriptions.size) {
EffectParameter(type.parameterDescriptions[it], instrument)
}
+ val influence = EffectParameter(influenceDescription, instrument)
+
+ companion object {
+ val influenceDescription = EffectParameterDescription(0.0f, 1.0f, 0.0f) {
+ "influence: ${it.percentageValue}%"
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/cpp/Instrument.cpp b/app/src/main/cpp/Instrument.cpp
index 985e93e..09d83d5 100644
--- a/app/src/main/cpp/Instrument.cpp
+++ b/app/src/main/cpp/Instrument.cpp
@@ -18,6 +18,12 @@
}
}
+void multiply(float *target, float value, uint32_t size) {
+ for (uint32_t i = 0; i < size; i++) {
+ target[i] *= value;
+ }
+}
+
void add(float *target, float *other, uint32_t size) {
for (uint32_t i = 0; i < size; i++) {
target[i] += other[i];
@@ -30,7 +36,10 @@
multiply(waveform, modulation, count);
lowPass->input = waveform;
float *filtered = lowPass->render(count);
- add(buffer, filtered, count);
+ multiply(filtered, lowPass->influence, count);
+ multiply(waveform, 1 - lowPass->influence, count);
+ add(waveform, filtered, count);
+ add(buffer, waveform, count);
}
void Instrument::startNote(float frequency) {
diff --git a/app/src/main/cpp/JavaFunctions.cpp b/app/src/main/cpp/JavaFunctions.cpp
index cb732f2..b39abb1 100644
--- a/app/src/main/cpp/JavaFunctions.cpp
+++ b/app/src/main/cpp/JavaFunctions.cpp
@@ -98,6 +98,7 @@
Java_com_lukas_music_instruments_InternalInstrument_applyEffectAttributes(JNIEnv *env, jobject thiz,
jint id,
jint effect_number,
+ jfloat influence,
jfloat parameter1) {
Instrument *instrument = getInstrument(id);
Effect *effect;
@@ -106,6 +107,7 @@
effect = instrument->lowPass;
break;
}
+ effect->influence = influence;
effect->parameter1 = parameter1;
}
}
\ No newline at end of file
diff --git a/app/src/main/cpp/effects/Effect.h b/app/src/main/cpp/effects/Effect.h
index d4777f9..80ba84c 100644
--- a/app/src/main/cpp/effects/Effect.h
+++ b/app/src/main/cpp/effects/Effect.h
@@ -7,7 +7,7 @@
class Effect : public Processable {
public:
- float parameter1, frequency;
+ float parameter1, frequency, influence;
float *input;
AudioHost *host;
diff --git a/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt b/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
index c5f565c..6682cfe 100644
--- a/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
+++ b/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
@@ -79,7 +79,12 @@
}
fun applyEffectAttributes(effect: Effect) {
- applyEffectAttributes(id, effect.type.ordinal, effect.parameters[0].value)
+ applyEffectAttributes(
+ id,
+ effect.type.ordinal,
+ effect.influence.value,
+ effect.parameters[0].value
+ )
}
private external fun createInstrument(): Int
@@ -96,5 +101,10 @@
release: Float
)
- private external fun applyEffectAttributes(id: Int, effectNumber: Int, parameter1: Float)
+ private external fun applyEffectAttributes(
+ id: Int,
+ effectNumber: Int,
+ influence: Float,
+ parameter1: Float
+ )
}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt b/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
index ea81afb..dc20f7c 100644
--- a/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
+++ b/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
@@ -16,4 +16,11 @@
val parameters = Array(type.parameterDescriptions.size) {
EffectParameter(type.parameterDescriptions[it], instrument)
}
+ val influence = EffectParameter(influenceDescription, instrument)
+
+ companion object {
+ val influenceDescription = EffectParameterDescription(0.0f, 1.0f, 0.0f) {
+ "influence: ${it.percentageValue}%"
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt
index bedabeb..1714b49 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt
@@ -46,7 +46,7 @@
}
})
binding.waveformSelection.smartSetup(Waveform.VALUES, instrument::waveform)
- binding.volumeSeek.setup(0, 100, 30) {
+ binding.volumeSeek.setup(0, 100, (instrument.volume * 100f).toInt()) {
binding.volumeText.text = "volume: $it%"
instrument.volume = it.toFloat() / 100f
}
diff --git a/app/src/main/cpp/Instrument.cpp b/app/src/main/cpp/Instrument.cpp
index 985e93e..09d83d5 100644
--- a/app/src/main/cpp/Instrument.cpp
+++ b/app/src/main/cpp/Instrument.cpp
@@ -18,6 +18,12 @@
}
}
+void multiply(float *target, float value, uint32_t size) {
+ for (uint32_t i = 0; i < size; i++) {
+ target[i] *= value;
+ }
+}
+
void add(float *target, float *other, uint32_t size) {
for (uint32_t i = 0; i < size; i++) {
target[i] += other[i];
@@ -30,7 +36,10 @@
multiply(waveform, modulation, count);
lowPass->input = waveform;
float *filtered = lowPass->render(count);
- add(buffer, filtered, count);
+ multiply(filtered, lowPass->influence, count);
+ multiply(waveform, 1 - lowPass->influence, count);
+ add(waveform, filtered, count);
+ add(buffer, waveform, count);
}
void Instrument::startNote(float frequency) {
diff --git a/app/src/main/cpp/JavaFunctions.cpp b/app/src/main/cpp/JavaFunctions.cpp
index cb732f2..b39abb1 100644
--- a/app/src/main/cpp/JavaFunctions.cpp
+++ b/app/src/main/cpp/JavaFunctions.cpp
@@ -98,6 +98,7 @@
Java_com_lukas_music_instruments_InternalInstrument_applyEffectAttributes(JNIEnv *env, jobject thiz,
jint id,
jint effect_number,
+ jfloat influence,
jfloat parameter1) {
Instrument *instrument = getInstrument(id);
Effect *effect;
@@ -106,6 +107,7 @@
effect = instrument->lowPass;
break;
}
+ effect->influence = influence;
effect->parameter1 = parameter1;
}
}
\ No newline at end of file
diff --git a/app/src/main/cpp/effects/Effect.h b/app/src/main/cpp/effects/Effect.h
index d4777f9..80ba84c 100644
--- a/app/src/main/cpp/effects/Effect.h
+++ b/app/src/main/cpp/effects/Effect.h
@@ -7,7 +7,7 @@
class Effect : public Processable {
public:
- float parameter1, frequency;
+ float parameter1, frequency, influence;
float *input;
AudioHost *host;
diff --git a/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt b/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
index c5f565c..6682cfe 100644
--- a/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
+++ b/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
@@ -79,7 +79,12 @@
}
fun applyEffectAttributes(effect: Effect) {
- applyEffectAttributes(id, effect.type.ordinal, effect.parameters[0].value)
+ applyEffectAttributes(
+ id,
+ effect.type.ordinal,
+ effect.influence.value,
+ effect.parameters[0].value
+ )
}
private external fun createInstrument(): Int
@@ -96,5 +101,10 @@
release: Float
)
- private external fun applyEffectAttributes(id: Int, effectNumber: Int, parameter1: Float)
+ private external fun applyEffectAttributes(
+ id: Int,
+ effectNumber: Int,
+ influence: Float,
+ parameter1: Float
+ )
}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt b/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
index ea81afb..dc20f7c 100644
--- a/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
+++ b/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
@@ -16,4 +16,11 @@
val parameters = Array(type.parameterDescriptions.size) {
EffectParameter(type.parameterDescriptions[it], instrument)
}
+ val influence = EffectParameter(influenceDescription, instrument)
+
+ companion object {
+ val influenceDescription = EffectParameterDescription(0.0f, 1.0f, 0.0f) {
+ "influence: ${it.percentageValue}%"
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt
index bedabeb..1714b49 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt
@@ -46,7 +46,7 @@
}
})
binding.waveformSelection.smartSetup(Waveform.VALUES, instrument::waveform)
- binding.volumeSeek.setup(0, 100, 30) {
+ binding.volumeSeek.setup(0, 100, (instrument.volume * 100f).toInt()) {
binding.volumeText.text = "volume: $it%"
instrument.volume = it.toFloat() / 100f
}
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/EffectFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/EffectFragment.kt
index dc9edfa..1577609 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/EffectFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/EffectFragment.kt
@@ -28,6 +28,9 @@
): View? {
binding = FragmentEffectBinding.inflate(inflater)
binding.effectName.text = effect.type.toString()
+ binding.influenceSeekBar.smartSetup(0, 100, effect.influence::percentageValue) {
+ binding.influenceText.text = effect.influence.description.text(effect.influence)
+ }
binding.parameter1SeekBar.smartSetup(0, 100, effect.parameters[0]::percentageValue) {
binding.parameter1Text.text =
effect.parameters[0].description.text(effect.parameters[0])
diff --git a/app/src/main/cpp/Instrument.cpp b/app/src/main/cpp/Instrument.cpp
index 985e93e..09d83d5 100644
--- a/app/src/main/cpp/Instrument.cpp
+++ b/app/src/main/cpp/Instrument.cpp
@@ -18,6 +18,12 @@
}
}
+void multiply(float *target, float value, uint32_t size) {
+ for (uint32_t i = 0; i < size; i++) {
+ target[i] *= value;
+ }
+}
+
void add(float *target, float *other, uint32_t size) {
for (uint32_t i = 0; i < size; i++) {
target[i] += other[i];
@@ -30,7 +36,10 @@
multiply(waveform, modulation, count);
lowPass->input = waveform;
float *filtered = lowPass->render(count);
- add(buffer, filtered, count);
+ multiply(filtered, lowPass->influence, count);
+ multiply(waveform, 1 - lowPass->influence, count);
+ add(waveform, filtered, count);
+ add(buffer, waveform, count);
}
void Instrument::startNote(float frequency) {
diff --git a/app/src/main/cpp/JavaFunctions.cpp b/app/src/main/cpp/JavaFunctions.cpp
index cb732f2..b39abb1 100644
--- a/app/src/main/cpp/JavaFunctions.cpp
+++ b/app/src/main/cpp/JavaFunctions.cpp
@@ -98,6 +98,7 @@
Java_com_lukas_music_instruments_InternalInstrument_applyEffectAttributes(JNIEnv *env, jobject thiz,
jint id,
jint effect_number,
+ jfloat influence,
jfloat parameter1) {
Instrument *instrument = getInstrument(id);
Effect *effect;
@@ -106,6 +107,7 @@
effect = instrument->lowPass;
break;
}
+ effect->influence = influence;
effect->parameter1 = parameter1;
}
}
\ No newline at end of file
diff --git a/app/src/main/cpp/effects/Effect.h b/app/src/main/cpp/effects/Effect.h
index d4777f9..80ba84c 100644
--- a/app/src/main/cpp/effects/Effect.h
+++ b/app/src/main/cpp/effects/Effect.h
@@ -7,7 +7,7 @@
class Effect : public Processable {
public:
- float parameter1, frequency;
+ float parameter1, frequency, influence;
float *input;
AudioHost *host;
diff --git a/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt b/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
index c5f565c..6682cfe 100644
--- a/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
+++ b/app/src/main/java/com/lukas/music/instruments/InternalInstrument.kt
@@ -79,7 +79,12 @@
}
fun applyEffectAttributes(effect: Effect) {
- applyEffectAttributes(id, effect.type.ordinal, effect.parameters[0].value)
+ applyEffectAttributes(
+ id,
+ effect.type.ordinal,
+ effect.influence.value,
+ effect.parameters[0].value
+ )
}
private external fun createInstrument(): Int
@@ -96,5 +101,10 @@
release: Float
)
- private external fun applyEffectAttributes(id: Int, effectNumber: Int, parameter1: Float)
+ private external fun applyEffectAttributes(
+ id: Int,
+ effectNumber: Int,
+ influence: Float,
+ parameter1: Float
+ )
}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt b/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
index ea81afb..dc20f7c 100644
--- a/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
+++ b/app/src/main/java/com/lukas/music/instruments/effect/Effect.kt
@@ -16,4 +16,11 @@
val parameters = Array(type.parameterDescriptions.size) {
EffectParameter(type.parameterDescriptions[it], instrument)
}
+ val influence = EffectParameter(influenceDescription, instrument)
+
+ companion object {
+ val influenceDescription = EffectParameterDescription(0.0f, 1.0f, 0.0f) {
+ "influence: ${it.percentageValue}%"
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt
index bedabeb..1714b49 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/EditInstrumentFragment.kt
@@ -46,7 +46,7 @@
}
})
binding.waveformSelection.smartSetup(Waveform.VALUES, instrument::waveform)
- binding.volumeSeek.setup(0, 100, 30) {
+ binding.volumeSeek.setup(0, 100, (instrument.volume * 100f).toInt()) {
binding.volumeText.text = "volume: $it%"
instrument.volume = it.toFloat() / 100f
}
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/EffectFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/EffectFragment.kt
index dc9edfa..1577609 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/EffectFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/EffectFragment.kt
@@ -28,6 +28,9 @@
): View? {
binding = FragmentEffectBinding.inflate(inflater)
binding.effectName.text = effect.type.toString()
+ binding.influenceSeekBar.smartSetup(0, 100, effect.influence::percentageValue) {
+ binding.influenceText.text = effect.influence.description.text(effect.influence)
+ }
binding.parameter1SeekBar.smartSetup(0, 100, effect.parameters[0]::percentageValue) {
binding.parameter1Text.text =
effect.parameters[0].description.text(effect.parameters[0])
diff --git a/app/src/main/res/layout/fragment_effect.xml b/app/src/main/res/layout/fragment_effect.xml
index 7e88115..d5e0681 100644
--- a/app/src/main/res/layout/fragment_effect.xml
+++ b/app/src/main/res/layout/fragment_effect.xml
@@ -31,6 +31,27 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+
+
+
+
+ app:layout_constraintEnd_toEndOf="@+id/influenceSeekBar"
+ app:layout_constraintStart_toStartOf="@+id/influenceSeekBar"
+ app:layout_constraintTop_toBottomOf="@+id/influenceSeekBar" />
+ app:layout_constraintTop_toTopOf="@+id/parameter1SeekBar"
+ app:layout_constraintVertical_bias="0.0" />