comparison main/MainWindow.cpp @ 26:d88d117e0c34

* Add mono timestretch toggle button; some more work on getting blocksize etc parameters through to plugins
author Chris Cannam
date Mon, 18 Sep 2006 16:43:17 +0000
parents e74f508db18c
children 61259228d029
comparison
equal deleted inserted replaced
25:e74f508db18c 26:d88d117e0c34
164 m_playSpeed->setToolTip(tr("Playback speed: +0%")); 164 m_playSpeed->setToolTip(tr("Playback speed: +0%"));
165 m_playSpeed->setDefaultValue(100); 165 m_playSpeed->setDefaultValue(100);
166 connect(m_playSpeed, SIGNAL(valueChanged(int)), 166 connect(m_playSpeed, SIGNAL(valueChanged(int)),
167 this, SLOT(playSpeedChanged(int))); 167 this, SLOT(playSpeedChanged(int)));
168 168
169 m_playSharpen = new QCheckBox(frame); 169 m_playSharpen = new QPushButton(frame);
170 m_playSharpen->setToolTip(tr("Sharpen percussive transients")); 170 m_playSharpen->setToolTip(tr("Sharpen percussive transients"));
171 m_playSharpen->setFixedSize(20, 20);
172 // m_playSharpen->setFlat(true);
171 m_playSharpen->setEnabled(false); 173 m_playSharpen->setEnabled(false);
174 m_playSharpen->setCheckable(true);
175 m_playSharpen->setChecked(false);
176 m_playSharpen->setIcon(QIcon(":icons/sharpen.png"));
177 connect(m_playSharpen, SIGNAL(clicked()), this, SLOT(playSharpenToggled()));
178
179 m_playMono = new QPushButton(frame);
180 m_playMono->setToolTip(tr("Run time stretcher in mono only"));
181 m_playMono->setFixedSize(20, 20);
182 // m_playMono->setFlat(true);
183 m_playMono->setEnabled(false);
184 m_playMono->setCheckable(true);
185 m_playMono->setChecked(false);
186 m_playMono->setIcon(QIcon(":icons/mono.png"));
187 connect(m_playMono, SIGNAL(clicked()), this, SLOT(playMonoToggled()));
172 188
173 QSettings settings; 189 QSettings settings;
174 settings.beginGroup("MainWindow"); 190 settings.beginGroup("MainWindow");
175 m_playSharpen->setChecked(settings.value("playsharpen", true).toBool()); 191 m_playSharpen->setChecked(settings.value("playsharpen", true).toBool());
192 m_playMono->setChecked(settings.value("playmono", false).toBool());
176 settings.endGroup(); 193 settings.endGroup();
177 194
178 connect(m_playSharpen, SIGNAL(clicked()), 195 layout->addWidget(m_paneStack, 0, 0, 1, 5);
179 this, SLOT(playSharpenToggled()));
180
181 layout->addWidget(m_paneStack, 0, 0, 1, 4);
182 layout->addWidget(m_panner, 1, 0); 196 layout->addWidget(m_panner, 1, 0);
183 layout->addWidget(m_fader, 1, 1); 197 layout->addWidget(m_fader, 1, 1);
184 layout->addWidget(m_playSpeed, 1, 2); 198 layout->addWidget(m_playSpeed, 1, 2);
185 layout->addWidget(m_playSharpen, 1, 3); 199 layout->addWidget(m_playSharpen, 1, 3);
200 layout->addWidget(m_playMono, 1, 4);
186 201
187 layout->setColumnStretch(0, 10); 202 layout->setColumnStretch(0, 10);
188 203
189 frame->setLayout(layout); 204 frame->setLayout(layout);
190 205
2868 } 2883 }
2869 2884
2870 void 2885 void
2871 MainWindow::playSpeedChanged(int speed) 2886 MainWindow::playSpeedChanged(int speed)
2872 { 2887 {
2873 // static float factors[] = {
2874 // 1.0, 1.1, 1.2, 1.3, 1.5, 1.7, 2.0, 3.0, 4.0, 6.0, 10.0
2875 // };
2876 // float factor = factors[speed >= 10 ? speed - 10 : 10 - speed];
2877
2878 bool slow = false; 2888 bool slow = false;
2879 bool something = false; 2889 bool something = false;
2880 float factor; 2890 float factor;
2881 2891
2882 if (speed < 100) { 2892 if (speed < 100) {
2905 m_playSpeed->setToolTip(tr("Playback speed: %1%2%") 2915 m_playSpeed->setToolTip(tr("Playback speed: %1%2%")
2906 .arg(!slow ? "+" : "-") 2916 .arg(!slow ? "+" : "-")
2907 .arg(pc)); 2917 .arg(pc));
2908 2918
2909 m_playSharpen->setEnabled(something); 2919 m_playSharpen->setEnabled(something);
2920 m_playMono->setEnabled(something);
2910 bool sharpen = (something && m_playSharpen->isChecked()); 2921 bool sharpen = (something && m_playSharpen->isChecked());
2911 m_playSource->setSlowdownFactor(factor, sharpen); 2922 bool mono = (something && m_playMono->isChecked());
2923 m_playSource->setTimeStretch(factor, sharpen, mono);
2912 } 2924 }
2913 2925
2914 void 2926 void
2915 MainWindow::playSharpenToggled() 2927 MainWindow::playSharpenToggled()
2916 { 2928 {
2919 settings.setValue("playsharpen", m_playSharpen->isChecked()); 2931 settings.setValue("playsharpen", m_playSharpen->isChecked());
2920 settings.endGroup(); 2932 settings.endGroup();
2921 2933
2922 playSpeedChanged(m_playSpeed->value()); 2934 playSpeedChanged(m_playSpeed->value());
2923 } 2935 }
2936
2937 void
2938 MainWindow::playMonoToggled()
2939 {
2940 QSettings settings;
2941 settings.beginGroup("MainWindow");
2942 settings.setValue("playmono", m_playMono->isChecked());
2943 settings.endGroup();
2944
2945 playSpeedChanged(m_playSpeed->value());
2946 }
2924 2947
2925 void 2948 void
2926 MainWindow::outputLevelsChanged(float left, float right) 2949 MainWindow::outputLevelsChanged(float left, float right)
2927 { 2950 {
2928 m_fader->setPeakLeft(left); 2951 m_fader->setPeakLeft(left);