diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj
index 2f340363..67954d82 100644
--- a/Core/Core.vcxproj
+++ b/Core/Core.vcxproj
@@ -355,7 +355,7 @@
true
WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
true
- AnySuitable
+ Disabled
true
Speed
diff --git a/Core/EmulationSettings.cpp b/Core/EmulationSettings.cpp
index ff1d083b..0a78ead6 100644
--- a/Core/EmulationSettings.cpp
+++ b/Core/EmulationSettings.cpp
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "EmulationSettings.h"
+#include "Console.h"
#include "VsControlManager.h"
//Version 0.8.0
@@ -11,9 +12,13 @@ Language EmulationSettings::_displayLanguage = Language::English;
uint64_t EmulationSettings::_flags = 0;
+bool EmulationSettings::_audioSettingsChanged = true;
uint32_t EmulationSettings::_audioLatency = 20000;
double EmulationSettings::_channelVolume[11] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
double EmulationSettings::_channelPanning[11] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
+EqualizerFilterType EmulationSettings::_equalizerFilterType = EqualizerFilterType::None;
+vector EmulationSettings::_bandGains = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
+vector EmulationSettings::_bands = { { 40,56,80,113,160,225,320,450,600,750,1000,2000,3000,4000,5000,6000,7000,10000,12500,15000 } };
double EmulationSettings::_masterVolume = 1.0;
uint32_t EmulationSettings::_sampleRate = 44100;
StereoFilter EmulationSettings::_stereoFilter = StereoFilter::None;
@@ -83,4 +88,16 @@ uint32_t EmulationSettings::_ppuPaletteArgb[11][64] = {
/* 2C05-03 */ { 0xFF6D6D6D, 0xFF002491, 0xFF0000DA, 0xFF6D48DA, 0xFF91006D, 0xFFB6006D, 0xFFB62400, 0xFF914800, 0xFF6D4800, 0xFF244800, 0xFF006D24, 0xFF009100, 0xFF004848, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFB6B6B6, 0xFF006DDA, 0xFF0048FF, 0xFF9100FF, 0xFFB600FF, 0xFFFF0091, 0xFFFF0000, 0xFFDA6D00, 0xFF916D00, 0xFF249100, 0xFF009100, 0xFF00B66D, 0xFF009191, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFF6DB6FF, 0xFF9191FF, 0xFFDA6DFF, 0xFFFF00FF, 0xFFFF6DFF, 0xFFFF9100, 0xFFFFB600, 0xFFDADA00, 0xFF6DDA00, 0xFF00FF00, 0xFF48FFDA, 0xFF00FFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFB6DAFF, 0xFFDAB6FF, 0xFFFFB6FF, 0xFFFF91FF, 0xFFFFB6B6, 0xFFFFDA91, 0xFFFFFF48, 0xFFFFFF6D, 0xFFB6FF48, 0xFF91FF6D, 0xFF48FFDA, 0xFF91DAFF, 0xFF000000, 0xFF000000, 0xFF000000 },
/* 2C05-04 */ { 0xFF6D6D6D, 0xFF002491, 0xFF0000DA, 0xFF6D48DA, 0xFF91006D, 0xFFB6006D, 0xFFB62400, 0xFF914800, 0xFF6D4800, 0xFF244800, 0xFF006D24, 0xFF009100, 0xFF004848, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFB6B6B6, 0xFF006DDA, 0xFF0048FF, 0xFF9100FF, 0xFFB600FF, 0xFFFF0091, 0xFFFF0000, 0xFFDA6D00, 0xFF916D00, 0xFF249100, 0xFF009100, 0xFF00B66D, 0xFF009191, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFF6DB6FF, 0xFF9191FF, 0xFFDA6DFF, 0xFFFF00FF, 0xFFFF6DFF, 0xFFFF9100, 0xFFFFB600, 0xFFDADA00, 0xFF6DDA00, 0xFF00FF00, 0xFF48FFDA, 0xFF00FFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFB6DAFF, 0xFFDAB6FF, 0xFFFFB6FF, 0xFFFF91FF, 0xFFFFB6B6, 0xFFFFDA91, 0xFFFFFF48, 0xFFFFFF6D, 0xFFB6FF48, 0xFF91FF6D, 0xFF48FFDA, 0xFF91DAFF, 0xFF000000, 0xFF000000, 0xFF000000 },
/* 2C05-05 */ { 0xFF6D6D6D, 0xFF002491, 0xFF0000DA, 0xFF6D48DA, 0xFF91006D, 0xFFB6006D, 0xFFB62400, 0xFF914800, 0xFF6D4800, 0xFF244800, 0xFF006D24, 0xFF009100, 0xFF004848, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFB6B6B6, 0xFF006DDA, 0xFF0048FF, 0xFF9100FF, 0xFFB600FF, 0xFFFF0091, 0xFFFF0000, 0xFFDA6D00, 0xFF916D00, 0xFF249100, 0xFF009100, 0xFF00B66D, 0xFF009191, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFF6DB6FF, 0xFF9191FF, 0xFFDA6DFF, 0xFFFF00FF, 0xFFFF6DFF, 0xFFFF9100, 0xFFFFB600, 0xFFDADA00, 0xFF6DDA00, 0xFF00FF00, 0xFF48FFDA, 0xFF00FFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFB6DAFF, 0xFFDAB6FF, 0xFFFFB6FF, 0xFFFF91FF, 0xFFFFB6B6, 0xFFFFDA91, 0xFFFFFF48, 0xFFFFFF6D, 0xFFB6FF48, 0xFF91FF6D, 0xFF48FFDA, 0xFF91DAFF, 0xFF000000, 0xFF000000, 0xFF000000 }
-};
\ No newline at end of file
+};
+
+void EmulationSettings::SetEqualizerBands(double *bands, uint32_t bandCount)
+{
+ Console::Pause();
+ _bands.clear();
+ _bandGains.clear();
+ for(uint32_t i = 0; i < bandCount; i++) {
+ _bands.push_back(bands[i]);
+ _bandGains.push_back(0);
+ }
+ Console::Resume();
+}
diff --git a/Core/EmulationSettings.h b/Core/EmulationSettings.h
index 0e21caf9..53e65401 100644
--- a/Core/EmulationSettings.h
+++ b/Core/EmulationSettings.h
@@ -67,6 +67,14 @@ enum class AudioChannel
Sunsoft5B = 10
};
+enum class EqualizerFilterType
+{
+ None = 0,
+ Butterworth = 1,
+ Chebyshev1 = 2,
+ Chebyshev2 = 3
+};
+
enum class NesModel
{
Auto = 0,
@@ -322,9 +330,13 @@ private:
static Language _displayLanguage;
+ static bool _audioSettingsChanged;
static uint32_t _audioLatency;
static double _channelVolume[11];
static double _channelPanning[11];
+ static EqualizerFilterType _equalizerFilterType;
+ static vector _bandGains;
+ static vector _bands;
static double _masterVolume;
static uint32_t _sampleRate;
static StereoFilter _stereoFilter;
@@ -470,11 +482,48 @@ public:
static void SetChannelPanning(AudioChannel channel, double panning)
{
_channelPanning[(int)channel] = panning;
+ _audioSettingsChanged = true;
+ }
+
+ static double GetBandGain(int band)
+ {
+ if(band < (int)_bandGains.size()) {
+ return _bandGains[band];
+ } else {
+ return 0;
+ }
+ }
+
+ static void SetBandGain(int band, double gain)
+ {
+ if(band < (int)_bandGains.size()) {
+ _bandGains[band] = gain;
+ }
+ _audioSettingsChanged = true;
+ }
+
+ static vector GetEqualizerBands()
+ {
+ return _bands;
+ }
+
+ static void SetEqualizerBands(double *bands, uint32_t bandCount);
+
+ static EqualizerFilterType GetEqualizerFilterType()
+ {
+ return _equalizerFilterType;
+ }
+
+ static void SetEqualizerFilterType(EqualizerFilterType filter)
+ {
+ _equalizerFilterType = filter;
+ _audioSettingsChanged = true;
}
static void SetSampleRate(uint32_t sampleRate)
{
_sampleRate = sampleRate;
+ _audioSettingsChanged = true;
}
static uint32_t GetSampleRate()
@@ -485,27 +534,32 @@ public:
static void SetAudioLatency(uint32_t msLatency)
{
_audioLatency = msLatency;
+ _audioSettingsChanged = true;
}
static void SetStereoFilter(StereoFilter stereoFilter)
{
_stereoFilter = stereoFilter;
+ _audioSettingsChanged = true;
}
static void SetStereoDelay(int32_t delay)
{
_stereoDelay = delay;
+ _audioSettingsChanged = true;
}
static void SetStereoPanningAngle(double angle)
{
_stereoAngle = angle;
+ _audioSettingsChanged = true;
}
static void SetReverbParameters(double strength, double delay)
{
_reverbStrength = strength;
_reverbDelay = delay;
+ _audioSettingsChanged = true;
}
static StereoFilter GetStereoFilter()
@@ -536,6 +590,16 @@ public:
static void SetCrossFeedRatio(uint32_t ratio)
{
_crossFeedRatio = ratio;
+ _audioSettingsChanged = true;
+ }
+
+ static bool NeedAudioSettingsUpdate()
+ {
+ bool value = _audioSettingsChanged;
+ if(value) {
+ _audioSettingsChanged = false;
+ }
+ return value;
}
static uint32_t GetCrossFeedRatio()
diff --git a/Core/SoundMixer.cpp b/Core/SoundMixer.cpp
index 32c0c5bb..c9426c1b 100644
--- a/Core/SoundMixer.cpp
+++ b/Core/SoundMixer.cpp
@@ -3,6 +3,7 @@
#include "APU.h"
#include "CPU.h"
#include "VideoDecoder.h"
+#include "../Utilities/orfanidis_eq.h"
IAudioDevice* SoundMixer::AudioDevice = nullptr;
unique_ptr SoundMixer::_waveRecorder;
@@ -12,6 +13,7 @@ uint32_t SoundMixer::_muteFrameCount;
SoundMixer::SoundMixer()
{
+ _eqFrequencyGrid.reset(new orfanidis_eq::freq_grid());
_outputBuffer = new int16_t[SoundMixer::MaxSamplesPerFrame];
_blipBufLeft = blip_new(SoundMixer::MaxSamplesPerFrame);
_blipBufRight = blip_new(SoundMixer::MaxSamplesPerFrame);
@@ -77,6 +79,9 @@ void SoundMixer::Reset()
}
memset(_channelOutput, 0, sizeof(_channelOutput));
memset(_currentOutput, 0, sizeof(_currentOutput));
+
+ UpdateRates(true);
+ UpdateEqualizers(true);
}
void SoundMixer::PlayAudioBuffer(uint32_t time)
@@ -84,10 +89,14 @@ void SoundMixer::PlayAudioBuffer(uint32_t time)
EndFrame(time);
size_t sampleCount = blip_read_samples(_blipBufLeft, _outputBuffer, SoundMixer::MaxSamplesPerFrame, 1);
+ ApplyEqualizer(_equalizerLeft.get(), sampleCount);
+
if(_hasPanning) {
blip_read_samples(_blipBufRight, _outputBuffer + 1, SoundMixer::MaxSamplesPerFrame, 1);
+ ApplyEqualizer(_equalizerRight.get(), sampleCount);
} else {
- for(size_t i = 0; i < sampleCount * 2; i+=2) {
+ //Copy left channel to right channel (optimization - when no panning is used)
+ for(size_t i = 0; i < sampleCount * 2; i += 2) {
_outputBuffer[i + 1] = _outputBuffer[i];
}
}
@@ -128,15 +137,19 @@ void SoundMixer::PlayAudioBuffer(uint32_t time)
}
}
}
-
+
VideoDecoder::GetInstance()->AddRecordingSound(_outputBuffer, (uint32_t)sampleCount, _sampleRate);
- if(EmulationSettings::GetSampleRate() != _sampleRate) {
- //Update sample rate for next frame if setting changed
- _sampleRate = EmulationSettings::GetSampleRate();
- UpdateRates(true);
- } else {
- UpdateRates(false);
+ if(EmulationSettings::NeedAudioSettingsUpdate()) {
+ if(EmulationSettings::GetSampleRate() != _sampleRate) {
+ //Update sample rate for next frame if setting changed
+ _sampleRate = EmulationSettings::GetSampleRate();
+ UpdateRates(true);
+ UpdateEqualizers(true);
+ } else {
+ UpdateEqualizers(false);
+ UpdateRates(false);
+ }
}
}
@@ -164,11 +177,11 @@ void SoundMixer::UpdateRates(bool forceUpdate)
_volumes[i] = EmulationSettings::GetChannelVolume((AudioChannel)i);
_panning[i] = EmulationSettings::GetChannelPanning((AudioChannel)i);
if(_panning[i] != 1.0) {
- if(_hasPanning) {
+ if(!_hasPanning) {
blip_clear(_blipBufLeft);
blip_clear(_blipBufRight);
}
- _hasPanning = true;
+ hasPanning = true;
}
}
_hasPanning = hasPanning;
@@ -253,6 +266,54 @@ void SoundMixer::EndFrame(uint32_t time)
memset(_channelOutput, 0, sizeof(_channelOutput));
}
+void SoundMixer::ApplyEqualizer(orfanidis_eq::eq1* equalizer, size_t sampleCount)
+{
+ if(equalizer) {
+ int offset = equalizer == _equalizerRight.get() ? 1 : 0;
+ for(size_t i = 0; i < sampleCount; i++) {
+ double in = _outputBuffer[i * 2 + offset];
+ double out;
+ equalizer->sbs_process(&in, &out);
+ _outputBuffer[i * 2 + offset] = (int16_t)out;
+ }
+ }
+}
+
+void SoundMixer::UpdateEqualizers(bool forceUpdate)
+{
+ EqualizerFilterType type = EmulationSettings::GetEqualizerFilterType();
+ if(type != EqualizerFilterType::None) {
+ vector bands = EmulationSettings::GetEqualizerBands();
+
+ if(bands.size() != _eqFrequencyGrid->get_number_of_bands()) {
+ _equalizerLeft.reset();
+ _equalizerRight.reset();
+ }
+
+ if((_equalizerLeft && (int)_equalizerLeft->get_eq_type() != (int)type) || !_equalizerLeft || forceUpdate) {
+ bands.insert(bands.begin(), bands[0] - (bands[1] - bands[0]));
+ bands.insert(bands.end(), bands[bands.size() - 1] + (bands[bands.size() - 1] - bands[bands.size() - 2]));
+ _eqFrequencyGrid.reset(new orfanidis_eq::freq_grid());
+ for(size_t i = 1; i < bands.size() - 1; i++) {
+ _eqFrequencyGrid->add_band((bands[i] + bands[i - 1]) / 2, bands[i], (bands[i + 1] + bands[i]) / 2);
+ }
+
+ _equalizerLeft.reset(new orfanidis_eq::eq1(_eqFrequencyGrid.get(), (orfanidis_eq::filter_type)EmulationSettings::GetEqualizerFilterType()));
+ _equalizerRight.reset(new orfanidis_eq::eq1(_eqFrequencyGrid.get(), (orfanidis_eq::filter_type)EmulationSettings::GetEqualizerFilterType()));
+ _equalizerLeft->set_sample_rate(_sampleRate);
+ _equalizerRight->set_sample_rate(_sampleRate);
+ }
+
+ for(unsigned int i = 0; i < _eqFrequencyGrid->get_number_of_bands(); i++) {
+ _equalizerLeft->change_band_gain_db(i, EmulationSettings::GetBandGain(i));
+ _equalizerRight->change_band_gain_db(i, EmulationSettings::GetBandGain(i));
+ }
+ } else {
+ _equalizerLeft.reset();
+ _equalizerRight.reset();
+ }
+}
+
void SoundMixer::StartRecording(string filepath)
{
auto lock = _waveRecorderLock.AcquireSafe();
diff --git a/Core/SoundMixer.h b/Core/SoundMixer.h
index 623e3a1b..9321f1ff 100644
--- a/Core/SoundMixer.h
+++ b/Core/SoundMixer.h
@@ -12,6 +12,11 @@
#include "CrossFeedFilter.h"
#include "WaveRecorder.h"
+namespace orfanidis_eq {
+ class freq_grid;
+ class eq1;
+}
+
class SoundMixer : public Snapshotable
{
public:
@@ -29,6 +34,10 @@ private:
static const uint32_t MaxSamplesPerFrame = MaxSampleRate / 60 * 4 * 2; //x4 to allow CPU overclocking up to 10x, x2 for panning stereo
static const uint32_t MaxChannelCount = 11;
+ unique_ptr _eqFrequencyGrid;
+ unique_ptr _equalizerLeft;
+ unique_ptr _equalizerRight;
+
CrossFeedFilter _crossFeedFilter;
LowPassFilter _lowPassFilter;
StereoPanningFilter _stereoPanning;
@@ -59,6 +68,9 @@ private:
void EndFrame(uint32_t time);
void UpdateRates(bool forceUpdate);
+
+ void UpdateEqualizers(bool forceUpdate);
+ void ApplyEqualizer(orfanidis_eq::eq1* equalizer, size_t sampleCount);
protected:
virtual void StreamState(bool saving) override;
diff --git a/GUI.NET/Config/AudioInfo.cs b/GUI.NET/Config/AudioInfo.cs
index 4aaa20af..c94f5cd6 100644
--- a/GUI.NET/Config/AudioInfo.cs
+++ b/GUI.NET/Config/AudioInfo.cs
@@ -57,6 +57,30 @@ namespace Mesen.GUI.Config
public bool CrossFeedEnabled = false;
[MinMax(0, 100)] public UInt32 CrossFeedRatio = 0;
+ public bool EnableEqualizer = false;
+ public EqualizerFilterType EqualizerFilterType = EqualizerFilterType.Butterworth;
+ public EqualizerPreset EqualizerPreset = EqualizerPreset.Custom;
+ [MinMax(-200, 200)] public Int32 Band1Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band2Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band3Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band4Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band5Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band6Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band7Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band8Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band9Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band10Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band11Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band12Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band13Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band14Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band15Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band16Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band17Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band18Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band19Gain = 0;
+ [MinMax(-200, 200)] public Int32 Band20Gain = 0;
+
public AudioInfo()
{
}
@@ -105,6 +129,50 @@ namespace Mesen.GUI.Config
InteropEmu.SetChannelPanning(AudioChannel.Namco163, ConvertPanning(audioInfo.Namco163Panning));
InteropEmu.SetChannelPanning(AudioChannel.Sunsoft5B, ConvertPanning(audioInfo.Sunsoft5bPanning));
+ InteropEmu.SetEqualizerFilterType(audioInfo.EnableEqualizer ? audioInfo.EqualizerFilterType : EqualizerFilterType.None);
+
+ if(audioInfo.EqualizerPreset < EqualizerPreset.TwinFamicom60) {
+ double[] defaultBands = new double[20] { 40, 56, 80, 113, 160, 225, 320, 450, 600, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 10000, 12500, 15000 };
+ InteropEmu.SetEqualizerBands(defaultBands, (UInt32)defaultBands.Length);
+
+ InteropEmu.SetBandGain(0, (double)audioInfo.Band1Gain / 10);
+ InteropEmu.SetBandGain(1, (double)audioInfo.Band2Gain / 10);
+ InteropEmu.SetBandGain(2, (double)audioInfo.Band3Gain / 10);
+ InteropEmu.SetBandGain(3, (double)audioInfo.Band4Gain / 10);
+ InteropEmu.SetBandGain(4, (double)audioInfo.Band5Gain / 10);
+ InteropEmu.SetBandGain(5, (double)audioInfo.Band6Gain / 10);
+ InteropEmu.SetBandGain(6, (double)audioInfo.Band7Gain / 10);
+ InteropEmu.SetBandGain(7, (double)audioInfo.Band8Gain / 10);
+ InteropEmu.SetBandGain(8, (double)audioInfo.Band9Gain / 10);
+ InteropEmu.SetBandGain(9, (double)audioInfo.Band10Gain / 10);
+ InteropEmu.SetBandGain(10, (double)audioInfo.Band11Gain / 10);
+ InteropEmu.SetBandGain(11, (double)audioInfo.Band12Gain / 10);
+ InteropEmu.SetBandGain(12, (double)audioInfo.Band13Gain / 10);
+ InteropEmu.SetBandGain(13, (double)audioInfo.Band14Gain / 10);
+ InteropEmu.SetBandGain(14, (double)audioInfo.Band15Gain / 10);
+ InteropEmu.SetBandGain(15, (double)audioInfo.Band16Gain / 10);
+ InteropEmu.SetBandGain(16, (double)audioInfo.Band17Gain / 10);
+ InteropEmu.SetBandGain(17, (double)audioInfo.Band18Gain / 10);
+ InteropEmu.SetBandGain(18, (double)audioInfo.Band19Gain / 10);
+ InteropEmu.SetBandGain(19, (double)audioInfo.Band20Gain / 10);
+ } else {
+ switch(audioInfo.EqualizerPreset) {
+ case EqualizerPreset.TwinFamicom60:
+ double[] bands = new double[60] {
+ 20, 22.5, 25.3, 28.4, 31.9, 35.9, 40.4, 45.4, 51.0, 57.4, 64.5, 72.5, 81.5, 91.6, 103, 116, 130, 146, 165, 185, 208, 234,
+ 263, 295, 332, 373, 420, 472, 531, 596, 671, 754, 848, 953, 1070, 1200, 1350, 1520, 1710, 1920, 2160, 2430, 2730,
+ 3070, 3450, 3880, 4370, 4910, 5520, 6200, 6970, 7840, 8810, 9910, 11100, 12500, 14100, 15800, 17300, 20000
+ };
+ InteropEmu.SetEqualizerBands(bands, (UInt32)bands.Length);
+
+ double[] gains = new double[60] { -4.4, -4.1, -3.8, -3.5, -3.1, -2.8, -2.3, -1.9, -1.6, -1.3, -1.1, -0.9, -0.7, -0.7, -0.6, -0.6, -0.4, -0.1, 0.0, -0.2, -0.3, -0.4, -0.3, -0.5, -0.3, -0.4, -0.2, -0.2, -0.2, -0.3, -0.3, -0.4, -0.4, -0.3, -0.2, -0.6, -0.5, -0.7, -0.7, -1.1, -1.4, -1.6, -1.9, -2.3, -2.7, -3.1, -3.6, -4.3, -4.7, -5.4, -6.2, -7.0, -7.8, -8.2, -8.8, -9.4, -10.0, -10.6, -10.9, -9.5 };
+ for(int i = 0; i < 60; i++) {
+ InteropEmu.SetBandGain(i, gains[i]);
+ }
+ break;
+ }
+ }
+
InteropEmu.SetSampleRate(audioInfo.SampleRate);
InteropEmu.SetFlag(EmulationFlags.MuteSoundInBackground, audioInfo.MuteSoundInBackground);
@@ -132,4 +200,11 @@ namespace Mesen.GUI.Config
}
}
}
+
+ public enum EqualizerPreset
+ {
+ Custom = 0,
+ TwinFamicom,
+ TwinFamicom60
+ }
}
diff --git a/GUI.NET/Controls/ctrlTrackbar.Designer.cs b/GUI.NET/Controls/ctrlTrackbar.Designer.cs
index 58282a85..d9949cb9 100644
--- a/GUI.NET/Controls/ctrlTrackbar.Designer.cs
+++ b/GUI.NET/Controls/ctrlTrackbar.Designer.cs
@@ -42,6 +42,7 @@
this.tableLayoutPanel1.Controls.Add(this.lblText, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.trackBar, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.txtValue, 0, 1);
+ this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
@@ -49,16 +50,18 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tableLayoutPanel1.Size = new System.Drawing.Size(62, 160);
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(34, 160);
this.tableLayoutPanel1.TabIndex = 0;
//
// lblText
//
this.lblText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lblText.AutoSize = true;
- this.lblText.Location = new System.Drawing.Point(3, 147);
+ this.lblText.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblText.Location = new System.Drawing.Point(0, 148);
+ this.lblText.Margin = new System.Windows.Forms.Padding(0);
this.lblText.Name = "lblText";
- this.lblText.Size = new System.Drawing.Size(56, 13);
+ this.lblText.Size = new System.Drawing.Size(34, 12);
this.lblText.TabIndex = 14;
this.lblText.Text = "Text";
this.lblText.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -67,12 +70,12 @@
//
this.trackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
- this.trackBar.Location = new System.Drawing.Point(17, 0);
+ this.trackBar.Location = new System.Drawing.Point(0, 0);
this.trackBar.Margin = new System.Windows.Forms.Padding(0);
this.trackBar.Maximum = 100;
this.trackBar.Name = "trackBar";
this.trackBar.Orientation = System.Windows.Forms.Orientation.Vertical;
- this.trackBar.Size = new System.Drawing.Size(45, 124);
+ this.trackBar.Size = new System.Drawing.Size(34, 125);
this.trackBar.TabIndex = 13;
this.trackBar.TickFrequency = 10;
this.trackBar.Value = 50;
@@ -80,14 +83,14 @@
//
// txtValue
//
- this.txtValue.Anchor = System.Windows.Forms.AnchorStyles.None;
+ this.txtValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtValue.BackColor = System.Drawing.Color.White;
this.txtValue.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.txtValue.Location = new System.Drawing.Point(15, 127);
+ this.txtValue.Location = new System.Drawing.Point(3, 128);
this.txtValue.Multiline = true;
this.txtValue.Name = "txtValue";
this.txtValue.ReadOnly = true;
- this.txtValue.Size = new System.Drawing.Size(31, 17);
+ this.txtValue.Size = new System.Drawing.Size(28, 17);
this.txtValue.TabIndex = 15;
this.txtValue.TabStop = false;
this.txtValue.Text = "100";
@@ -100,9 +103,9 @@
this.Controls.Add(this.tableLayoutPanel1);
this.Margin = new System.Windows.Forms.Padding(0);
this.MaximumSize = new System.Drawing.Size(63, 160);
- this.MinimumSize = new System.Drawing.Size(63, 160);
+ this.MinimumSize = new System.Drawing.Size(34, 160);
this.Name = "ctrlTrackbar";
- this.Size = new System.Drawing.Size(63, 160);
+ this.Size = new System.Drawing.Size(34, 160);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar)).EndInit();
diff --git a/GUI.NET/Controls/ctrlTrackbar.cs b/GUI.NET/Controls/ctrlTrackbar.cs
index 414af770..51e66fce 100644
--- a/GUI.NET/Controls/ctrlTrackbar.cs
+++ b/GUI.NET/Controls/ctrlTrackbar.cs
@@ -27,13 +27,18 @@ namespace Mesen.GUI.Controls
}
}
+ public int Minimum
+ {
+ get { return trackBar.Minimum; }
+ set { trackBar.Minimum = value; }
+ }
+
public int Maximum
{
get { return trackBar.Maximum; }
set { trackBar.Maximum = value; }
}
-
-
+
[Bindable(true)]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
@@ -50,13 +55,23 @@ namespace Mesen.GUI.Controls
set
{
trackBar.Value = value;
+ UpdateText();
+ }
+ }
+
+ private void UpdateText()
+ {
+ if(this.Minimum == 0) {
txtValue.Text = trackBar.Value.ToString() + "%";
+ } else {
+ txtValue.Text = (trackBar.Value / 10.0).ToString() + "dB";
+ txtValue.Font = new Font("Microsoft Sans Serif", 6.75F);
}
}
private void trackBar_ValueChanged(object sender, EventArgs e)
{
- txtValue.Text = trackBar.Value.ToString() + "%";
+ UpdateText();
}
}
}
diff --git a/GUI.NET/Dependencies/resources.es.xml b/GUI.NET/Dependencies/resources.es.xml
index 974f17e5..c715be9b 100644
--- a/GUI.NET/Dependencies/resources.es.xml
+++ b/GUI.NET/Dependencies/resources.es.xml
@@ -163,6 +163,9 @@
VRC7
Namco
Sunsoft
+
+ Equalizer
+ Enable equalizer