use C struct init

This commit is contained in:
Paul Ferrand 2020-05-13 21:56:22 +02:00
parent 7d98349e16
commit 2c5cc017cd

View file

@ -558,10 +558,11 @@ sfizz_lv2_check_oversampling(sfizz_plugin_t* self)
return; return;
self->oversampling = (sfizz_oversampling_factor_t)next_pow_2(port_value); self->oversampling = (sfizz_oversampling_factor_t)next_pow_2(port_value);
LV2_Atom_Int atom; LV2_Atom_Int atom = {
atom.atom.type = self->sfizz_oversampling_uri; .atom.type = self->sfizz_oversampling_uri,
atom.atom.size = sizeof(int); .atom.size = sizeof(int),
atom.body = self->oversampling; .body = self->oversampling
};
if (self->worker->schedule_work(self->worker->handle, if (self->worker->schedule_work(self->worker->handle,
lv2_atom_total_size((LV2_Atom *)&atom), lv2_atom_total_size((LV2_Atom *)&atom),
&atom) != LV2_WORKER_SUCCESS) &atom) != LV2_WORKER_SUCCESS)
@ -576,10 +577,11 @@ sfizz_lv2_check_preload_size(sfizz_plugin_t* self)
unsigned int preload_size = (int)*self->preload_port; unsigned int preload_size = (int)*self->preload_port;
if (preload_size != self->preload_size) if (preload_size != self->preload_size)
{ {
LV2_Atom_Int atom; LV2_Atom_Int atom = {
atom.atom.type = self->sfizz_preload_size_uri; .atom.type = self->sfizz_preload_size_uri,
atom.atom.size = sizeof(int); .atom.size = sizeof(int),
atom.body = preload_size; .body = preload_size
};
if (self->worker->schedule_work(self->worker->handle, if (self->worker->schedule_work(self->worker->handle,
lv2_atom_total_size((LV2_Atom *)&atom), lv2_atom_total_size((LV2_Atom *)&atom),
&atom) != LV2_WORKER_SUCCESS) &atom) != LV2_WORKER_SUCCESS)
@ -596,13 +598,14 @@ sfizz_lv2_check_num_voices(sfizz_plugin_t* self)
int num_voices = (int)*self->polyphony_port; int num_voices = (int)*self->polyphony_port;
if (num_voices != self->num_voices) if (num_voices != self->num_voices)
{ {
LV2_Atom_Int num_voices_atom; LV2_Atom_Int atom = {
num_voices_atom.atom.type = self->sfizz_num_voices_uri; .atom.type = self->sfizz_num_voices_uri,
num_voices_atom.atom.size = sizeof(int); .atom.size = sizeof(int),
num_voices_atom.body = num_voices; .body = num_voices
};
if (self->worker->schedule_work(self->worker->handle, if (self->worker->schedule_work(self->worker->handle,
lv2_atom_total_size((LV2_Atom *)&num_voices_atom), lv2_atom_total_size((LV2_Atom *)&atom),
&num_voices_atom) != LV2_WORKER_SUCCESS) &atom) != LV2_WORKER_SUCCESS)
{ {
lv2_log_error(&self->logger, "[sfizz] There was an issue changing the number of voices\n"); lv2_log_error(&self->logger, "[sfizz] There was an issue changing the number of voices\n");
} }
@ -942,9 +945,10 @@ work(LV2_Handle instance,
} }
// Reactivate checking for file changes // Reactivate checking for file changes
LV2_Atom check_modification_atom; LV2_Atom check_modification_atom = {
check_modification_atom.size = 0; .size = 0,
check_modification_atom.type = self->sfizz_check_modification_uri; .type = self->sfizz_check_modification_uri
};
respond(handle, lv2_atom_total_size(&check_modification_atom), &check_modification_atom); respond(handle, lv2_atom_total_size(&check_modification_atom), &check_modification_atom);
} }
else if (atom->type == self->sfizz_num_voices_uri) else if (atom->type == self->sfizz_num_voices_uri)