mirror of
https://github.com/libretro/gambatte-libretro.git
synced 2024-11-23 07:49:48 +00:00
Don't bother allowing sources the choice of which output sample rates are selecrable,
as it's not really a per source thing at this point. If resampling avoidance is desired, then that should rather be a user option (to depend on the OS for resampling, which is mostly nonsensical for the Game Boy/NES/PSG-system case btw). git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@176 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
This commit is contained in:
parent
f4b56a9214
commit
14918d577f
@ -44,18 +44,6 @@ const std::vector<MediaSource::VideoSourceInfo> GambatteSource::generateVideoSou
|
||||
return v;
|
||||
}
|
||||
|
||||
const MediaSource::SampleRateInfo GambatteSource::generateSampleRateInfo() {
|
||||
SampleRateInfo srinfo;
|
||||
|
||||
srinfo.rates.push_back(48000);
|
||||
srinfo.rates.push_back(44100);
|
||||
srinfo.defaultRateIndex = 0;
|
||||
srinfo.minCustomRate = 8000;
|
||||
srinfo.maxCustomRate = 192000;
|
||||
|
||||
return srinfo;
|
||||
}
|
||||
|
||||
enum {
|
||||
UP_BUTTON, DOWN_BUTTON, LEFT_BUTTON, RIGHT_BUTTON,
|
||||
A_BUTTON, B_BUTTON, START_BUTTON, SELECT_BUTTON,
|
||||
|
@ -54,7 +54,6 @@ public:
|
||||
|
||||
static const std::vector<ButtonInfo> generateButtonInfos();
|
||||
const std::vector<MediaSource::VideoSourceInfo> generateVideoSourceInfos();
|
||||
static const SampleRateInfo generateSampleRateInfo();
|
||||
|
||||
void emitBlit() { emit blit(); }
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Sindre Aamås *
|
||||
* Copyright (C) 2007 by Sindre Aam<EFBFBD>s *
|
||||
* aamas@stud.ntnu.no *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -33,8 +33,7 @@ int main(int argc, char *argv[]) {
|
||||
source.generateButtonInfos(),
|
||||
source.generateVideoSourceInfos(),
|
||||
MainWindow::tr("Video filter:"),
|
||||
QSize(160, 144),
|
||||
source.generateSampleRateInfo());
|
||||
QSize(160, 144));
|
||||
GambatteMenuHandler mh(mw, &source, argc, argv);
|
||||
mw->show();
|
||||
return app.exec();
|
||||
|
@ -132,8 +132,7 @@ MainWindow::MainWindow(MediaSource *source,
|
||||
const std::vector<MediaSource::ButtonInfo> &buttonInfos,
|
||||
const std::vector<MediaSource::VideoSourceInfo> &videoSourceInfos,
|
||||
const QString &videoSourceLabel,
|
||||
const QSize &aspectRatio,
|
||||
const MediaSource::SampleRateInfo &sampleRateInfo) :
|
||||
const QSize &aspectRatio) :
|
||||
source(source),
|
||||
buttonHandlers(buttonInfos.size(), ButtonHandler(0, 0)),
|
||||
blitter(NULL),
|
||||
@ -170,7 +169,7 @@ MainWindow::MainWindow(MediaSource *source,
|
||||
|
||||
addAudioEngines(audioEngines, winId());
|
||||
audioEngines.push_back(new NullAudioEngine);
|
||||
soundDialog = new SoundDialog(audioEngines, sampleRateInfo, this);
|
||||
soundDialog = new SoundDialog(audioEngines, this);
|
||||
connect(soundDialog, SIGNAL(accepted()), this, SLOT(soundSettingsChange()));
|
||||
|
||||
inputDialog = new InputDialog(buttonInfos, this);
|
||||
@ -445,10 +444,6 @@ void MainWindow::setAspectRatio(const QSize &aspectRatio) {
|
||||
videoDialog->setAspectRatio(aspectRatio);
|
||||
}
|
||||
|
||||
void MainWindow::setSampleRates(const MediaSource::SampleRateInfo &sampleRateInfo) {
|
||||
soundDialog->setRates(sampleRateInfo);
|
||||
}
|
||||
|
||||
void MainWindow::setVideoSources(const std::vector<MediaSource::VideoSourceInfo> &sourceInfos) {
|
||||
videoDialog->setVideoSources(sourceInfos);
|
||||
}
|
||||
|
@ -166,16 +166,12 @@ public:
|
||||
* listed are multiples of the base size. Use bigger width and height values
|
||||
* to get fewer window sizes listed. Can be changed later with the setAspectRatio
|
||||
* method.
|
||||
*
|
||||
* @param sampleRateInfo Information about sample rates selectable in the sound dialog.
|
||||
* Can be changed later with the setSampleRates method.
|
||||
*/
|
||||
MainWindow(MediaSource *source,
|
||||
const std::vector<MediaSource::ButtonInfo> &buttonInfos,
|
||||
const std::vector<MediaSource::VideoSourceInfo> &videoSourceInfos,
|
||||
const QString &videoSourceLabel,
|
||||
const QSize &aspectRatio,
|
||||
const MediaSource::SampleRateInfo &sampleRateInfo);
|
||||
const QSize &aspectRatio);
|
||||
|
||||
~MainWindow();
|
||||
const QSize& aspectRatio() const;
|
||||
@ -209,7 +205,6 @@ public:
|
||||
* from MainWindow, and unpaused when the dialog is closed. pauseOnDialogExec is on by default.
|
||||
*/
|
||||
void setPauseOnDialogExec(bool enable) { pauseOnDialogExec = enable; }
|
||||
void setSampleRates(const MediaSource::SampleRateInfo &sampleRateInfo);
|
||||
void setVideoSources(const std::vector<MediaSource::VideoSourceInfo> &sourceInfos);
|
||||
|
||||
/**
|
||||
|
@ -77,21 +77,6 @@ public:
|
||||
int defaultAltKey;
|
||||
};
|
||||
|
||||
struct SampleRateInfo {
|
||||
enum { NOT_SUPPORTED = -1 };
|
||||
|
||||
// Distinct sample rate (stereo samples per second) alternatives selectable in the sound settings dialog.
|
||||
std::vector<int> rates;
|
||||
|
||||
// The index of the rate in the rates list to be selected by default.
|
||||
std::size_t defaultRateIndex;
|
||||
|
||||
// Minimum and maximum custom sample rates selectable in the sound settings dialog.
|
||||
// Set to NOT_SUPPORTED if you don't want to allow custom sample rates.
|
||||
int minCustomRate;
|
||||
int maxCustomRate;
|
||||
};
|
||||
|
||||
const unsigned overupdate;
|
||||
|
||||
/**
|
||||
|
@ -31,6 +31,33 @@
|
||||
|
||||
#include "audioengine.h"
|
||||
|
||||
struct SampleRateInfo {
|
||||
enum { NOT_SUPPORTED = -1 };
|
||||
|
||||
// Distinct sample rate (stereo samples per second) alternatives selectable in the sound settings dialog.
|
||||
std::vector<int> rates;
|
||||
|
||||
// The index of the rate in the rates list to be selected by default.
|
||||
std::size_t defaultRateIndex;
|
||||
|
||||
// Minimum and maximum custom sample rates selectable in the sound settings dialog.
|
||||
// Set to NOT_SUPPORTED if you don't want to allow custom sample rates.
|
||||
int minCustomRate;
|
||||
int maxCustomRate;
|
||||
};
|
||||
|
||||
static SampleRateInfo generateSampleRateInfo() {
|
||||
SampleRateInfo srinfo;
|
||||
|
||||
srinfo.rates.push_back(48000);
|
||||
srinfo.rates.push_back(44100);
|
||||
srinfo.defaultRateIndex = 0;
|
||||
srinfo.minCustomRate = 8000;
|
||||
srinfo.maxCustomRate = 192000;
|
||||
|
||||
return srinfo;
|
||||
}
|
||||
|
||||
static int filterValue(const int value, const int upper, const int lower = 0, const int fallback = 0) {
|
||||
if (value >= upper || value < lower)
|
||||
return fallback;
|
||||
@ -38,7 +65,7 @@ static int filterValue(const int value, const int upper, const int lower = 0, co
|
||||
return value;
|
||||
}
|
||||
|
||||
static void populateRateSelector(QComboBox *rateSelector, const MediaSource::SampleRateInfo &rateInfo) {
|
||||
static void populateRateSelector(QComboBox *rateSelector, const SampleRateInfo &rateInfo) {
|
||||
assert(!rateInfo.rates.empty());
|
||||
assert(rateInfo.defaultRateIndex < rateInfo.rates.size());
|
||||
|
||||
@ -78,7 +105,7 @@ static void setRate(QComboBox *rateSelector, const int r) {
|
||||
rateSelector->setCurrentIndex(newIndex);
|
||||
}
|
||||
|
||||
SoundDialog::SoundDialog(const std::vector<AudioEngine*> &engines, const MediaSource::SampleRateInfo &rateInfo, QWidget *parent) :
|
||||
SoundDialog::SoundDialog(const std::vector<AudioEngine*> &engines, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
engines(engines),
|
||||
topLayout(new QVBoxLayout),
|
||||
@ -122,7 +149,7 @@ SoundDialog::SoundDialog(const std::vector<AudioEngine*> &engines, const MediaSo
|
||||
QHBoxLayout *const hLayout = new QHBoxLayout;
|
||||
hLayout->addWidget(new QLabel(tr("Sample rate:")));
|
||||
|
||||
populateRateSelector(rateSelector, rateInfo);
|
||||
populateRateSelector(rateSelector, generateSampleRateInfo());
|
||||
|
||||
hLayout->addWidget(rateSelector);
|
||||
topLayout->addLayout(hLayout);
|
||||
@ -229,17 +256,6 @@ void SoundDialog::restore() {
|
||||
latencySelector->setValue(latency);
|
||||
}
|
||||
|
||||
void SoundDialog::setRates(const MediaSource::SampleRateInfo &rateInfo) {
|
||||
restore();
|
||||
|
||||
rateSelector->clear();
|
||||
populateRateSelector(rateSelector, rateInfo);
|
||||
setRate(rateSelector, rate);
|
||||
|
||||
store();
|
||||
emit accepted();
|
||||
}
|
||||
|
||||
void SoundDialog::accept() {
|
||||
store();
|
||||
QDialog::accept();
|
||||
|
@ -51,13 +51,12 @@ private slots:
|
||||
void rateIndexChange(int index);
|
||||
|
||||
public:
|
||||
SoundDialog(const std::vector<AudioEngine*> &engines, const MediaSource::SampleRateInfo &rateInfo, QWidget *parent = 0);
|
||||
SoundDialog(const std::vector<AudioEngine*> &engines, QWidget *parent = 0);
|
||||
~SoundDialog();
|
||||
int getEngineIndex() const { return engineIndex; }
|
||||
int getResamplerNum() const { return resamplerNum; }
|
||||
int getRate() const { return rate; }
|
||||
int getLatency() const { return latency; };
|
||||
void setRates(const MediaSource::SampleRateInfo &rateInfo);
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
|
Loading…
Reference in New Issue
Block a user