2015-07-17 20:58:57 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Drawing.Imaging;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Config
|
|
|
|
|
{
|
|
|
|
|
public class AudioInfo
|
|
|
|
|
{
|
2016-01-17 22:16:20 -05:00
|
|
|
|
public string AudioDevice = "";
|
2015-07-17 20:58:57 -04:00
|
|
|
|
public bool EnableAudio = true;
|
2016-01-14 08:42:00 -05:00
|
|
|
|
public UInt32 AudioLatency = 100;
|
2016-01-14 01:21:09 -05:00
|
|
|
|
public UInt32 MasterVolume = 100;
|
2016-01-14 08:42:00 -05:00
|
|
|
|
public UInt32 Square1Volume = 100;
|
|
|
|
|
public UInt32 Square2Volume = 100;
|
|
|
|
|
public UInt32 TriangleVolume = 100;
|
|
|
|
|
public UInt32 NoiseVolume = 100;
|
|
|
|
|
public UInt32 DmcVolume = 100;
|
2016-01-14 19:33:16 -05:00
|
|
|
|
public UInt32 SampleRate = 44100;
|
2015-07-17 20:58:57 -04:00
|
|
|
|
|
|
|
|
|
public AudioInfo()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static private double ConvertVolume(UInt32 volume)
|
|
|
|
|
{
|
|
|
|
|
if(ConfigManager.Config.AudioInfo.EnableAudio) {
|
2016-01-14 01:21:09 -05:00
|
|
|
|
return ((double)volume / 100d);
|
2015-07-17 20:58:57 -04:00
|
|
|
|
} else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static public void ApplyConfig()
|
|
|
|
|
{
|
|
|
|
|
AudioInfo audioInfo = ConfigManager.Config.AudioInfo;
|
2016-01-17 22:16:20 -05:00
|
|
|
|
InteropEmu.SetAudioDevice(audioInfo.AudioDevice);
|
2015-07-17 20:58:57 -04:00
|
|
|
|
InteropEmu.SetAudioLatency(audioInfo.AudioLatency);
|
2016-01-14 17:40:59 -05:00
|
|
|
|
InteropEmu.SetMasterVolume(audioInfo.MasterVolume / 10d);
|
2015-07-17 20:58:57 -04:00
|
|
|
|
InteropEmu.SetChannelVolume(0, ConvertVolume(audioInfo.Square1Volume));
|
|
|
|
|
InteropEmu.SetChannelVolume(1, ConvertVolume(audioInfo.Square2Volume));
|
|
|
|
|
InteropEmu.SetChannelVolume(2, ConvertVolume(audioInfo.TriangleVolume));
|
|
|
|
|
InteropEmu.SetChannelVolume(3, ConvertVolume(audioInfo.NoiseVolume));
|
|
|
|
|
InteropEmu.SetChannelVolume(4, ConvertVolume(audioInfo.DmcVolume));
|
2016-01-14 19:33:16 -05:00
|
|
|
|
InteropEmu.SetSampleRate(audioInfo.SampleRate);
|
2015-07-17 20:58:57 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|