mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-10 17:24:12 +02:00
Update to v104r06 release.
byuu says: Changelog: - gba,ws: removed Thread::step() override¹ - processor/m68k: move.b (a7)+ and move.b (a7)- adjust a7 by two, not by one² - tomoko: created new initialize(Video,Audio,Input)Driver() functions³ - ruby/audio: split Audio::information into Audio::available(Devices,Frequencies,Latencies,Channels)³ - ws: added Model::(WonderSwan,WonderSwanColor,SwanCrystal)() functions for consistency with other cores ¹: this should hopefully fix GBA Pokemon Pinball. Thanks to SuperMikeMan for pointing out the underlying cause. ²: this fixes A Ressaha de Ikou, Mega Bomberman, and probably more games. ³: this is the big change: so there was a problem with WASAPI where you might change your device under the audio settings panel. And your new device may not support the frequency that your old device used. This would end up not updating the frequency, and the pitch would be distorted. The old Audio::information() couldn't tell you what frequencies, latencies, or channels were available for all devices simultaneously, so I had to split them up. The new initializeAudioDriver() function validates you have a correct driver, or it defaults to none. Then it validates a correct device name, or it defaults to the first entry in the list. Then it validates a correct frequency, or defaults to the first in the list. Then finally it validates a correct latency, or defaults to the first in the list. In this way ... we have a clear path now with no API changes required to select default devices, frequencies, latencies, channel counts: they need to be the first items in their respective lists. So, what we need to do now is go through and for every audio driver that enumerates devices, we need to make sure the default device gets added to the top of the list. I'm ... not really sure how to do this with most drivers, so this is definitely going to take some time. Also, when you change a device, initializeAudioDriver() is called again, so if it's a bad device, it will disable the audio driver instead of continuing to send samples at it and hoping that the driver blocked those API calls when it failed to initialize properly. Now then ... since it was a decently-sized API change, it's possible I've broken compilation of the Linux drivers, so please report any compilation errors so that I can fix them.
This commit is contained in:
@@ -4,17 +4,23 @@ struct AudioALSA : Audio {
|
||||
AudioALSA() { initialize(); }
|
||||
~AudioALSA() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
||||
auto information() -> Information {
|
||||
Information information;
|
||||
information.devices = queryDevices();
|
||||
information.frequencies = {44100.0, 48000.0, 96000.0};
|
||||
information.latencies = {20, 40, 60, 80, 100};
|
||||
information.channels = {2};
|
||||
return information;
|
||||
auto availableDevices() -> string_vector {
|
||||
return queryDevices();
|
||||
}
|
||||
|
||||
auto availableFrequencies() -> vector<double> {
|
||||
return {44100.0, 48000.0, 96000.0};
|
||||
}
|
||||
|
||||
auto availableLatencies() -> vector<uint> {
|
||||
return {20, 40, 60, 80, 100};
|
||||
}
|
||||
|
||||
auto availableChannels() -> vector<uint> {
|
||||
return {2};
|
||||
}
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
auto device() -> string { return _device; }
|
||||
auto blocking() -> bool { return _blocking; }
|
||||
auto channels() -> uint { return 2; }
|
||||
|
@@ -4,17 +4,23 @@ struct AudioAO : Audio {
|
||||
AudioAO() { initialize(); }
|
||||
~AudioAO() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
||||
auto information() -> Information {
|
||||
Information information;
|
||||
information.devices = {_device};
|
||||
information.frequencies = {44100.0, 48000.0, 96000.0};
|
||||
information.latencies = {100};
|
||||
information.channels = {2};
|
||||
return information;
|
||||
auto availableDevices() -> string_vector {
|
||||
return {"Default"};
|
||||
}
|
||||
|
||||
auto availableFrequencies() -> vector<double> {
|
||||
return {44100.0, 48000.0, 96000.0};
|
||||
}
|
||||
|
||||
auto availableLatencies() -> vector<uint> {
|
||||
return {100};
|
||||
}
|
||||
|
||||
auto availableChannels() -> vector<uint> {
|
||||
return {2};
|
||||
}
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
auto blocking() -> bool { return true; }
|
||||
auto channels() -> uint { return 2; }
|
||||
auto frequency() -> double { return _frequency; }
|
||||
|
@@ -5,22 +5,32 @@ struct AudioASIO : Audio {
|
||||
AudioASIO() { self = this; initialize(); }
|
||||
~AudioASIO() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
||||
auto information() -> Information {
|
||||
Information information;
|
||||
for(auto& device : _devices) information.devices.append(device.name);
|
||||
information.frequencies = {_frequency};
|
||||
uint latencies[] = {64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 6144}; //factors of 6144
|
||||
for(auto& latency : latencies) {
|
||||
if(latency < _active.minimumBufferSize) continue;
|
||||
if(latency > _active.maximumBufferSize) continue;
|
||||
information.latencies.append(latency);
|
||||
}
|
||||
information.channels = {1, 2};
|
||||
return information;
|
||||
auto availableDevices() -> string_vector {
|
||||
string_vector devices;
|
||||
for(auto& device : _devices) devices.append(device.name);
|
||||
return devices;
|
||||
}
|
||||
|
||||
auto availableFrequencies() -> vector<double> {
|
||||
return {_frequency};
|
||||
}
|
||||
|
||||
auto availableLatencies() -> vector<uint> {
|
||||
vector<uint> latencies;
|
||||
uint latencyList[] = {64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 6144}; //factors of 6144
|
||||
for(auto& latency : latencyList) {
|
||||
if(latency < _active.minimumBufferSize) continue;
|
||||
if(latency > _active.maximumBufferSize) continue;
|
||||
latencies.append(latency);
|
||||
}
|
||||
return latencies;
|
||||
}
|
||||
|
||||
auto availableChannels() -> vector<uint> {
|
||||
return {1, 2};
|
||||
}
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
auto context() -> uintptr { return _context; }
|
||||
auto device() -> string { return _device; }
|
||||
auto blocking() -> bool { return _blocking; }
|
||||
|
@@ -4,17 +4,23 @@ struct AudioDirectSound : Audio {
|
||||
AudioDirectSound() { initialize(); }
|
||||
~AudioDirectSound() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
||||
auto information() -> Information {
|
||||
Information information;
|
||||
information.devices = {"Default"};
|
||||
information.frequencies = {44100.0, 48000.0, 96000.0};
|
||||
information.latencies = {40, 60, 80, 100};
|
||||
information.channels = {2};
|
||||
return information;
|
||||
auto availableDevices() -> string_vector {
|
||||
return {"Default"};
|
||||
}
|
||||
|
||||
auto availableFrequencies() -> vector<double> {
|
||||
return {44100.0, 48000.0, 96000.0};
|
||||
}
|
||||
|
||||
auto availableLatencies() -> vector<uint> {
|
||||
return {40, 60, 80, 100};
|
||||
}
|
||||
|
||||
auto availableChannels() -> vector<uint> {
|
||||
return {2};
|
||||
}
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
auto blocking() -> bool { return _blocking; }
|
||||
auto channels() -> uint { return _channels; }
|
||||
auto frequency() -> double { return _frequency; }
|
||||
|
@@ -10,17 +10,25 @@ struct AudioOpenAL : Audio {
|
||||
AudioOpenAL() { initialize(); }
|
||||
~AudioOpenAL() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
||||
auto information() -> Information {
|
||||
Information information;
|
||||
for(auto& device : queryDevices()) information.devices.append(device);
|
||||
information.channels = {2};
|
||||
information.frequencies = {44100.0, 48000.0, 96000.0};
|
||||
information.latencies = {20, 40, 60, 80, 100};
|
||||
return information;
|
||||
auto availableDevices() -> string_vector {
|
||||
string_vector devices;
|
||||
for(auto& device : queryDevices()) devices.append(device);
|
||||
return devices;
|
||||
}
|
||||
|
||||
auto availableFrequencies() -> vector<double> {
|
||||
return {44100.0, 48000.0, 96000.0};
|
||||
}
|
||||
|
||||
auto availableLatencies() -> vector<uint> {
|
||||
return {20, 40, 60, 80, 100};
|
||||
}
|
||||
|
||||
auto availableChannels() -> vector<uint> {
|
||||
return {2};
|
||||
}
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
auto device() -> string { return _device; }
|
||||
auto blocking() -> bool { return _blocking; }
|
||||
auto channels() -> uint { return _channels; }
|
||||
|
@@ -17,18 +17,26 @@ struct AudioOSS : Audio {
|
||||
AudioOSS() { initialize(); }
|
||||
~AudioOSS() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
||||
auto information() -> Information {
|
||||
Information information;
|
||||
information.devices = {"/dev/dsp"};
|
||||
for(auto& device : directory::files("/dev/", "dsp?*")) information.devices.append(string{"/dev/", device});
|
||||
information.frequencies = {44100.0, 48000.0, 96000.0};
|
||||
information.latencies = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
information.channels = {1, 2};
|
||||
return information;
|
||||
auto availableDevices() -> string_vector {
|
||||
string_vector devices;
|
||||
devices.append("/dev/dsp");
|
||||
for(auto& device : directory::files("/dev/", "dsp?*")) devices.append(string{"/dev/", device});
|
||||
return devices;
|
||||
}
|
||||
|
||||
auto availableFrequencies() -> vector<double> {
|
||||
return {44100.0, 48000.0, 96000.0};
|
||||
}
|
||||
|
||||
auto availableLatencies() -> vector<uint> {
|
||||
return {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
}
|
||||
|
||||
auto availableChannels() -> vector<uint> {
|
||||
return {1, 2};
|
||||
}
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
auto device() -> string { return _device; }
|
||||
auto blocking() -> bool { return _blocking; }
|
||||
auto channels() -> uint { return _channels; }
|
||||
@@ -78,8 +86,8 @@ private:
|
||||
auto initialize() -> bool {
|
||||
terminate();
|
||||
|
||||
if(!information().devices.find(_device)) {
|
||||
_device = information().devices.left();
|
||||
if(!availableDevices().find(_device)) {
|
||||
_device = availableDevices().left();
|
||||
}
|
||||
|
||||
_fd = open(_device, O_WRONLY, O_NONBLOCK);
|
||||
|
@@ -4,17 +4,23 @@ struct AudioPulseAudio : Audio {
|
||||
AudioPulseAudio() { initialize(); }
|
||||
~AudioPulseAudio() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
||||
auto information() -> Information {
|
||||
Information information;
|
||||
information.devices = {"Default"};
|
||||
information.frequencies = {44100.0, 48000.0, 96000.0};
|
||||
information.latencies = {20, 40, 60, 80, 100};
|
||||
information.channels = {2};
|
||||
return information;
|
||||
auto availableDevices() -> string_vector {
|
||||
return {"Default"};
|
||||
}
|
||||
|
||||
auto availableFrequencies() -> vector<double> {
|
||||
return {44100.0, 48000.0, 96000.0};
|
||||
}
|
||||
|
||||
auto availableLatencies() -> vector<uint> {
|
||||
return {20, 40, 60, 80, 100};
|
||||
}
|
||||
|
||||
auto availableChannels() -> vector<uint> {
|
||||
return {2};
|
||||
}
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
auto blocking() -> bool { return _blocking; }
|
||||
auto channels() -> uint { return 2; }
|
||||
auto frequency() -> double { return _frequency; }
|
||||
|
@@ -5,17 +5,23 @@ struct AudioPulseAudioSimple : Audio {
|
||||
AudioPulseAudioSimple() { initialize(); }
|
||||
~AudioPulseAudioSimple() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
||||
auto information() -> Information {
|
||||
Information information;
|
||||
information.devices = {"Default"};
|
||||
information.frequencies = {44100.0, 48000.0, 96000.0};
|
||||
information.latencies = {40};
|
||||
information.channels = {2};
|
||||
return information;
|
||||
auto availableDevices() -> string_vector {
|
||||
return {"Default"};
|
||||
}
|
||||
|
||||
auto availableFrequencies() -> vector<double> {
|
||||
return {44100.0, 48000.0, 96000.0};
|
||||
}
|
||||
|
||||
auto availableLatencies() -> vector<uint> {
|
||||
return {40};
|
||||
}
|
||||
|
||||
auto availableChannels() -> vector<uint> {
|
||||
return {2};
|
||||
}
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
auto blocking() -> bool { return true; }
|
||||
auto channels() -> uint { return 2; }
|
||||
auto frequency() -> double { return _frequency; }
|
||||
|
@@ -10,17 +10,23 @@ struct AudioWASAPI : Audio {
|
||||
AudioWASAPI() { initialize(); }
|
||||
~AudioWASAPI() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
||||
auto information() -> Information {
|
||||
Information information;
|
||||
for(auto& device : _devices) information.devices.append(device);
|
||||
information.channels = {2};
|
||||
information.frequencies = {(double)_frequency};
|
||||
information.latencies = {0, 20, 40, 60, 80, 100};
|
||||
return information;
|
||||
auto availableDevices() -> string_vector {
|
||||
return _devices;
|
||||
}
|
||||
|
||||
auto availableFrequencies() -> vector<double> {
|
||||
return {(double)_frequency};
|
||||
}
|
||||
|
||||
auto availableLatencies() -> vector<uint> {
|
||||
return {0, 20, 40, 60, 80, 100};
|
||||
}
|
||||
|
||||
auto availableChannels() -> vector<uint> {
|
||||
return {2};
|
||||
}
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
auto exclusive() -> bool { return _exclusive; }
|
||||
auto device() -> string { return _device; }
|
||||
auto blocking() -> bool { return _blocking; }
|
||||
@@ -239,7 +245,7 @@ private:
|
||||
} _queue;
|
||||
|
||||
IMMDeviceEnumerator* _enumerator = nullptr;
|
||||
vector<string> _devices;
|
||||
string_vector _devices;
|
||||
IMMDevice* _audioDevice = nullptr;
|
||||
IAudioClient* _audioClient = nullptr;
|
||||
IAudioRenderClient* _renderClient = nullptr;
|
||||
|
@@ -5,17 +5,23 @@ struct AudioXAudio2 : Audio, public IXAudio2VoiceCallback {
|
||||
AudioXAudio2() { initialize(); }
|
||||
~AudioXAudio2() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
||||
auto information() -> Information {
|
||||
Information information;
|
||||
information.devices = {"Default"};
|
||||
information.channels = {2};
|
||||
information.frequencies = {44100.0, 48000.0, 96000.0};
|
||||
information.latencies = {20, 40, 60, 80, 100};
|
||||
return information;
|
||||
auto availableDevices() -> string_vector {
|
||||
return {"Default"};
|
||||
}
|
||||
|
||||
auto availableFrequencies() -> vector<double> {
|
||||
return {44100.0, 48000.0, 96000.0};
|
||||
}
|
||||
|
||||
auto availableLatencies() -> vector<uint> {
|
||||
return {20, 40, 60, 80, 100};
|
||||
}
|
||||
|
||||
auto availableChannels() -> vector<uint> {
|
||||
return {2};
|
||||
}
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
auto blocking() -> bool { return _blocking; }
|
||||
auto channels() -> uint { return _channels; }
|
||||
auto frequency() -> double { return _frequency; }
|
||||
|
Reference in New Issue
Block a user