Added logging in the most common clients
This commit is contained in:
parent
9f96968169
commit
e69781ff6b
2 changed files with 19 additions and 2 deletions
|
|
@ -273,8 +273,11 @@ int main(int argc, char** argv)
|
||||||
signal(SIGQUIT, done);
|
signal(SIGQUIT, done);
|
||||||
|
|
||||||
while (!shouldClose){
|
while (!shouldClose){
|
||||||
// synth.garbageCollect();
|
#ifdef DEBUG
|
||||||
std::this_thread::sleep_for(1s);
|
std::cout << "Allocated buffers: " << synth.getAllocatedBuffers() << '\n';
|
||||||
|
std::cout << "Total size: " << synth.getAllocatedBytes() << '\n';
|
||||||
|
#endif
|
||||||
|
std::this_thread::sleep_for(2s);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Closing..." << '\n';
|
std::cout << "Closing..." << '\n';
|
||||||
|
|
|
||||||
14
lv2/sfizz.c
14
lv2/sfizz.c
|
|
@ -63,6 +63,7 @@
|
||||||
#define DEFAULT_VOICES 64
|
#define DEFAULT_VOICES 64
|
||||||
#define DEFAULT_OVERSAMPLING SFIZZ_OVERSAMPLING_X1
|
#define DEFAULT_OVERSAMPLING SFIZZ_OVERSAMPLING_X1
|
||||||
#define DEFAULT_PRELOAD 8192
|
#define DEFAULT_PRELOAD 8192
|
||||||
|
#define LOG_SAMPLE_COUNT 96000
|
||||||
#define UNUSED(x) (void)(x)
|
#define UNUSED(x) (void)(x)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
@ -121,6 +122,7 @@ typedef struct
|
||||||
sfizz_oversampling_factor_t oversampling;
|
sfizz_oversampling_factor_t oversampling;
|
||||||
bool changing_state;
|
bool changing_state;
|
||||||
int max_block_size;
|
int max_block_size;
|
||||||
|
int sample_counter;
|
||||||
float sample_rate;
|
float sample_rate;
|
||||||
} sfizz_plugin_t;
|
} sfizz_plugin_t;
|
||||||
|
|
||||||
|
|
@ -226,6 +228,7 @@ instantiate(const LV2_Descriptor *descriptor,
|
||||||
self->oversampling = DEFAULT_OVERSAMPLING;
|
self->oversampling = DEFAULT_OVERSAMPLING;
|
||||||
self->preload_size = DEFAULT_PRELOAD;
|
self->preload_size = DEFAULT_PRELOAD;
|
||||||
self->changing_state = false;
|
self->changing_state = false;
|
||||||
|
self->sample_counter = 0;
|
||||||
|
|
||||||
// Get the features from the host and populate the structure
|
// Get the features from the host and populate the structure
|
||||||
for (const LV2_Feature *const *f = features; *f; f++)
|
for (const LV2_Feature *const *f = features; *f; f++)
|
||||||
|
|
@ -575,6 +578,17 @@ run(LV2_Handle instance, uint32_t sample_count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
// Log the buffer usage
|
||||||
|
self->sample_counter += (int)sample_count;
|
||||||
|
if (self->sample_counter > LOG_SAMPLE_COUNT)
|
||||||
|
{
|
||||||
|
lv2_log_note(&self->logger, "[run] Allocated buffers: %d\n", sfizz_get_num_buffers(self->synth));
|
||||||
|
lv2_log_note(&self->logger, "[run] Allocated bytes: %d\n", sfizz_get_num_bytes(self->synth));
|
||||||
|
self->sample_counter -= LOG_SAMPLE_COUNT;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Render the block
|
// Render the block
|
||||||
sfizz_render_block(self->synth, self->output_buffers, 2, (int)sample_count);
|
sfizz_render_block(self->synth, self->output_buffers, 2, (int)sample_count);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue