aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eg-metro.lv2/metro.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-16 16:51:04 +0100
committerDavid Robillard <d@drobilla.net>2020-12-16 16:51:52 +0100
commitc8713e92312ef140ea8576031769cdad10b30946 (patch)
tree5bf1463ba7bb06af7e21a5de4e5c779855e1e799 /plugins/eg-metro.lv2/metro.c
parentbbff4459368ea25f1ae1ee3452a5b5c5dcd64e06 (diff)
downloadlv2-c8713e92312ef140ea8576031769cdad10b30946.tar.xz
Fix implicit and narrowing conversions
Diffstat (limited to 'plugins/eg-metro.lv2/metro.c')
-rw-r--r--plugins/eg-metro.lv2/metro.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/eg-metro.lv2/metro.c b/plugins/eg-metro.lv2/metro.c
index 4531e1e..eebad3e 100644
--- a/plugins/eg-metro.lv2/metro.c
+++ b/plugins/eg-metro.lv2/metro.c
@@ -235,7 +235,7 @@ play(Metro* self, uint32_t begin, uint32_t end)
// Amplitude decreases from 1..0 until attack_len + decay_len
output[i] = 0.0f;
output[i] = self->wave[self->wave_offset] *
- (1 - ((self->elapsed_len - self->attack_len) /
+ (1 - ((float)(self->elapsed_len - self->attack_len) /
(float)self->decay_len));
if (self->elapsed_len >= self->attack_len + self->decay_len) {
self->state = STATE_OFF;
@@ -285,7 +285,7 @@ update_position(Metro* self, const LV2_Atom_Object* obj)
if (beat && beat->type == uris->atom_Float) {
// Received a beat position, synchronise
// This hard sync may cause clicks, a real plugin would be more graceful
- const float frames_per_beat = 60.0f / self->bpm * self->rate;
+ const float frames_per_beat = (float)(60.0 / self->bpm * self->rate);
const float bar_beats = ((LV2_Atom_Float*)beat)->body;
const float beat_beats = bar_beats - floorf(bar_beats);
self->elapsed_len = beat_beats * frames_per_beat;