mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-25 07:32:28 +01:00
byuu says: Changelog: - nall/dsp returns with new iir/biquad.hpp and resampler/cubic.hpp files - nall/queue.hpp added (simple ring buffer ... nall/vector wouldn't cause too many moves with FIFO) - audio streams now only buffer 20ms; so even if multiple audio streams desync, latency can never exceed 20ms - replaced blackman windwed sinc FIR hermite audio filter with transposed direct form II biquadratic sixth-order IIR butterworth filter (better attenuation of frequencies above 20KHz, faster, no need for decimation, less code) - put in experimental eight-tap echo filter (a lot better than what I had before, but still rather weak) - substantial cleanups to the SuperFX GSU processor core (slightly faster, 479KB->100KB object file, 42.7KB->33.4KB source code size, way less code duplication) We'll definitely want to test the whole SuperFX library (not many games) just to make sure there's no regressions caused by this one. Not sure what I want to do with audio processing effects yet. I've always really wanted lots of fun controls to customize audio, and now finally with this new biquad filter, I can finally start implementing real effects. For instance, an equalizer wouldn't be too complicated anymore. The new reverb effect is still a poor man's version. I need to find human readable source for implementing a comb-filter properly. I'm pretty sure I can already treat nall::queue as an all-pass filter since all that does is phase shift (fancy audio term for "delay audio"). What's really going to be hard is figuring out how to expose user-friendly settings for controlling it. It looks like you need a bunch of coprime coefficients, and I don't think casual users are going to be able to hand-enter coprime values to get the echo effect they want. I uh ... don't even know how to calculate coprime values dynamically right now >_> But we're going to have to, as they are correlated to the output sampling rate. We'll definitely want to make some audio profiles so that users can quickly select pre-configured themes that sound nice, but expose the underlying coefficients so that they can tweak stuff to their liking. This isn't just about higan, this is about me trying to learn digital signal processing, so please don't be too upset about feature creep or anything on this. Anyway ... I'm having some difficulties with my audio right now. When the reverb effect is enabled, there's a bunch of static on system reset for just a moment. But this should not be possible. nall::queue is initializing all previous reverb sample elements to 0.0. I don't understand where static is coming in from. Further, we have the same issue with both the windowed sinc and the biquad filters ... a bit of a popping sound when starting a game. Any help tracking this down would be appreciated. There's also one really annoying issue ... I can't seem to do reverb or volume adjustments with normalized samples. If I say "volume *= 0.5" in higan/audio/audio.cpp line 68, it doesn't just halve the volume, it adds a whole bunch of distortion. This makes absolutely zero sense to me. The sample values are between 0.0 (mute) and 1.0 (full volume) here, so multiplying a double by 0.5 shouldn't cause distortion. So right now, I'm doing these adjustments with less precision after denormalizing back to int16. Anyone ever see something like that? :/
151 lines
6.2 KiB
C++
151 lines
6.2 KiB
C++
struct VideoSettings : TabFrameItem {
|
|
VideoSettings(TabFrame*);
|
|
|
|
VerticalLayout layout{this};
|
|
Label colorAdjustmentLabel{&layout, Size{~0, 0}};
|
|
HorizontalLayout saturationLayout{&layout, Size{~0, 0}};
|
|
Label saturationLabel{&saturationLayout, Size{80, 0}};
|
|
Label saturationValue{&saturationLayout, Size{50, 0}};
|
|
HorizontalSlider saturationSlider{&saturationLayout, Size{~0, 0}};
|
|
HorizontalLayout gammaLayout{&layout, Size{~0, 0}};
|
|
Label gammaLabel{&gammaLayout, Size{80, 0}};
|
|
Label gammaValue{&gammaLayout, Size{50, 0}};
|
|
HorizontalSlider gammaSlider{&gammaLayout, Size{~0, 0}};
|
|
HorizontalLayout luminanceLayout{&layout, Size{~0, 0}};
|
|
Label luminanceLabel{&luminanceLayout, Size{80, 0}};
|
|
Label luminanceValue{&luminanceLayout, Size{50, 0}};
|
|
HorizontalSlider luminanceSlider{&luminanceLayout, Size{~0, 0}};
|
|
Label overscanMaskLabel{&layout, Size{~0, 0}};
|
|
HorizontalLayout horizontalMaskLayout{&layout, Size{~0, 0}};
|
|
Label horizontalMaskLabel{&horizontalMaskLayout, Size{80, 0}};
|
|
Label horizontalMaskValue{&horizontalMaskLayout, Size{50, 0}};
|
|
HorizontalSlider horizontalMaskSlider{&horizontalMaskLayout, Size{~0, 0}};
|
|
HorizontalLayout verticalMaskLayout{&layout, Size{~0, 0}};
|
|
Label verticalMaskLabel{&verticalMaskLayout, Size{80, 0}};
|
|
Label verticalMaskValue{&verticalMaskLayout, Size{50, 0}};
|
|
HorizontalSlider verticalMaskSlider{&verticalMaskLayout, Size{~0, 0}};
|
|
|
|
auto updateColor() -> void;
|
|
auto updateOverscan() -> void;
|
|
};
|
|
|
|
struct AudioSettings : TabFrameItem {
|
|
AudioSettings(TabFrame*);
|
|
|
|
VerticalLayout layout{this};
|
|
Label driverLabel{&layout, Size{~0, 0}};
|
|
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
|
|
Label latencyLabel{&controlLayout, Size{0, 0}};
|
|
ComboButton latencyCombo{&controlLayout, Size{~0, 0}};
|
|
Label frequencyLabel{&controlLayout, Size{0, 0}};
|
|
ComboButton frequencyCombo{&controlLayout, Size{~0, 0}};
|
|
Label resamplerLabel{&controlLayout, Size{0, 0}};
|
|
ComboButton resamplerCombo{&controlLayout, Size{~0, 0}};
|
|
CheckLabel exclusiveMode{&layout, Size{~0, 0}};
|
|
Label effectsLabel{&layout, Size{~0, 0}};
|
|
HorizontalLayout volumeLayout{&layout, Size{~0, 0}};
|
|
Label volumeLabel{&volumeLayout, Size{80, 0}};
|
|
Label volumeValue{&volumeLayout, Size{50, 0}};
|
|
HorizontalSlider volumeSlider{&volumeLayout, Size{~0, 0}};
|
|
HorizontalLayout balanceLayout{&layout, Size{~0, 0}};
|
|
Label balanceLabel{&balanceLayout, Size{80, 0}};
|
|
Label balanceValue{&balanceLayout, Size{50, 0}};
|
|
HorizontalSlider balanceSlider{&balanceLayout, Size{~0, 0}};
|
|
CheckLabel reverbEnable{&layout, Size{~0, 0}};
|
|
|
|
auto updateDriver() -> void;
|
|
auto updateEffects() -> void;
|
|
};
|
|
|
|
struct InputSettings : TabFrameItem {
|
|
InputSettings(TabFrame*);
|
|
auto updateControls() -> void;
|
|
auto activeEmulator() -> InputEmulator&;
|
|
auto activePort() -> InputPort&;
|
|
auto activeDevice() -> InputDevice&;
|
|
auto reloadPorts() -> void;
|
|
auto reloadDevices() -> void;
|
|
auto reloadMappings() -> void;
|
|
auto refreshMappings() -> void;
|
|
auto assignMapping() -> void;
|
|
auto assignMouseInput(uint id) -> void;
|
|
auto inputEvent(shared_pointer<HID::Device> device, uint group, uint input, int16 oldValue, int16 newValue, bool allowMouseInput = false) -> void;
|
|
|
|
InputMapping* activeMapping = nullptr;
|
|
Timer timer;
|
|
|
|
VerticalLayout layout{this};
|
|
HorizontalLayout focusLayout{&layout, Size{~0, 0}};
|
|
Label focusLabel{&focusLayout, Size{0, 0}};
|
|
CheckLabel pauseEmulation{&focusLayout, Size{0, 0}};
|
|
CheckLabel allowInput{&focusLayout, Size{0, 0}};
|
|
HorizontalLayout selectionLayout{&layout, Size{~0, 0}};
|
|
ComboButton emulatorList{&selectionLayout, Size{~0, 0}};
|
|
ComboButton portList{&selectionLayout, Size{~0, 0}};
|
|
ComboButton deviceList{&selectionLayout, Size{~0, 0}};
|
|
TableView mappingList{&layout, Size{~0, ~0}};
|
|
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
|
|
Button assignMouse1{&controlLayout, Size{100, 0}};
|
|
Button assignMouse2{&controlLayout, Size{100, 0}};
|
|
Button assignMouse3{&controlLayout, Size{100, 0}};
|
|
Widget spacer{&controlLayout, Size{~0, 0}};
|
|
Button resetButton{&controlLayout, Size{80, 0}};
|
|
Button eraseButton{&controlLayout, Size{80, 0}};
|
|
};
|
|
|
|
struct HotkeySettings : TabFrameItem {
|
|
HotkeySettings(TabFrame*);
|
|
auto reloadMappings() -> void;
|
|
auto refreshMappings() -> void;
|
|
auto assignMapping() -> void;
|
|
auto inputEvent(shared_pointer<HID::Device> device, uint group, uint input, int16 oldValue, int16 newValue) -> void;
|
|
|
|
InputMapping* activeMapping = nullptr;
|
|
Timer timer;
|
|
|
|
VerticalLayout layout{this};
|
|
TableView mappingList{&layout, Size{~0, ~0}};
|
|
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
|
|
Widget spacer{&controlLayout, Size{~0, 0}};
|
|
Button resetButton{&controlLayout, Size{80, 0}};
|
|
Button eraseButton{&controlLayout, Size{80, 0}};
|
|
};
|
|
|
|
struct AdvancedSettings : TabFrameItem {
|
|
AdvancedSettings(TabFrame*);
|
|
|
|
VerticalLayout layout{this};
|
|
Label driverLabel{&layout, Size{~0, 0}, 2};
|
|
HorizontalLayout driverLayout{&layout, Size{~0, 0}};
|
|
Label videoLabel{&driverLayout, Size{0, 0}};
|
|
ComboButton videoDriver{&driverLayout, Size{~0, 0}};
|
|
Label audioLabel{&driverLayout, Size{0, 0}};
|
|
ComboButton audioDriver{&driverLayout, Size{~0, 0}};
|
|
Label inputLabel{&driverLayout, Size{0, 0}};
|
|
ComboButton inputDriver{&driverLayout, Size{~0, 0}};
|
|
Label libraryLabel{&layout, Size{~0, 0}, 2};
|
|
HorizontalLayout libraryLayout{&layout, Size{~0, 0}};
|
|
Label libraryPrefix{&libraryLayout, Size{0, 0}};
|
|
LineEdit libraryLocation{&libraryLayout, Size{~0, 0}};
|
|
Button libraryChange{&libraryLayout, Size{0, 0}};
|
|
CheckLabel ignoreManifests{&layout, Size{~0, 0}};
|
|
};
|
|
|
|
struct SettingsManager : Window {
|
|
SettingsManager();
|
|
auto setVisible(bool visible = true) -> SettingsManager&;
|
|
auto show(uint setting) -> void;
|
|
|
|
VerticalLayout layout{this};
|
|
TabFrame panel{&layout, Size{~0, ~0}};
|
|
VideoSettings video{&panel};
|
|
AudioSettings audio{&panel};
|
|
InputSettings input{&panel};
|
|
HotkeySettings hotkeys{&panel};
|
|
AdvancedSettings advanced{&panel};
|
|
|
|
StatusBar statusBar{this};
|
|
};
|
|
|
|
extern unique_pointer<SettingsManager> settingsManager;
|