This commit is contained in:
thrust26 2020-10-23 19:46:17 +02:00
commit 4bc6d35192
5 changed files with 21 additions and 77 deletions

View File

@ -24,17 +24,14 @@ class OSystem;
#include "FBBackend.hxx"
/**
This class implements a standard LIBRETRO backend. Most of the
functionality is not used, since libretro has its own rendering system.
This class implements a standard LIBRETRO framebuffer backend. Most of
the functionality is not used, since libretro has its own rendering system.
@author Stephen Anthony
*/
class FBBackendLIBRETRO : public FBBackend
{
public:
/**
Creates a new LIBRETRO framebuffer.
*/
explicit FBBackendLIBRETRO(OSystem&) { }
~FBBackendLIBRETRO() override { }

View File

@ -22,7 +22,7 @@
#include "FBSurface.hxx"
/**
An FBSurface suitable for the LIBRETRO Render2D API. As with FBBackend,
An FBSurface suitable for the LIBRETRO API. As with FBBackend,
most of the functionality here is handled by libretro directly.
@author Stephen Anthony

View File

@ -31,15 +31,10 @@
#include "AudioQueue.hxx"
#include "EmulationTiming.hxx"
#include "AudioSettings.hxx"
#include "StaggeredLogger.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundLIBRETRO::SoundLIBRETRO(OSystem& osystem, AudioSettings& audioSettings)
: Sound(osystem),
myIsInitializedFlag(false),
myEmulationTiming(nullptr),
myCurrentFragment(nullptr),
myUnderrun(false),
myAudioSettings(audioSettings)
{
Logger::debug("SoundLIBRETRO::SoundLIBRETRO started ...");
@ -99,7 +94,6 @@ void SoundLIBRETRO::dequeue(Int16* stream, uInt32* samples)
myCurrentFragment = nextFragment;
for (uInt32 i = 0; i < myAudioQueue->fragmentSize(); ++i)
{
Int16 sampleL, sampleR;
@ -120,9 +114,4 @@ void SoundLIBRETRO::dequeue(Int16* stream, uInt32* samples)
*samples = outIndex / 2;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundLIBRETRO::queryHardware(VariantList& devices)
{
}
#endif // SOUND_SUPPORT

View File

@ -44,18 +44,12 @@ class SoundLIBRETRO : public Sound
~SoundLIBRETRO() override;
public:
/**
Enables/disables the sound subsystem.
@param enable Either true or false, to enable or disable the sound system
*/
void setEnabled(bool enable) override { }
/**
Initializes the sound device. This must be called before any
calls are made to derived methods.
*/
void open(shared_ptr<AudioQueue> audioQueue, EmulationTiming* emulationTiming) override;
void open(shared_ptr<AudioQueue> audioQueue,
EmulationTiming* emulationTiming) override;
/**
Should be called to close the sound device. Once called the sound
@ -63,43 +57,6 @@ class SoundLIBRETRO : public Sound
*/
void close() override;
/**
Set the mute state of the sound object. While muted no sound is played.
@param state Mutes sound if true, unmute if false
@return The previous (old) mute state
*/
bool mute(bool state) override { return !myIsInitializedFlag; }
/**
Toggles the sound mute state. While muted no sound is played.
@return The previous (old) mute state
*/
bool toggleMute() override { return !myIsInitializedFlag; }
/**
Sets the volume of the sound device to the specified level. The
volume is given as a percentage from 0 to 100. Values outside
this range indicate that the volume shouldn't be changed at all.
@param percent The new volume percentage level for the sound device
*/
void setVolume(uInt32 percent) override { }
/**
Adjusts the volume of the sound device based on the given direction.
@param direction +1 indicates increase, -1 indicates decrease.
*/
void adjustVolume(int direction = +1) override { }
/**
This method is called to provide information about the sound device.
*/
string about() const override { return ""; }
/**
Empties the playback buffer.
@ -109,23 +66,29 @@ class SoundLIBRETRO : public Sound
void dequeue(Int16* stream, uInt32* samples);
protected:
/**
This method is called to query the audio devices.
//////////////////////////////////////////////////////////////////////
// Most methods here aren't used at all. See Sound class for
// description, if needed.
//////////////////////////////////////////////////////////////////////
@param devices List of device names
*/
void queryHardware(VariantList& devices) override;
void setEnabled(bool enable) override { }
void queryHardware(VariantList& devices) override { }
void setVolume(uInt32 percent) override { }
void adjustVolume(int direction = +1) override { }
bool mute(bool state) override { return !myIsInitializedFlag; }
bool toggleMute() override { return !myIsInitializedFlag; }
string about() const override { return ""; }
private:
// Indicates if the sound device was successfully initialized
bool myIsInitializedFlag;
bool myIsInitializedFlag{false};
shared_ptr<AudioQueue> myAudioQueue;
EmulationTiming* myEmulationTiming;
EmulationTiming* myEmulationTiming{nullptr};
Int16* myCurrentFragment;
bool myUnderrun;
Int16* myCurrentFragment{nullptr};
bool myUnderrun{false};
AudioSettings& myAudioSettings;

View File

@ -297,12 +297,7 @@ void* StellaLIBRETRO::getVideoBuffer() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StellaLIBRETRO::getVideoNTSC() const
{
const ConsoleInfo& console_info = myOSystem->console().about();
string format = console_info.DisplayFormat;
return (format == "NTSC") || (format == "NTSC*") ||
(format == "PAL60") || (format == "PAL60*") ||
(format == "SECAM60") || (format == "SECAM60*");
return myOSystem->console().gameRefreshRate() == 60;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -