Skip to content

Commit

Permalink
Fix right margin on spectrogram
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Willis committed Nov 11, 2018
1 parent f0525d6 commit 00a9f8e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/dragonfly-reverb/DragonflyReverbPlugin.hpp
Expand Up @@ -40,7 +40,7 @@ class DragonflyReverbPlugin : public Plugin

const char* getDescription() const override
{
return "A hall-style reverb based on freeverb3 algorithms";
return "A hall-style reverb";
}

const char* getMaker() const noexcept override
Expand Down
2 changes: 1 addition & 1 deletion plugins/dragonfly-reverb/DragonflyReverbUI.cpp
Expand Up @@ -108,7 +108,7 @@ DragonflyReverbUI::DragonflyReverbUI()
rectSliders[2].setSize ( 26,200 );

rectDisplay.setPos ( 245, 140 );
rectDisplay.setSize ( 365, 180 );
rectDisplay.setSize ( 350, 180 );

for ( int i = 0; i < NUM_BANKS; ++i)
{
Expand Down
15 changes: 14 additions & 1 deletion plugins/dragonfly-reverb/Spectrogram.cpp
Expand Up @@ -79,6 +79,7 @@ Spectrogram::Spectrogram(Widget * widget, NanoVG * fNanoText, DGL::Rectangle<int

x = 0;
sample_offset_processed = 0;
std::cout << "Spectrogram CTOR done!\n";
}

Spectrogram::~Spectrogram() {
Expand All @@ -101,9 +102,13 @@ Spectrogram::~Spectrogram() {

void Spectrogram::uiIdle() {
// twenty millisecond budget to render a chunk of the spectrogram

int64_t limit = (duration_cast< milliseconds >(system_clock::now().time_since_epoch())).count() + 20;

std::cout << "Spectrogram uiIdle! limit: " << limit << "\n";

while(x < image->getWidth() && (duration_cast< milliseconds >(system_clock::now().time_since_epoch())).count() < limit) {
std::cout << "Rendering X = " << x << "\n";
// Calculate time in seconds, then determine where that is in the dsp_output buffer
float time = pow(M_E, (float) x * logf ( (float)SPECTROGRAM_MAX_SECONDS / SPECTROGRAM_MIN_SECONDS ) / image->getWidth()) * SPECTROGRAM_MIN_SECONDS;
uint32_t sample_offset = (time * (float) SPECTROGRAM_SAMPLE_RATE);
Expand All @@ -127,6 +132,14 @@ void Spectrogram::uiIdle() {
fft_imag[window_sample] = 0.0;
}

std::cout << "fft_real numbers: " << fft_real[0] << ", " << fft_real[10] << ", "
<< fft_real[100] << ", " << fft_real[101] << ", " << fft_real[102] << ", "
<< fft_real[103] << ", " << fft_real[104] << ", " << fft_real[105] << ", "
<< fft_real[106] << ", " << fft_real[107] << ", " << fft_real[108] << ", "
<< fft_real[109] << ", " << fft_real[110] << ", " << fft_real[111] << ", "
<< fft_real[1000] << ", " << fft_real[1001] << ", " << fft_real[1002] << ", "
<< fft_real[1003] << ", " << fft_real[1004] << ", " << fft_real[1005] << "\n";

Fft_transform(fft_real, fft_imag, (size_t) SPECTROGRAM_WINDOW_SIZE);

for (uint32_t y = 0; y < image->getHeight(); y++) {
Expand Down Expand Up @@ -182,7 +195,7 @@ void Spectrogram::setParameterValue(uint32_t i, float v) {
if (i == paramDry_level) {
v = 0.0f;
}

std::cout << "Setting parameter value of spectrogram DSP! " << i << ", " << v << "\n";
dsp.setParameterValue(i, v);
dsp.mute();
x = 0;
Expand Down

0 comments on commit 00a9f8e

Please sign in to comment.