Skip to content

Commit

Permalink
synth_core: Envelope fix, some minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
rygorous committed Nov 26, 2012
1 parent 78c0ed0 commit ce87ef3
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
7 changes: 7 additions & 0 deletions v2/scope.cpp
Expand Up @@ -6,6 +6,8 @@
#include <gl/GL.h>
#include <vector>

#pragma comment(lib, "opengl32.lib")

static const int MAXSCOPES = 16;

namespace
Expand Down Expand Up @@ -237,6 +239,11 @@ void scopeClose(const void *unique_id)
}
}

bool scopeIsOpen(const void *unique_id)
{
return get_scope(unique_id) != 0;
}

void scopeSubmit(const void *unique_id, const float *data, int nsamples)
{
if (Scope *s = get_scope(unique_id))
Expand Down
1 change: 1 addition & 0 deletions v2/scope.h
Expand Up @@ -3,6 +3,7 @@

extern void scopeOpen(const void *unique_id, const char *title, int nsamples, int w, int h);
extern void scopeClose(const void *unique_id);
extern bool scopeIsOpen(const void *unique_id);
extern void scopeSubmit(const void *unique_id, const float *data, int nsamples);
extern void scopeSubmitStrided(const void *unique_id, const float *data, int stride, int nsamples);
extern void scopeUpdateAll();
Expand Down
27 changes: 15 additions & 12 deletions v2/synth_core.cpp
Expand Up @@ -996,7 +996,10 @@ struct V2Env
COVER("EG dcy");
val *= dcf;
if (val <= sul)
{
val = sul;
state = SUSTAIN;
}
break;

case SUSTAIN:
Expand Down Expand Up @@ -2386,11 +2389,11 @@ struct V2Reverb
sF32 cur = 0.0f;
for (sInt j=0; j < 4; j++)
{
sF32 dv = combd[ch][j].fetch();
sF32 nv = gainc[j] * dv + ((j & 1) ? -in : in); // alternate phase on combs
combl[ch][j] += damp * (nv - combl[ch][j]);
combd[ch][j].feed(combl[ch][j]);
cur += combl[ch][j];
sF32 dv = gainc[j] * combd[ch][j].fetch();
sF32 nv = (j & 1) ? (dv - in) : (dv + in); // alternate phase on combs
sF32 lp = combl[ch][j] + damp * (nv - combl[ch][j]);
combd[ch][j].feed(lp);
cur += lp;
}

// serial allpass filters
Expand Down Expand Up @@ -2711,13 +2714,13 @@ struct V2Synth
sInt sr_lfo = 800;
sInt w = 800, h = 150;

//DEBUG_PLOT_OPEN(&voicesw[0].osc[0], "Voice 0 VCO 0", sr_plot, w, h);
//DEBUG_PLOT_OPEN(&voicesw[0].osc[1], "Voice 0 VCO 1", sr_plot, w, h);
//DEBUG_PLOT_OPEN(&voicesw[0].vcf[0], "Voice 0 VCF 0", sr_plot, w, h);
//DEBUG_PLOT_OPEN(&voicesw[0].env[0], "Voice 0 Env 0", sr_lfo, w, h);
//DEBUG_PLOT_OPEN(&voicesw[0].lfo[0], "Voice 0 LFO 0", sr_lfo, w, h);
DEBUG_PLOT_OPEN(&voicesw[0].dist, "Voice 0 Dist", sr_plot, w, h);
DEBUG_PLOT_OPEN(&voicesw[0], "Voice 0 final", sr_plot, w, h);
//DEBUG_PLOT_OPEN(&voicesw[1].osc[0], "Voice 1 VCO 0", sr_plot, w, h);
//DEBUG_PLOT_OPEN(&voicesw[1].osc[1], "Voice 1 VCO 1", sr_plot, w, h);
//DEBUG_PLOT_OPEN(&voicesw[1].vcf[0], "Voice 1 VCF 0", sr_plot, w, h);
DEBUG_PLOT_OPEN(&voicesw[1].env[0], "Voice 1 Env 0", sr_lfo, w, h);
//DEBUG_PLOT_OPEN(&voicesw[1].lfo[0], "Voice 1 LFO 0", sr_lfo, w, h);
//DEBUG_PLOT_OPEN(&voicesw[1].dist, "Voice 1 Dist", sr_plot, w, h);
//DEBUG_PLOT_OPEN(&voicesw[1], "Voice 1 final", sr_plot, w, h);
//DEBUG_PLOT_OPEN(DEBUG_PLOT_CHAN(&chansw[0].dcf1, 0), "Chan 0 DCF1 L", sr_plot, w, h);
//DEBUG_PLOT_OPEN(DEBUG_PLOT_CHAN(&chansw[0].dcf1, 1), "Chan 0 DCF1 R", sr_plot, w, h);
//DEBUG_PLOT_OPEN(DEBUG_PLOT_CHAN(&chansw[0], 0), "Channel 0 L", sr_plot, w, h);
Expand Down
1 change: 1 addition & 0 deletions v2/tinyplayer_cpp/tinyplayer_cpp.vcxproj
Expand Up @@ -82,6 +82,7 @@
<ItemGroup>
<ClCompile Include="..\dsio_cpp.cpp" />
<ClCompile Include="..\ronan.cpp" />
<ClCompile Include="..\scope.cpp" />
<ClCompile Include="..\synth_core.cpp" />
<ClCompile Include="..\tinyplayer\tinyplayer.cpp" />
<ClCompile Include="..\v2mplayer.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions v2/tinyplayer_cpp/tinyplayer_cpp.vcxproj.filters
Expand Up @@ -44,6 +44,9 @@
<ClCompile Include="..\ronan.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\scope.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\tinyplayer\tune.asm">
Expand Down

0 comments on commit ce87ef3

Please sign in to comment.