Closed ghanimkhan closed 4 years ago
Here is a pull request for DrumThumper that uses a slider to modify the gain of an audio signal. https://github.com/google/oboe/pull/825
Basically you convert the slider position to a gain value between 0.0 and 1.0. Then pass that value to the C++ code using JNI. Then multiply every sample value by that gain value before it is output.
The multiply could be done in https://github.com/google/oboe/blob/master/samples/LiveEffect/src/main/cpp/FullDuplexPass.h
But unfortunately that code uses a memcpy() to copy the data between input and output. It would be more helpful if it read each sample from the input and then wrote it to the output. I started a new Issue for that: #852
`#ifndef SAMPLES_FULLDUPLEXPASS_H
class FullDuplexPass : public FullDuplexStream { public: virtual oboe::DataCallbackResult onBothStreamsReady(const void inputData, int numInputFrames, void outputData, int numOutputFrames) { size_t bytesPerFrame = this->getOutputStream()->getBytesPerFrame(); size_t bytesToWrite = numInputFrames bytesPerFrame; size_t byteDiff = (numOutputFrames - numInputFrames) bytesPerFrame; size_t bytesToZero = (byteDiff > 0) ? byteDiff : 0; memcpy(outputData, inputData, bytesToWrite); memset((u_char*) outputData + bytesToWrite, 0, bytesToZero); return oboe::DataCallbackResult::Continue; } };
I am not able to figure out which value to increase to get the output
I want to increase volume from seekbar , not from the audio manager , it's like increasing amplitude or a multiplayer ,idont know how to in LiveEffect Sample echo