kopia lustrzana https://github.com/jameshball/osci-render
VolumeComponent now visualises the correct audio
rodzic
c31f15afb4
commit
1687a330d8
|
@ -54,13 +54,16 @@ void SosciAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::M
|
|||
}
|
||||
|
||||
// this is the point that the visualiser will draw
|
||||
threadManager.write(point);
|
||||
threadManager.write(point, "VisualiserComponent");
|
||||
|
||||
point.scale(volume, volume, volume);
|
||||
point.scale(volume, volume, 1.0);
|
||||
|
||||
// clip
|
||||
point.x = juce::jmax(-threshold, juce::jmin(threshold.load(), point.x));
|
||||
point.y = juce::jmax(-threshold, juce::jmin(threshold.load(), point.y));
|
||||
|
||||
// this is the point that the volume component will draw (i.e. post scale/clipping)
|
||||
threadManager.write(point, "VolumeComponent");
|
||||
|
||||
if (output.getNumChannels() > 0) {
|
||||
outputArray[0][sample] = point.x;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "BufferConsumer.h"
|
||||
|
||||
class AudioBackgroundThreadManager;
|
||||
class AudioBackgroundThread : private juce::Thread {
|
||||
class AudioBackgroundThread : public juce::Thread {
|
||||
public:
|
||||
AudioBackgroundThread(const juce::String& name, AudioBackgroundThreadManager& manager);
|
||||
~AudioBackgroundThread() override;
|
||||
|
|
|
@ -22,6 +22,15 @@ void AudioBackgroundThreadManager::write(const OsciPoint& point) {
|
|||
}
|
||||
}
|
||||
|
||||
void AudioBackgroundThreadManager::write(const OsciPoint& point, juce::String name) {
|
||||
juce::SpinLock::ScopedLockType scope(lock);
|
||||
for (auto& thread : threads) {
|
||||
if (thread->getThreadName() == name) {
|
||||
thread->write(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AudioBackgroundThreadManager::prepare(double sampleRate, int samplesPerBlock) {
|
||||
juce::SpinLock::ScopedLockType scope(lock);
|
||||
for (auto& thread : threads) {
|
||||
|
|
|
@ -13,6 +13,7 @@ public:
|
|||
void registerThread(AudioBackgroundThread* thread);
|
||||
void unregisterThread(AudioBackgroundThread* thread);
|
||||
void write(const OsciPoint& point);
|
||||
void write(const OsciPoint& point, juce::String name);
|
||||
void prepare(double sampleRate, int samplesPerBlock);
|
||||
|
||||
double sampleRate = 44100.0;
|
||||
|
|
Ładowanie…
Reference in New Issue