Skip to content

Commit

Permalink
fix: Audio stops occasionally when opening EqualizerDialog.
Browse files Browse the repository at this point in the history
fix: Incorrect spectrogram generation due to wrong fftsize.
  • Loading branch information
itsAbhi650 committed Jul 9, 2023
1 parent debb3cd commit 8db4c6f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
3 changes: 1 addition & 2 deletions YAMP-alpha/EqualizerDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 6 additions & 13 deletions YAMP-alpha/EqualizerDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public partial class EqualizerDialog : Form
public EqualizerDialog()
{
InitializeComponent();
formsPlot1.Plot.Frameless(true);
formsPlot1.Plot.Margins(0);
SpectroBitmap = new Bitmap(2000, 600);
}

private void EqualizerDialog_Load(object sender, EventArgs e)
{
formsPlot1.Plot.Frameless(true);
formsPlot1.Plot.Margins(0);
SpectroBitmap = new Bitmap(2140, 702);
CmbBx_ColMap.DataSource = Colormap.GetColormapNames();
CmbBx_RotateGraph.DataSource = Enum.GetNames(typeof(RotateFlipType)).Select(x => x.Remove(0, "Rotate".Length)).ToArray();
CmbBx_ImgMode.DataSource = Enum.GetNames(typeof(PictureBoxSizeMode));
Expand All @@ -62,14 +62,10 @@ private void EqualizerDialog_Load(object sender, EventArgs e)
ChannelCount = YAMPVars.CORE.PlayerSource.WaveFormat.Channels;
YAMPVars.NotificationSource.BlockRead += NotificationSource_BlockRead;
YAMPVars.SingleBlockNotificationStream.SingleBlockRead += SingleBlockNotificationStream_SingleBlockRead;
YAMPVars.FftProvider = new FftProvider(ChannelCount, FftSize.Fft1024)
{
WindowFunction = WindowFunctions.Hanning
};
YAMPVars.FftProvider = new FftProvider(ChannelCount, FftSize.Fft4096);
FFTSIZE = YAMPVars.FftProvider.FftSize;
SpectroScott = new SpectrogramGenerator(SampleRate, 1024, 512) { OffsetHz = 10000 };
SpectroScott = new SpectrogramGenerator(SampleRate, 4096, 512) { OffsetHz = 20 };

pictureBox1.Height = SpectroScott.Height;
SpectroScott.SetFixedWidth(Pb_SpectrogramAdv.Width);
SpectrumProvider = new BasicSpectrumProvider(ChannelCount, SampleRate, FFTSIZE);
Spectrum = new VoicePrint3DSpectrum(FFTSIZE)
Expand All @@ -88,8 +84,6 @@ private void EqualizerDialog_Load(object sender, EventArgs e)
GainBand.ValueChanged += GainBand_ValueChanged;
Scope.Start();
Spectrogram.Start();
splitContainer1.Panel2.Controls.Add(VolBand);
splitContainer1.Panel2.Controls.Add(GainBand);
for (int i = 0; i < YAMPVars.EqualizerEffect.SampleFilters.Count; i++)
{
EqualizerFilter item = YAMPVars.EqualizerEffect.SampleFilters[i];
Expand Down Expand Up @@ -134,9 +128,8 @@ private void NotificationSource_BlockRead(object sender, BlockReadEventArgs<floa

private void SingleBlockNotificationStream_SingleBlockRead(object sender, SingleBlockReadEventArgs e)
{
YAMPVars.FftProvider.Add(e.Left, e.Right);
SpectrumProvider.Add(e.Left, e.Right);

YAMPVars.FftProvider.Add(e.Left, e.Right);
}

private void GainBand_ValueChanged(object sender, EventArgs e)
Expand Down
Binary file modified YAMP-alpha/bin/Debug/YAMP-alpha.exe
Binary file not shown.
Binary file modified YAMP-alpha/bin/Debug/YAMP-alpha.pdb
Binary file not shown.

0 comments on commit 8db4c6f

Please sign in to comment.