mirror of https://github.com/stella-emu/stella.git
Rework available sampling rates (44100, 44800, 96000), add resampling.quality parameter.
This commit is contained in:
parent
1b0fb381d0
commit
2da0ffa2f5
|
@ -1,9 +1,9 @@
|
|||
# Missing features
|
||||
|
||||
* Reimplement target FPS mode
|
||||
* Implement Lanzcos resampling
|
||||
* Fixup OpenGL sync, ensure that FB only rerenders after a frame has been generated
|
||||
|
||||
# Cleanup
|
||||
|
||||
* Remove or turn sterr output into log messages
|
||||
* Document EmulationTiming
|
||||
|
|
|
@ -246,12 +246,30 @@ void SoundSDL2::initResampler()
|
|||
return nextFragment;
|
||||
};
|
||||
|
||||
myResampler = make_unique<LanczosResampler>(
|
||||
Resampler::Format(myAudioQueue->sampleRate(), myAudioQueue->fragmentSize(), myAudioQueue->isStereo()),
|
||||
Resampler::Format(myHardwareSpec.freq, myHardwareSpec.samples, myHardwareSpec.channels > 1),
|
||||
nextFragmentCallback,
|
||||
2
|
||||
);
|
||||
Resampler::Format formatFrom =
|
||||
Resampler::Format(myAudioQueue->sampleRate(), myAudioQueue->fragmentSize(), myAudioQueue->isStereo());
|
||||
Resampler::Format formatTo =
|
||||
Resampler::Format(myHardwareSpec.freq, myHardwareSpec.samples, myHardwareSpec.channels > 1);
|
||||
|
||||
int quality = myOSystem.settings().getInt("resampling.quality");
|
||||
|
||||
switch (quality) {
|
||||
case 1:
|
||||
myResampler = make_unique<SimpleResampler>(formatFrom, formatTo, nextFragmentCallback);
|
||||
(cerr << "resampling quality 1: using nearest neighbor resampling\n").flush();
|
||||
break;
|
||||
|
||||
default:
|
||||
case 2:
|
||||
(cerr << "resampling quality 2: using nearest Lanczos resampling, a = 2\n").flush();
|
||||
myResampler = make_unique<LanczosResampler>(formatFrom, formatTo, nextFragmentCallback, 2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
(cerr << "resampling quality 3: using nearest Lanczos resampling, a = 3\n").flush();
|
||||
myResampler = make_unique<LanczosResampler>(formatFrom, formatTo, nextFragmentCallback, 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -71,8 +71,9 @@ Settings::Settings(OSystem& osystem)
|
|||
// Sound options
|
||||
setInternal("sound", "true");
|
||||
setInternal("fragsize", "512");
|
||||
setInternal("freq", "31400");
|
||||
setInternal("freq", "44100");
|
||||
setInternal("volume", "100");
|
||||
setInternal("resampling.quality", "2");
|
||||
|
||||
// Input event options
|
||||
setInternal("keymap", "");
|
||||
|
@ -362,8 +363,10 @@ void Settings::validate()
|
|||
i = getInt("volume");
|
||||
if(i < 0 || i > 100) setInternal("volume", "100");
|
||||
i = getInt("freq");
|
||||
if(!(i == 11025 || i == 22050 || i == 31400 || i == 44100 || i == 48000))
|
||||
setInternal("freq", "31400");
|
||||
if(!(i == 44100 || i == 48000 || i == 96000))
|
||||
setInternal("freq", "44100");
|
||||
i = getInt("resampling.quality");
|
||||
if (i < 1 || i > 3) setInternal("resampling.quality", 2);
|
||||
#endif
|
||||
|
||||
i = getInt("joydeadzone");
|
||||
|
@ -443,10 +446,11 @@ void Settings::usage() const
|
|||
<< " -uimessages <1|0> Show onscreen UI messages for different events\n"
|
||||
<< endl
|
||||
#ifdef SOUND_SUPPORT
|
||||
<< " -sound <1|0> Enable sound generation\n"
|
||||
<< " -fragsize <number> The size of sound fragments (must be a power of two)\n"
|
||||
<< " -freq <number> Set sound sample output frequency (11025|22050|31400|44100|48000)\n"
|
||||
<< " -volume <number> Set the volume (0 - 100)\n"
|
||||
<< " -sound <1|0> Enable sound generation\n"
|
||||
<< " -fragsize <number> The size of sound fragments (must be a power of two)\n"
|
||||
<< " -freq <number> Set sound sample output frequency (44100|48000|96000)\n"
|
||||
<< " -resampling.quality <number> Resampling quality (1 -3), default: 2\n"
|
||||
<< " -volume <number> Set the volume (0 - 100)\n"
|
||||
<< endl
|
||||
#endif
|
||||
<< " -tia.zoom <zoom> Use the specified zoom level (windowed mode) for TIA image\n"
|
||||
|
|
|
@ -85,11 +85,9 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
|
|||
|
||||
// Output frequency
|
||||
items.clear();
|
||||
VarList::push_back(items, "11025 Hz", "11025");
|
||||
VarList::push_back(items, "22050 Hz", "22050");
|
||||
VarList::push_back(items, "31400 Hz", "31400");
|
||||
VarList::push_back(items, "44100 Hz", "44100");
|
||||
VarList::push_back(items, "48000 Hz", "48000");
|
||||
VarList::push_back(items, "96000 Hz", "96000");
|
||||
myFreqPopup = new PopUpWidget(this, font, xpos, ypos,
|
||||
pwidth, lineHeight,
|
||||
items, "Frequency (*) ", lwidth);
|
||||
|
|
Loading…
Reference in New Issue