mirror of https://github.com/stella-emu/stella.git
disable audio sample saving when TimeMachine is disabled (fixes #835)
This commit is contained in:
parent
f50c080b35
commit
6e49d1fe12
|
@ -49,6 +49,7 @@
|
|||
#include "SaveKey.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "Sound.hxx"
|
||||
#include "StateManager.hxx"
|
||||
#include "Switches.hxx"
|
||||
#include "System.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
|
@ -659,6 +660,7 @@ void Console::initializeAudio()
|
|||
|
||||
createAudioQueue();
|
||||
myTIA->setAudioQueue(myAudioQueue);
|
||||
myTIA->setAudioRewindMode(myOSystem.state().mode() != StateManager::Mode::Off);
|
||||
|
||||
myOSystem.sound().open(myAudioQueue, &myEmulationTiming);
|
||||
}
|
||||
|
|
|
@ -1850,7 +1850,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
return;
|
||||
|
||||
case Event::ToggleTimeMachine:
|
||||
if (pressed && !repeated) myOSystem.state().toggleTimeMachine();
|
||||
if (pressed && !repeated) myOSystem.toggleTimeMachine();
|
||||
return;
|
||||
|
||||
#ifdef PNG_SUPPORT
|
||||
|
|
|
@ -596,6 +596,13 @@ string OSystem::getROMInfo(const FilesystemNode& romfile)
|
|||
return getROMInfo(*console);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::toggleTimeMachine()
|
||||
{
|
||||
myStateManager->toggleTimeMachine();
|
||||
myConsole->tia().setAudioRewindMode(myStateManager->mode() != StateManager::Mode::Off);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::resetFps()
|
||||
{
|
||||
|
|
|
@ -388,6 +388,13 @@ class OSystem
|
|||
*/
|
||||
string getROMInfo(const FilesystemNode& romfile);
|
||||
|
||||
/**
|
||||
Toggle state rewind recording mode; this uses the RewindManager
|
||||
for its functionality. Also makes sure that audio samples are
|
||||
only saved if the recording mode is enabled.
|
||||
*/
|
||||
void toggleTimeMachine();
|
||||
|
||||
/**
|
||||
The features which are conditionally compiled into Stella.
|
||||
|
||||
|
|
|
@ -88,7 +88,8 @@ void Audio::phase1()
|
|||
|
||||
addSample(sample0, sample1);
|
||||
#ifdef GUI_SUPPORT
|
||||
mySamples.push_back(sample0 | (sample1 << 4));
|
||||
if(myRewindMode)
|
||||
mySamples.push_back(sample0 | (sample1 << 4));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,17 @@ class Audio : public Serializable
|
|||
|
||||
void setAudioQueue(const shared_ptr<AudioQueue>& queue);
|
||||
|
||||
/**
|
||||
Enable/disable pushing audio samples. These are required for TimeMachine
|
||||
playback with sound.
|
||||
*/
|
||||
void setAudioRewindMode(bool enable)
|
||||
{
|
||||
#ifdef GUI_SUPPORT
|
||||
myRewindMode = enable;
|
||||
#endif
|
||||
}
|
||||
|
||||
void tick();
|
||||
|
||||
AudioChannel& channel0();
|
||||
|
@ -63,6 +74,7 @@ class Audio : public Serializable
|
|||
Int16* myCurrentFragment{nullptr};
|
||||
uInt32 mySampleIndex{0};
|
||||
#ifdef GUI_SUPPORT
|
||||
bool myRewindMode{false};
|
||||
mutable ByteArray mySamples;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -113,6 +113,12 @@ void TIA::setAudioQueue(const shared_ptr<AudioQueue>& queue)
|
|||
myAudio.setAudioQueue(queue);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIA::setAudioRewindMode(bool enable)
|
||||
{
|
||||
myAudio.setAudioRewindMode(enable);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIA::clearFrameManager()
|
||||
{
|
||||
|
|
|
@ -131,6 +131,12 @@ class TIA : public Device
|
|||
*/
|
||||
void setAudioQueue(const shared_ptr<AudioQueue>& audioQueue);
|
||||
|
||||
/**
|
||||
Enable/disable pushing audio samples. These are required for TimeMachine
|
||||
playback with sound.
|
||||
*/
|
||||
void setAudioRewindMode(bool enable);
|
||||
|
||||
/**
|
||||
Clear the configured frame manager and deteach the lifecycle callbacks.
|
||||
*/
|
||||
|
|
|
@ -189,7 +189,7 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
|
||||
case kTimeMachineCmd:
|
||||
instance().eventHandler().leaveMenuMode();
|
||||
instance().state().toggleTimeMachine();
|
||||
instance().toggleTimeMachine();
|
||||
break;
|
||||
|
||||
case kExitCmd:
|
||||
|
|
|
@ -418,7 +418,7 @@ void TimeMachineDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
}
|
||||
|
||||
case kToggle:
|
||||
instance().state().toggleTimeMachine();
|
||||
instance().toggleTimeMachine();
|
||||
handleToggle();
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue