comparison main/MainWindow.cpp @ 922:a16456ca5e71 cxx11

More type fixes. We now build with -Wconversion, on this platform (64-bit Linux) at least.
author Chris Cannam
date Tue, 10 Mar 2015 17:23:45 +0000
parents 67540751da93
children 61703996628d ac144f0815a2
comparison
equal deleted inserted replaced
921:67540751da93 922:a16456ca5e71
2340 return; 2340 return;
2341 } 2341 }
2342 2342
2343 QString description; 2343 QString description;
2344 2344
2345 int ssr = getMainModel()->getSampleRate(); 2345 sv_samplerate_t ssr = getMainModel()->getSampleRate();
2346 int tsr = ssr; 2346 sv_samplerate_t tsr = ssr;
2347 if (m_playSource) tsr = m_playSource->getTargetSampleRate(); 2347 if (m_playSource) tsr = m_playSource->getTargetSampleRate();
2348 2348
2349 if (ssr != tsr) { 2349 if (ssr != tsr) {
2350 description = tr("%1Hz (resampling to %2Hz)").arg(ssr).arg(tsr); 2350 description = tr("%1Hz (resampling to %2Hz)").arg(ssr).arg(tsr);
2351 } else { 2351 } else {
2806 QSize total, visible, selected; 2806 QSize total, visible, selected;
2807 total = pane->getImageSize(); 2807 total = pane->getImageSize();
2808 visible = pane->getImageSize(pane->getFirstVisibleFrame(), 2808 visible = pane->getImageSize(pane->getFirstVisibleFrame(),
2809 pane->getLastVisibleFrame()); 2809 pane->getLastVisibleFrame());
2810 2810
2811 int sf0 = 0, sf1 = 0; 2811 sv_frame_t sf0 = 0, sf1 = 0;
2812 2812
2813 if (haveSelection) { 2813 if (haveSelection) {
2814 MultiSelection::SelectionList selections = m_viewManager->getSelections(); 2814 MultiSelection::SelectionList selections = m_viewManager->getSelections();
2815 sf0 = selections.begin()->getStartFrame(); 2815 sf0 = selections.begin()->getStartFrame();
2816 MultiSelection::SelectionList::iterator e = selections.end(); 2816 MultiSelection::SelectionList::iterator e = selections.end();
3872 void 3872 void
3873 MainWindow::playSpeedChanged(int position) 3873 MainWindow::playSpeedChanged(int position)
3874 { 3874 {
3875 PlaySpeedRangeMapper mapper(0, 200); 3875 PlaySpeedRangeMapper mapper(0, 200);
3876 3876
3877 float percent = m_playSpeed->mappedValue(); 3877 double percent = m_playSpeed->mappedValue();
3878 float factor = mapper.getFactorForValue(percent); 3878 double factor = mapper.getFactorForValue(percent);
3879 3879
3880 // cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << endl; 3880 // cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << endl;
3881 3881
3882 bool something = (position != 100); 3882 bool something = (position != 100);
3883 3883
3884 int pc = lrintf(percent); 3884 int pc = int(lrint(percent));
3885 3885
3886 if (!something) { 3886 if (!something) {
3887 contextHelpChanged(tr("Playback speed: Normal")); 3887 contextHelpChanged(tr("Playback speed: Normal"));
3888 } else { 3888 } else {
3889 contextHelpChanged(tr("Playback speed: %1%2%") 3889 contextHelpChanged(tr("Playback speed: %1%2%")
3970 if (!getMainModel() || !p) { 3970 if (!getMainModel() || !p) {
3971 return; 3971 return;
3972 } 3972 }
3973 3973
3974 bool haveSelection = false; 3974 bool haveSelection = false;
3975 int startFrame = 0, endFrame = 0; 3975 sv_frame_t startFrame = 0, endFrame = 0;
3976 3976
3977 if (m_viewManager && m_viewManager->haveInProgressSelection()) { 3977 if (m_viewManager && m_viewManager->haveInProgressSelection()) {
3978 3978
3979 bool exclusive = false; 3979 bool exclusive = false;
3980 Selection s = m_viewManager->getInProgressSelection(exclusive); 3980 Selection s = m_viewManager->getInProgressSelection(exclusive);
4023 MainWindow::updatePositionStatusDisplays() const 4023 MainWindow::updatePositionStatusDisplays() const
4024 { 4024 {
4025 if (!statusBar()->isVisible()) return; 4025 if (!statusBar()->isVisible()) return;
4026 4026
4027 Pane *pane = 0; 4027 Pane *pane = 0;
4028 int frame = m_viewManager->getPlaybackFrame(); 4028 sv_frame_t frame = m_viewManager->getPlaybackFrame();
4029 4029
4030 if (m_paneStack) pane = m_paneStack->getCurrentPane(); 4030 if (m_paneStack) pane = m_paneStack->getCurrentPane();
4031 if (!pane) return; 4031 if (!pane) return;
4032 4032
4033 int layers = pane->getLayerCount(); 4033 int layers = pane->getLayerCount();
4117 4117
4118 while (m_midiInput->getEventsAvailable() > 0) { 4118 while (m_midiInput->getEventsAvailable() > 0) {
4119 4119
4120 MIDIEvent ev(m_midiInput->readEvent()); 4120 MIDIEvent ev(m_midiInput->readEvent());
4121 4121
4122 int frame = currentPane->alignFromReference(ev.getTime()); 4122 sv_frame_t frame = currentPane->alignFromReference(ev.getTime());
4123 4123
4124 bool noteOn = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON && 4124 bool noteOn = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON &&
4125 ev.getVelocity() > 0); 4125 ev.getVelocity() > 0);
4126 4126
4127 bool noteOff = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_OFF || 4127 bool noteOff = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_OFF ||