Skip to content

Commit

Permalink
dumb: disable some of the most resource intensive parts during initia…
Browse files Browse the repository at this point in the history
…l_runthrough
  • Loading branch information
Oleksiy-Yakovenko committed Mar 16, 2017
1 parent a6cbe60 commit 767423e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions plugins/dumb/dumb-kode54/include/internal/it.h
Expand Up @@ -451,6 +451,8 @@ struct DUMB_IT_SIGDATA
IT_MIDI *midi;

IT_CHECKPOINT *checkpoint;

int initial_runthrough;
};


Expand Down Expand Up @@ -745,6 +747,8 @@ struct DUMB_IT_SIGRENDERER
int ramp_style;

//int max_output;

int initial_runthrough;
};


Expand Down
22 changes: 21 additions & 1 deletion plugins/dumb/dumb-kode54/src/it/itrender.c
Expand Up @@ -1310,6 +1310,9 @@ static void update_smooth_effects_playing(IT_PLAYING *playing)

static void update_smooth_effects(DUMB_IT_SIGRENDERER *sigrenderer)
{
if (sigrenderer->initial_runthrough) {
return;
}
int i;

for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
Expand Down Expand Up @@ -1398,6 +1401,10 @@ static void update_playing_effects(IT_PLAYING *playing)

static void update_effects(DUMB_IT_SIGRENDERER *sigrenderer)
{
if (sigrenderer->initial_runthrough) {
return;
}

int i;

if (sigrenderer->globalvolslide) {
Expand Down Expand Up @@ -4068,6 +4075,10 @@ static void playing_volume_setup(DUMB_IT_SIGRENDERER * sigrenderer, IT_PLAYING *

static void process_playing(DUMB_IT_SIGRENDERER *sigrenderer, IT_PLAYING *playing, float invt2g)
{
if (sigrenderer->initial_runthrough) {
return;
}

DUMB_IT_SIGDATA * sigdata = sigrenderer->sigdata;

if (playing->instrument) {
Expand Down Expand Up @@ -4619,6 +4630,10 @@ static const int aiPTMVolScaled[] =

static float calculate_volume(DUMB_IT_SIGRENDERER *sigrenderer, IT_PLAYING *playing, float volume)
{
if (sigrenderer->initial_runthrough) {
return 0;
}

if (volume != 0) {
int vol;

Expand Down Expand Up @@ -5867,7 +5882,9 @@ long dumb_it_build_checkpoints(DUMB_IT_SIGDATA *sigdata, int startorder)
return checkpoint->time;
}

sigrenderer->initial_runthrough = sigdata->initial_runthrough;
l = it_sigrenderer_get_samples(sigrenderer, 0, 1.0f, IT_CHECKPOINT_INTERVAL, NULL);
sigrenderer->initial_runthrough = 0;
if (l < IT_CHECKPOINT_INTERVAL) {
_dumb_it_end_sigrenderer(sigrenderer);
checkpoint->next = NULL;
Expand Down Expand Up @@ -5898,8 +5915,11 @@ void dumb_it_do_initial_runthrough(DUH *duh)
if (duh) {
DUMB_IT_SIGDATA *sigdata = duh_get_it_sigdata(duh);

if (sigdata)
if (sigdata) {
sigdata->initial_runthrough = 1;
duh_set_length(duh, dumb_it_build_checkpoints(sigdata, 0));
sigdata->initial_runthrough = 0;
}
}
}

Expand Down

0 comments on commit 767423e

Please sign in to comment.