avoid non-integer loop conditions.
authorRobin Gareus <robin@gareus.org>
Sun, 8 Mar 2015 01:01:48 +0000 (02:01 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 8 Mar 2015 01:01:48 +0000 (02:01 +0100)
gtk2_ardour/automation_controller.cc
libs/backends/dummy/dummy_audiobackend.cc

index 980b38ad650a57987f2463837ece1fd18c3ee692..30ff65631405bf051f9d40f0eb9b69ac92400bf5 100644 (file)
@@ -303,10 +303,10 @@ AutomationController::on_button_release(GdkEventButton* ev)
                                                 sigc::mem_fun(*this, &AutomationController::run_note_select_dialog)));
                }
                if (is_low) {
-                       for (double beats = 1.0; beats <= 16; ++beats) {
+                       for (int beats = 1; beats <= 16; ++beats) {
                                items.push_back(MenuElem(string_compose(_("Set to %1 beat(s)"), (int)beats),
                                                         sigc::bind(sigc::mem_fun(*this, &AutomationController::set_freq_beats),
-                                                                   beats)));
+                                                                   (double)beats)));
                        }
                }
                menu->popup(1, ev->time);
index 7b5f41bc890246f9accc30711fd2778690b2a03d..462f1b9dc3f04fc9d4570da2daf0def9797265f0 100644 (file)
@@ -1600,8 +1600,9 @@ void DummyAudioPort::setup_generator (GeneratorType const g, float const sampler
                                const double b = log (f_max / f_min) / g_p2;
                                const double a = f_min / (b * samplerate);
 #endif
+                               const uint32_t g_p2i = rint(g_p2);
                                _wavetable = (Sample*) malloc (_gen_period * sizeof(Sample));
-                               for (uint32_t i = 0 ; i < g_p2; ++i) {
+                               for (uint32_t i = 0 ; i < g_p2i; ++i) {
 #ifdef LINEAR_SWEEP
                                        const double phase = i * (a + b * i);
 #else
@@ -1609,7 +1610,7 @@ void DummyAudioPort::setup_generator (GeneratorType const g, float const sampler
 #endif
                                        _wavetable[i] = (float)sin (2. * M_PI * (phase - floor (phase)));
                                }
-                               for (uint32_t i = g_p2; i < _gen_period; ++i) {
+                               for (uint32_t i = g_p2i; i < _gen_period; ++i) {
                                        const uint32_t j = _gen_period - i;
 #ifdef LINEAR_SWEEP
                                        const double phase = j * (a + b * j);