Ticket #4386: mm_stretch.1.patch
File mm_stretch.1.patch, 8.4 KB (added by , 16 years ago) |
---|
-
mythmusic/mythmusic/playbackbox.cpp
99 99 if (gContext->GetNumSetting("MythControlsVolume", 0)) 100 100 { 101 101 volume_control = true; 102 volume_display_timer->start(2000);103 connect(volume_display_timer, SIGNAL(timeout()),104 this, SLOT(hideVolume()));105 102 } 103 volume_display_timer->start(2000); 104 connect(volume_display_timer, SIGNAL(timeout()), 105 this, SLOT(hideVolume())); 106 106 107 107 setShuffleMode(gPlayer->getShuffleMode()); 108 108 … … 352 352 changeVolume(false); 353 353 else if (action == "VOLUMEUP") 354 354 changeVolume(true); 355 else if (action == "SPEEDDOWN") 356 changeSpeed(false); 357 else if (action == "SPEEDUP") 358 changeSpeed(true); 355 359 else if (action == "MUTE") 356 360 toggleMute(); 357 361 else if (action == "MENU" && visualizer_status != 2) … … 1151 1155 } 1152 1156 } 1153 1157 1158 void PlaybackBoxMusic::changeSpeed(bool up_or_down) 1159 { 1160 if (gPlayer->getOutput()) 1161 { 1162 if (up_or_down) 1163 gPlayer->incSpeed(); 1164 else 1165 gPlayer->decSpeed(); 1166 showSpeed(true); 1167 } 1168 } 1169 1154 1170 void PlaybackBoxMusic::toggleMute() 1155 1171 { 1156 1172 if (volume_control && gPlayer->getOutput()) … … 1172 1188 void PlaybackBoxMusic::showVolume(bool on_or_off) 1173 1189 { 1174 1190 float volume_level; 1191 if (speed_status && speed_status->getOrder() != -1) 1192 { 1193 speed_status->SetOrder(-1); 1194 speed_status->refresh(); 1195 } 1175 1196 if (volume_control && gPlayer->getOutput()) 1176 1197 { 1177 1198 if (volume_status) … … 1209 1230 } 1210 1231 } 1211 1232 1233 void PlaybackBoxMusic::showSpeed(bool on_or_off) 1234 { 1235 if (speed_status) 1236 { 1237 if (volume_status && (volume_status->getOrder() != -1)) 1238 { 1239 volume_status->SetOrder(-1); 1240 volume_status->refresh(); 1241 } 1242 if (on_or_off) 1243 { 1244 QString speed_text; 1245 float playSpeed = gPlayer->getSpeed(); 1246 speed_text.sprintf("x%4.2f",playSpeed); 1247 speed_status->SetText(speed_text); 1248 speed_status->SetOrder(0); 1249 speed_status->refresh(); 1250 volume_display_timer->changeInterval(2000); 1251 } 1252 } 1253 } 1254 1212 1255 void PlaybackBoxMusic::resetTimer() 1213 1256 { 1214 1257 if (visual_mode_delay > 0) … … 2153 2196 volume_status->SetTotal(100); 2154 2197 volume_status->SetOrder(-1); 2155 2198 } 2199 speed_status = getUITextType("speed_status"); 2200 if (speed_status) 2201 { 2202 speed_status->SetText(""); 2203 speed_status->SetOrder(-1); 2204 } 2156 2205 visual_blackhole = getUIBlackHoleType("visual_blackhole"); 2157 2206 2158 2207 // Buttons -
mythmusic/mythmusic/music-ui.xml
329 329 <orientation>BottomToTop</orientation> 330 330 </statusbar> 331 331 </container> 332 <container name="speeddisplay"> 333 <area>690,385,105,25</area> 334 <textarea name="speed_status" draworder="-1" align="left"> 335 <font>infotext</font> 336 <area>0,0,105,25</area> 337 </textarea> 338 </container> 332 339 333 340 <!-- 334 341 All the buttons -
mythmusic/mythmusic/miniplayer.cpp
252 252 increaseRating(); 253 253 else if (action == "THMBDOWN") 254 254 decreaseRating(); 255 else if (action == "SPEEDDOWN") 256 { 257 gPlayer->decSpeed(); 258 showSpeed(); 259 } 260 else if (action == "SPEEDUP") 261 { 262 gPlayer->incSpeed(); 263 showSpeed(); 264 } 255 265 else if (action == "1") 256 266 { 257 267 gPlayer->toggleShuffleMode(); … … 681 691 m_volText->SetText(QString(m_volFormat).arg((int) level)); 682 692 } 683 693 } 694 695 void MiniPlayer::showSpeed(void) 696 { 697 float level = (float)gPlayer->getSpeed(); 698 699 if (m_infoText) 700 { 701 m_infoTimer->stop(); 702 QString msg = tr("Speed: "); 703 QString param; 704 param.sprintf("x%4.2f",level); 705 706 msg += param; 707 708 m_showingInfo = true; 709 m_infoText->SetText(msg); 710 m_infoTimer->start(5000, true); 711 } 712 713 if (class LCD *lcd = LCD::Get()) 714 { 715 // TBD 716 //lcd->switchToVolume("Music"); 717 //lcd->setSpeedFactor(level); 718 } 719 720 } -
mythmusic/mythmusic/musicplayer.h
32 32 void unMute(void) {}; 33 33 void setVolume(void) {}; 34 34 35 void setSpeed(float speed); 36 void incSpeed(); 37 void decSpeed(); 38 float getSpeed() { return m_playSpeed; } 39 35 40 void play(void); 36 41 void stop(bool stopAll = false); 37 42 void pause(void); … … 133 138 ShuffleMode m_shuffleMode; 134 139 RepeatMode m_repeatMode; 135 140 ResumeMode m_resumeMode; 141 142 float m_playSpeed; 136 143 }; 137 144 138 145 // This global variable contains the MusicPlayer instance for the application -
mythmusic/mythmusic/main.cpp
386 386 REG_KEY("Music", "FILTER", "Filter All My Music", "F"); 387 387 REG_KEY("Music", "INCSEARCH", "Show incremental search dialog", "Ctrl+S"); 388 388 REG_KEY("Music", "INCSEARCHNEXT", "Incremental search find next match", "Ctrl+N"); 389 REG_KEY("Music", "SPEEDUP", "Increase Play Speed", "W"); 390 REG_KEY("Music", "SPEEDDOWN", "Decrease Play Speed", "X"); 389 391 390 392 REG_MEDIA_HANDLER("MythMusic Media Handler 1/2", "", "", handleMedia, 391 393 MEDIATYPE_AUDIO | MEDIATYPE_MIXED, QString::null); -
mythmusic/mythmusic/musicplayer.cpp
53 53 m_wasPlaying = true; 54 54 m_updatedLastplay = false; 55 55 56 m_playSpeed = 1.0; 57 56 58 QString playmode = gContext->GetSetting("PlayMode", "none"); 57 59 if (playmode.lower() == "random") 58 60 setShuffleMode(SHUFFLE_RANDOM); … … 803 805 804 806 m_updatedLastplay = true; 805 807 } 808 809 void MusicPlayer::setSpeed(float newspeed) 810 { 811 if (m_output) 812 { 813 m_playSpeed = newspeed; 814 m_output->SetStretchFactor(m_playSpeed); 815 } 816 } 817 818 void MusicPlayer::incSpeed() 819 { 820 m_playSpeed += 0.05; 821 setSpeed(m_playSpeed); 822 } 823 824 void MusicPlayer::decSpeed() 825 { 826 m_playSpeed -= 0.05; 827 setSpeed(m_playSpeed); 828 } -
mythmusic/mythmusic/playbackbox.h
67 67 void visEnable(); 68 68 void bannerDisable(); 69 69 void changeVolume(bool up_or_down); 70 void changeSpeed(bool up_or_down); 70 71 void toggleMute(); 71 72 void resetTimer(); 72 73 void hideVolume(){showVolume(false);} 73 74 void showVolume(bool on_or_off); 75 void showSpeed(bool on_or_off); 74 76 void showProgressBar(); 75 77 void wipeTrackInfo(); 76 78 void toggleFullBlankVisualizer(); … … 191 193 192 194 UIStatusBarType *volume_status; 193 195 UIStatusBarType *progress_bar; 196 UITextType *speed_status; 194 197 195 198 UIPushButtonType *prev_button; 196 199 UIPushButtonType *rew_button; -
mythmusic/mythmusic/miniplayer.h
43 43 void showShuffleMode(void); 44 44 void showRepeatMode(void); 45 45 void showVolume(void); 46 void showSpeed(void); 46 47 47 48 int m_currTime, m_maxTime; 48 49