Skip to content

Commit

Permalink
Merge pull request #409 from ogamespec/main
Browse files Browse the repository at this point in the history
Fixes in RegDump (NSFPlayer)
  • Loading branch information
ogamespec committed May 19, 2023
2 parents 4f2d16a + 69f5f43 commit 9301d89
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 130 deletions.
6 changes: 3 additions & 3 deletions BreaksAPU/NSFPlayer/FormMain.cs
Expand Up @@ -846,14 +846,14 @@ private void saveSampleBufferAsWAVToolStripMenuItem_Click(object sender, EventAr
{
var settings = FormSettings.LoadSettings();
Dma = true;
SaveWav(saveFileDialogWAV.FileName, SampleBuf, settings.OutputSampleRate);
SaveWav(saveFileDialogWAV.FileName, SampleBuf, settings.OutputSampleRate, settings.DC);
Dma = false;
}
}

// https://stackoverflow.com/questions/14659684/creating-a-wav-file-in-c-sharp

private void SaveWav(string filename, List<float> samples, int samplerate)
private void SaveWav(string filename, List<float> samples, int samplerate, float DC)
{
int numsamples = samples.Count;
ushort numchannels = 1;
Expand All @@ -880,7 +880,7 @@ private void SaveWav(string filename, List<float> samples, int samplerate)

foreach (var sample in samples)
{
short value = (short)((sample - 0.5f) * Int16.MaxValue);
short value = (short)((sample + DC) * Int16.MaxValue);
wr.Write(value);
}

Expand Down

0 comments on commit 9301d89

Please sign in to comment.