mirror of https://github.com/stella-emu/stella.git
Tuning.
This commit is contained in:
parent
cb89d09c7f
commit
803b85343a
|
@ -219,6 +219,18 @@ void SoundSDL2::adjustVolume(Int8 direction)
|
|||
myOSystem.frameBuffer().showMessage(message);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 SoundSDL2::getFragmentSize() const
|
||||
{
|
||||
return myHardwareSpec.size;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 SoundSDL2::getSampleRate() const
|
||||
{
|
||||
return myHardwareSpec.freq;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundSDL2::processFragment(Int16* stream, uInt32 length)
|
||||
{
|
||||
|
|
|
@ -96,6 +96,10 @@ class SoundSDL2 : public Sound
|
|||
*/
|
||||
void adjustVolume(Int8 direction) override;
|
||||
|
||||
uInt32 getFragmentSize() const override;
|
||||
|
||||
uInt32 getSampleRate() const override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
Invoked by the sound callback to process the next sound fragment.
|
||||
|
|
|
@ -72,7 +72,6 @@
|
|||
|
||||
namespace {
|
||||
constexpr uInt8 YSTART_EXTRA = 2;
|
||||
constexpr uInt8 AUDIO_QUEUE_CAPACITY_FRAGMENTS = 30;
|
||||
constexpr uInt8 AUDIO_QUEUE_HALF_FRAMES_PER_FRAGMENT = 1;
|
||||
}
|
||||
|
||||
|
@ -722,9 +721,11 @@ void Console::createAudioQueue()
|
|||
throw runtime_error("invalid console timing");
|
||||
}
|
||||
|
||||
uInt32 queueSize = (2 * myOSystem.sound().getFragmentSize() * sampleRate) / (myOSystem.sound().getSampleRate() * fragmentSize);
|
||||
|
||||
myAudioQueue = make_shared<AudioQueue>(
|
||||
fragmentSize,
|
||||
AUDIO_QUEUE_CAPACITY_FRAGMENTS,
|
||||
queueSize > 0 ? queueSize : 1,
|
||||
myProperties.get(Cartridge_Sound) == "STEREO",
|
||||
sampleRate
|
||||
);
|
||||
|
|
|
@ -600,7 +600,7 @@ void OSystem::mainLoop()
|
|||
virtualTime += duration_cast<high_resolution_clock::duration>(timeslice);
|
||||
time_point<high_resolution_clock> now = high_resolution_clock::now();
|
||||
|
||||
if (duration_cast<duration<double>>(now - virtualTime).count() > 0.5)
|
||||
if (duration_cast<duration<double>>(now - virtualTime).count() > 0)
|
||||
virtualTime = now;
|
||||
else if (virtualTime > now) {
|
||||
if (busyWait && cycles >= 0) {
|
||||
|
|
|
@ -66,6 +66,16 @@ class Sound
|
|||
*/
|
||||
virtual void mute(bool state) = 0;
|
||||
|
||||
/**
|
||||
Get the fragment size.
|
||||
*/
|
||||
virtual uInt32 getFragmentSize() const = 0;
|
||||
|
||||
/**
|
||||
Get the sample rate.
|
||||
*/
|
||||
virtual uInt32 getSampleRate() const = 0;
|
||||
|
||||
/**
|
||||
Reset the sound device.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue