2018-07-31 02:23:12 +00:00
|
|
|
struct Audio;
|
|
|
|
|
|
|
|
struct AudioDriver {
|
|
|
|
AudioDriver(Audio& super) : super(super) {}
|
|
|
|
virtual ~AudioDriver() = default;
|
|
|
|
|
|
|
|
virtual auto create() -> bool { return true; }
|
Update to 20180731 release.
byuu says:
I've completed moving all the class objects from `unique_pointer<T>` to
just T. The one exception is the Emulator::Interface instance. I can
absolutely make that a global object, but only in bsnes where there's
just the one emulation core.
I also moved all the SettingsWindow and ToolsWindow panels out to their
own global objects, and fixed a very difficult bug with GTK TabFrame
controls.
The configuration settings panel is now the emulator settings panel. And
I added some spacing between bold label sections on both the emulator
and driver settings panels.
I gave fixing ComboButtonItem my best shot, given I can't reproduce the
crash. Probably won't work, though.
Also made a very slight consistency improvement to ruby and renamed
driverName() to driver().
...
An important change ... as a result of moving bsnes to global objects,
this means that the constructors for all windows run before the
presentation window is displayed. Before this change, only the
presentation window was constructed first berore displaying it, followed
by the construction of the rest of the GUI windows.
The upside to this is that as soon as you see the main window, the GUI
is ready to go without a period where it's unresponsive.
The downside to this is it takes about 1.5 seconds to show the main
window, compared to around 0.75 seconds before.
I've no intention of changing that back. So if the startup time becomes
a problem, then we'll just have to work on optimizing hiro, so that it
can construct all the global Window objects quicker. The main way to do
that would be to not do calls to the Layout::setGeometry functions for
every widget added, and instead wait until the window is displayed. But
I don't have an easy way to do that, because you want the widget
geometry values to be sane even before the window is visible to help
size certain things.
2018-07-31 10:56:45 +00:00
|
|
|
virtual auto driver() -> string { return "None"; }
|
2018-07-31 02:23:12 +00:00
|
|
|
virtual auto ready() -> bool { return true; }
|
|
|
|
|
|
|
|
virtual auto hasExclusive() -> bool { return false; }
|
|
|
|
virtual auto hasContext() -> bool { return false; }
|
|
|
|
virtual auto hasDevices() -> vector<string> { return {"Default"}; }
|
|
|
|
virtual auto hasBlocking() -> bool { return false; }
|
|
|
|
virtual auto hasDynamic() -> bool { return false; }
|
2018-08-01 09:07:28 +00:00
|
|
|
virtual auto hasChannels() -> vector<uint> { return {2}; }
|
|
|
|
virtual auto hasFrequencies() -> vector<uint> { return {48000}; }
|
2018-07-31 02:23:12 +00:00
|
|
|
virtual auto hasLatencies() -> vector<uint> { return {0}; }
|
|
|
|
|
|
|
|
auto hasDevice(string device) -> bool { return (bool)hasDevices().find(device); }
|
|
|
|
auto hasChannels(uint channels) -> bool { return (bool)hasChannels().find(channels); }
|
|
|
|
auto hasFrequency(uint frequency) -> bool { return (bool)hasFrequencies().find(frequency); }
|
|
|
|
auto hasLatency(uint latency) -> bool { return (bool)hasLatencies().find(latency); }
|
|
|
|
|
|
|
|
virtual auto setExclusive(bool exclusive) -> bool { return true; }
|
|
|
|
virtual auto setContext(uintptr context) -> bool { return true; }
|
|
|
|
virtual auto setDevice(string device) -> bool { return true; }
|
|
|
|
virtual auto setBlocking(bool blocking) -> bool { return true; }
|
|
|
|
virtual auto setDynamic(bool dynamic) -> bool { return true; }
|
|
|
|
virtual auto setChannels(uint channels) -> bool { return true; }
|
|
|
|
virtual auto setFrequency(uint frequency) -> bool { return true; }
|
|
|
|
virtual auto setLatency(uint latency) -> bool { return true; }
|
|
|
|
|
|
|
|
virtual auto clear() -> void {}
|
|
|
|
virtual auto level() -> double { return 0.5; }
|
|
|
|
virtual auto output(const double samples[]) -> void {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Audio& super;
|
|
|
|
friend class Audio;
|
|
|
|
|
|
|
|
bool exclusive = false;
|
|
|
|
uintptr context = 0;
|
|
|
|
string device = "Default";
|
|
|
|
bool blocking = false;
|
|
|
|
bool dynamic = false;
|
2018-08-01 09:07:28 +00:00
|
|
|
uint channels = 2;
|
|
|
|
uint frequency = 48000;
|
2018-07-31 02:23:12 +00:00
|
|
|
uint latency = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Audio {
|
|
|
|
static auto hasDrivers() -> vector<string>;
|
|
|
|
static auto hasDriver(string driver) -> bool { return (bool)hasDrivers().find(driver); }
|
|
|
|
static auto optimalDriver() -> string;
|
|
|
|
static auto safestDriver() -> string;
|
|
|
|
|
Update to 20180731 release.
byuu says:
I've completed moving all the class objects from `unique_pointer<T>` to
just T. The one exception is the Emulator::Interface instance. I can
absolutely make that a global object, but only in bsnes where there's
just the one emulation core.
I also moved all the SettingsWindow and ToolsWindow panels out to their
own global objects, and fixed a very difficult bug with GTK TabFrame
controls.
The configuration settings panel is now the emulator settings panel. And
I added some spacing between bold label sections on both the emulator
and driver settings panels.
I gave fixing ComboButtonItem my best shot, given I can't reproduce the
crash. Probably won't work, though.
Also made a very slight consistency improvement to ruby and renamed
driverName() to driver().
...
An important change ... as a result of moving bsnes to global objects,
this means that the constructors for all windows run before the
presentation window is displayed. Before this change, only the
presentation window was constructed first berore displaying it, followed
by the construction of the rest of the GUI windows.
The upside to this is that as soon as you see the main window, the GUI
is ready to go without a period where it's unresponsive.
The downside to this is it takes about 1.5 seconds to show the main
window, compared to around 0.75 seconds before.
I've no intention of changing that back. So if the startup time becomes
a problem, then we'll just have to work on optimizing hiro, so that it
can construct all the global Window objects quicker. The main way to do
that would be to not do calls to the Layout::setGeometry functions for
every widget added, and instead wait until the window is displayed. But
I don't have an easy way to do that, because you want the widget
geometry values to be sane even before the window is visible to help
size certain things.
2018-07-31 10:56:45 +00:00
|
|
|
Audio() : self(*this) { reset(); }
|
|
|
|
explicit operator bool() { return instance->driver() != "None"; }
|
|
|
|
auto reset() -> void { instance = new AudioDriver(*this); }
|
2018-07-31 02:23:12 +00:00
|
|
|
auto create(string driver = "") -> bool;
|
Update to 20180731 release.
byuu says:
I've completed moving all the class objects from `unique_pointer<T>` to
just T. The one exception is the Emulator::Interface instance. I can
absolutely make that a global object, but only in bsnes where there's
just the one emulation core.
I also moved all the SettingsWindow and ToolsWindow panels out to their
own global objects, and fixed a very difficult bug with GTK TabFrame
controls.
The configuration settings panel is now the emulator settings panel. And
I added some spacing between bold label sections on both the emulator
and driver settings panels.
I gave fixing ComboButtonItem my best shot, given I can't reproduce the
crash. Probably won't work, though.
Also made a very slight consistency improvement to ruby and renamed
driverName() to driver().
...
An important change ... as a result of moving bsnes to global objects,
this means that the constructors for all windows run before the
presentation window is displayed. Before this change, only the
presentation window was constructed first berore displaying it, followed
by the construction of the rest of the GUI windows.
The upside to this is that as soon as you see the main window, the GUI
is ready to go without a period where it's unresponsive.
The downside to this is it takes about 1.5 seconds to show the main
window, compared to around 0.75 seconds before.
I've no intention of changing that back. So if the startup time becomes
a problem, then we'll just have to work on optimizing hiro, so that it
can construct all the global Window objects quicker. The main way to do
that would be to not do calls to the Layout::setGeometry functions for
every widget added, and instead wait until the window is displayed. But
I don't have an easy way to do that, because you want the widget
geometry values to be sane even before the window is visible to help
size certain things.
2018-07-31 10:56:45 +00:00
|
|
|
auto driver() -> string { return instance->driver(); }
|
|
|
|
auto ready() -> bool { return instance->ready(); }
|
|
|
|
|
|
|
|
auto hasExclusive() -> bool { return instance->hasExclusive(); }
|
|
|
|
auto hasContext() -> bool { return instance->hasContext(); }
|
|
|
|
auto hasDevices() -> vector<string> { return instance->hasDevices(); }
|
|
|
|
auto hasBlocking() -> bool { return instance->hasBlocking(); }
|
|
|
|
auto hasDynamic() -> bool { return instance->hasDynamic(); }
|
|
|
|
auto hasChannels() -> vector<uint> { return instance->hasChannels(); }
|
|
|
|
auto hasFrequencies() -> vector<uint> { return instance->hasFrequencies(); }
|
|
|
|
auto hasLatencies() -> vector<uint> { return instance->hasLatencies(); }
|
|
|
|
|
|
|
|
auto hasDevice(string device) -> bool { return instance->hasDevice(device); }
|
|
|
|
auto hasChannels(uint channels) -> bool { return instance->hasChannels(channels); }
|
|
|
|
auto hasFrequency(uint frequency) -> bool { return instance->hasFrequency(frequency); }
|
|
|
|
auto hasLatency(uint latency) -> bool { return instance->hasLatency(latency); }
|
|
|
|
|
|
|
|
auto exclusive() -> bool { return instance->exclusive; }
|
|
|
|
auto context() -> uintptr { return instance->context; }
|
|
|
|
auto device() -> string { return instance->device; }
|
|
|
|
auto blocking() -> bool { return instance->blocking; }
|
|
|
|
auto dynamic() -> bool { return instance->dynamic; }
|
|
|
|
auto channels() -> uint { return instance->channels; }
|
|
|
|
auto frequency() -> uint { return instance->frequency; }
|
|
|
|
auto latency() -> uint { return instance->latency; }
|
2018-07-31 02:23:12 +00:00
|
|
|
|
|
|
|
auto setExclusive(bool exclusive) -> bool;
|
|
|
|
auto setContext(uintptr context) -> bool;
|
|
|
|
auto setDevice(string device) -> bool;
|
|
|
|
auto setBlocking(bool blocking) -> bool;
|
|
|
|
auto setDynamic(bool dynamic) -> bool;
|
|
|
|
auto setChannels(uint channels) -> bool;
|
|
|
|
auto setFrequency(uint frequency) -> bool;
|
|
|
|
auto setLatency(uint latency) -> bool;
|
|
|
|
|
|
|
|
auto clear() -> void;
|
|
|
|
auto level() -> double;
|
|
|
|
auto output(const double samples[]) -> void;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Audio& self;
|
Update to 20180731 release.
byuu says:
I've completed moving all the class objects from `unique_pointer<T>` to
just T. The one exception is the Emulator::Interface instance. I can
absolutely make that a global object, but only in bsnes where there's
just the one emulation core.
I also moved all the SettingsWindow and ToolsWindow panels out to their
own global objects, and fixed a very difficult bug with GTK TabFrame
controls.
The configuration settings panel is now the emulator settings panel. And
I added some spacing between bold label sections on both the emulator
and driver settings panels.
I gave fixing ComboButtonItem my best shot, given I can't reproduce the
crash. Probably won't work, though.
Also made a very slight consistency improvement to ruby and renamed
driverName() to driver().
...
An important change ... as a result of moving bsnes to global objects,
this means that the constructors for all windows run before the
presentation window is displayed. Before this change, only the
presentation window was constructed first berore displaying it, followed
by the construction of the rest of the GUI windows.
The upside to this is that as soon as you see the main window, the GUI
is ready to go without a period where it's unresponsive.
The downside to this is it takes about 1.5 seconds to show the main
window, compared to around 0.75 seconds before.
I've no intention of changing that back. So if the startup time becomes
a problem, then we'll just have to work on optimizing hiro, so that it
can construct all the global Window objects quicker. The main way to do
that would be to not do calls to the Layout::setGeometry functions for
every widget added, and instead wait until the window is displayed. But
I don't have an easy way to do that, because you want the widget
geometry values to be sane even before the window is visible to help
size certain things.
2018-07-31 10:56:45 +00:00
|
|
|
unique_pointer<AudioDriver> instance;
|
2018-07-31 02:23:12 +00:00
|
|
|
vector<nall::DSP::Resampler::Cubic> resamplers;
|
|
|
|
};
|