|
6 | 6 |
|
7 | 7 | #define REST_OF_THE_OWL this->m_songControlsMenu, this |
8 | 8 | #define DEFAULT_FOOTER_TEXT fmt::format("Hi! Menu Loop Randomizer will never resemble Spotify or its distant cousin EditorMusic. Please respect that. :) [Platform: {}]", Utils::getPlatform()) |
9 | | -#define CAN_USE_PLAYBACK_CONTROLS (songManager.getFinishedCalculatingSongLengths() && songManager.getUndefined0Alk1m123TouchPrio() && songManager.getShowPlaybackProgressAndControls()) |
10 | | -#define INCREMENT_DECREMENT_AMOUNT songManager.getIncrementDecrementByMilliseconds() |
11 | 9 |
|
12 | 10 | bool SongControlMenu::setup() { |
13 | 11 | this->setTitle("Menu Loop Randomizer - Control Panel"); |
@@ -353,61 +351,11 @@ void SongControlMenu::onSettingsButton(CCObject*) { |
353 | 351 | } |
354 | 352 |
|
355 | 353 | void SongControlMenu::onSkipBkwdButton(CCObject*) { |
356 | | - SongManager& songManager = SongManager::get(); |
357 | | - if (!CAN_USE_PLAYBACK_CONTROLS || VANILLA_GD_MENU_LOOP_DISABLED) return; |
358 | | - |
359 | | - FMODAudioEngine* fmod = FMODAudioEngine::get(); |
360 | | - const std::string& currSong = songManager.getCurrentSong(); |
361 | | - if (fmod->getActiveMusic(0) != currSong || !songManager.getSongToSongDataEntries().contains(currSong)) return; |
362 | | - |
363 | | - const int fullLength = songManager.getSongToSongDataEntries().find(songManager.getCurrentSong())->second.songLength; |
364 | | - const int lastPosition = songManager.getLastMenuLoopPosition(); |
365 | | - |
366 | | - songManager.setPauseSongPositionTracking(true); |
367 | | - int newPosition = 0; |
368 | | - if ((lastPosition - INCREMENT_DECREMENT_AMOUNT) < 0) { |
369 | | - if (songManager.getConstantShuffleMode()) { |
370 | | - fmod->getActiveMusicChannel(0)->setPosition(newPosition, FMOD_TIMEUNIT_MS); |
371 | | - } else if (fullLength > 0 && fullLength < std::numeric_limits<unsigned int>::max()) { |
372 | | - newPosition = ((((lastPosition % fullLength) + fullLength) % fullLength) - (INCREMENT_DECREMENT_AMOUNT % fullLength) + fullLength) % fullLength; |
373 | | - fmod->getActiveMusicChannel(0)->setPosition(newPosition, FMOD_TIMEUNIT_MS); |
374 | | - } |
375 | | - } else { |
376 | | - newPosition = lastPosition - INCREMENT_DECREMENT_AMOUNT; |
377 | | - fmod->getActiveMusicChannel(0)->setPosition(newPosition, FMOD_TIMEUNIT_MS); |
378 | | - } |
379 | | - songManager.setLastMenuLoopPosition(newPosition); |
380 | | - songManager.setPauseSongPositionTracking(false); |
| 354 | + SongControl::skipBackward(); |
381 | 355 | } |
382 | 356 |
|
383 | 357 | void SongControlMenu::onSkipFwrdButton(CCObject*) { |
384 | | - SongManager& songManager = SongManager::get(); |
385 | | - if (!CAN_USE_PLAYBACK_CONTROLS || VANILLA_GD_MENU_LOOP_DISABLED) return; |
386 | | - |
387 | | - FMODAudioEngine* fmod = FMODAudioEngine::get(); |
388 | | - const std::string& currSong = songManager.getCurrentSong(); |
389 | | - if (fmod->getActiveMusic(0) != currSong || !songManager.getSongToSongDataEntries().contains(currSong)) return; |
390 | | - |
391 | | - const int fullLength = songManager.getSongToSongDataEntries().find(songManager.getCurrentSong())->second.songLength; |
392 | | - const int lastPosition = songManager.getLastMenuLoopPosition(); |
393 | | - |
394 | | - songManager.setPauseSongPositionTracking(true); |
395 | | - int newPosition = 0; |
396 | | - if ((lastPosition + INCREMENT_DECREMENT_AMOUNT) > fullLength) { |
397 | | - if (songManager.getConstantShuffleMode()) { |
398 | | - SongControl::shuffleSong(); |
399 | | - SongControlMenu::updateCurrentLabel(); |
400 | | - songManager.setPauseSongPositionTracking(false); |
401 | | - } else if (fullLength > 0 && fullLength < std::numeric_limits<unsigned int>::max()) { |
402 | | - newPosition = ((((lastPosition % fullLength) + fullLength) % fullLength) + (INCREMENT_DECREMENT_AMOUNT % fullLength)) % fullLength; |
403 | | - fmod->getActiveMusicChannel(0)->setPosition(newPosition, FMOD_TIMEUNIT_MS); |
404 | | - } |
405 | | - } else { |
406 | | - newPosition = lastPosition + INCREMENT_DECREMENT_AMOUNT; |
407 | | - fmod->getActiveMusicChannel(0)->setPosition(newPosition, FMOD_TIMEUNIT_MS); |
408 | | - } |
409 | | - songManager.setLastMenuLoopPosition(newPosition); |
410 | | - songManager.setPauseSongPositionTracking(false); |
| 358 | + SongControl::skipForward(); |
411 | 359 | } |
412 | 360 |
|
413 | 361 | void SongControlMenu::updateCurrentLabel() { |
|
0 commit comments