From 0d70be3a055ef3232cfe5568a1ec3e07f11f5dfe Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 4 Jul 2022 22:01:25 -0600 Subject: [PATCH] miscellaneous fixes for warnings from -Wconversion --- libs/ardour/transient_detector.cc | 2 +- libs/evoral/SMF.cc | 4 ++-- libs/evoral/evoral/Event.h | 4 ++-- libs/evoral/evoral/Note.h | 6 ++++-- libs/pbd/pbd/string_convert.h | 4 ++-- libs/pbd/pbd/timing.h | 12 ++++++------ libs/pbd/stacktrace.cc | 2 +- libs/temporal/bbt_time.cc | 4 ++-- libs/temporal/temporal/bbt_time.h | 12 ++++++------ libs/temporal/temporal/beats.h | 4 ++-- libs/temporal/temporal/tempo.h | 16 ++++++++-------- 11 files changed, 36 insertions(+), 34 deletions(-) diff --git a/libs/ardour/transient_detector.cc b/libs/ardour/transient_detector.cc index 4324d54aa7..8f7fc50076 100644 --- a/libs/ardour/transient_detector.cc +++ b/libs/ardour/transient_detector.cc @@ -94,7 +94,7 @@ TransientDetector::set_sensitivity (uint32_t mode, float val) // see libs/vamp-plugins/OnsetDetect.cpp //plugin->selectProgram ("General purpose"); // dftype = 3, sensitivity = 50, whiten = 0 (default) //plugin->selectProgram ("Percussive onsets"); // dftype = 4, sensitivity = 40, whiten = 0 - plugin->setParameter ("dftype", mode); + plugin->setParameter ("dftype", (float) mode); plugin->setParameter ("sensitivity", std::min (100.f, std::max (0.f, val))); plugin->setParameter ("whiten", 0); } diff --git a/libs/evoral/SMF.cc b/libs/evoral/SMF.cc index 48263e178c..aa2a768f4b 100644 --- a/libs/evoral/SMF.cc +++ b/libs/evoral/SMF.cc @@ -63,7 +63,7 @@ uint16_t SMF::num_tracks() const { Glib::Threads::Mutex::Lock lm (_smf_lock); - return _smf ? _smf->number_of_tracks : 0; + return (uint16_t) (_smf ? _smf->number_of_tracks : 0); } uint16_t @@ -304,7 +304,7 @@ SMF::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf, event_id_t* no return 0; /* this is a meta-event */ } - int event_size = event->midi_buffer_length; + uint32_t event_size = (uint32_t) event->midi_buffer_length; assert(event_size > 0); // Make sure we have enough scratch buffer diff --git a/libs/evoral/evoral/Event.h b/libs/evoral/evoral/Event.h index b4957c4d5b..03b8b033d7 100644 --- a/libs/evoral/evoral/Event.h +++ b/libs/evoral/evoral/Event.h @@ -171,7 +171,7 @@ public: uint8_t pgm_number() const { return _buf[1]; } uint8_t pitch_bender_lsb() const { return _buf[1]; } uint8_t pitch_bender_msb() const { return _buf[2]; } - uint16_t pitch_bender_value() const { return ((0x7F & _buf[2]) << 7 | (0x7F & _buf[1])); } + uint16_t pitch_bender_value() const { return (uint16_t) ((0x7F & _buf[2]) << 7 | (0x7F & _buf[1])); } void set_channel(uint8_t channel) { _buf[0] = (0xF0 & _buf[0]) | (0x0F & channel); } void set_type(uint8_t type) { _buf[0] = (0x0F & _buf[0]) | (0xF0 & type); } @@ -183,7 +183,7 @@ public: void scale_velocity (float factor) { factor = std::max (factor, 0.0f); - set_velocity (std::min (127L, lrintf (velocity() * factor))); + set_velocity ((uint8_t) (std::min (127L, lrintf (velocity() * factor)))); } uint16_t value() const { diff --git a/libs/evoral/evoral/Note.h b/libs/evoral/evoral/Note.h index 5929c33bbb..d2ca87434d 100644 --- a/libs/evoral/evoral/Note.h +++ b/libs/evoral/evoral/Note.h @@ -72,8 +72,10 @@ public: private: const Note