DSP HLE: Fixed a sound problem with a new Setup.h option. For some reason all the SoundSyncEvent->Set() caused a lot of static for me in Wario Land.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2236 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-02-14 01:07:20 +00:00
parent 94ee9afdb2
commit 94583cbab0
17 changed files with 215 additions and 167 deletions

View File

@ -18,7 +18,7 @@
////////////////////////////////////////////////////////////////////////////////////////
// File description
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Compilation settings. This file can be kept on the ignore list in your SVN program. It
allows local optional settings depending on what works on your computer.
@ -29,7 +29,7 @@
////////////////////////////////////////////////////////////////////////////////////////
// Settings
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// This may fix a problem with Stop and Start that I described in the comments to revision 2,139
//#define SETUP_FREE_PLUGIN_ON_BOOT
@ -37,4 +37,10 @@
// This may fix a semi-frequent hanging that occured when I used single core and render to main frame
//#define SETUP_AVOID_SINGLE_CORE_HANG_ON_STOP
//////////////////////////
// This may remove sound artifacts in Wario Land Shake It and perhaps other games
//#define SETUP_AVOID_SOUND_ARTIFACTS
// Build with music modification
//#define MUSICMOD
///////////////////////////

View File

@ -37,19 +37,31 @@ bool WaveFileWriter::Start(const char *filename)
if (!conv_buffer)
conv_buffer = new short[BUF_SIZE];
// Check if the file is already open
if (file)
{
PanicAlert("The file %s was alrady open, the file header will not be written.", filename);
return false;
}
file = fopen(filename, "wb");
if (!file)
{
PanicAlert("The file %s could not be opened for writing. Please check if it's already opened by another program.", filename);
return false;
}
// ---------------------------------------------------------
// Write file header
// ---------------
Write4("RIFF");
Write(100 * 1000 * 1000); // write big value in case the file gets truncated
Write4("WAVE");
Write4("fmt ");
Write(16); // size of fmt block
Write(0x00020001); //two channels, uncompressed
const u32 sample_rate = 32000;
//const u32 sample_rate = 32000;
const u32 sample_rate = 48000;
Write(sample_rate);
Write(sample_rate * 2 * 2); //two channels, 16bit
Write(0x00100004);
@ -58,8 +70,9 @@ bool WaveFileWriter::Start(const char *filename)
// We are now at offset 44
if (ftell(file) != 44)
PanicAlert("wrong offset: %i", ftell(file));
// ---------------------------
return true;
return true;
}
void WaveFileWriter::Stop()
@ -92,10 +105,8 @@ void WaveFileWriter::AddStereoSamples(const short *sample_data, int count)
if (skip_silence) {
bool all_zero = true;
for (int i = 0; i < count * 2; i++)
if (sample_data[i])
all_zero = false;
if (all_zero)
return;
if (sample_data[i]) all_zero = false;
if (all_zero) return;
}
fwrite(sample_data, count * 4, 1, file);
audio_size += count * 4;

View File

@ -37,7 +37,7 @@
//////////////////////////////////////////////////
// Music mod
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#include "../../../../Externals/MusicMod/Main/Src/Setup.h" // Define MUSICMOD here
#include "Setup.h" // Define MUSICMOD here
#ifdef MUSICMOD
#include "../../../../Externals/MusicMod/Main/Src/Main.h"
#endif

View File

@ -23,7 +23,7 @@
//////////////////////////////////////////////////
// Music mod
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#include "../../../../Externals/MusicMod/Main/Src/Setup.h" // Define MUSICMOD here
#include "Setup.h" // Define MUSICMOD here
#ifdef MUSICMOD
#include "../../../../Externals/MusicMod/Main/Src/Main.h"
#endif

View File

@ -57,7 +57,7 @@
#include "ConfigMain.h"
#include "Frame.h"
#include "CodeWindow.h"
#include "../../../Externals/MusicMod/Main/Src/Setup.h"
#include "Setup.h"
#ifdef MUSICMOD
#include "../../../Externals/MusicMod/Main/Src/Main.h" // MusicMod
#endif

View File

@ -22,7 +22,7 @@
#define _GLOBALS_H
#include "Common.h"
#include "../../../Externals/MusicMod/Main/Src/Setup.h" // Build with music modification. Define MUSICMOD here.
#include "Setup.h" // Build with music modification. Define MUSICMOD here.
// Constant Colors
const unsigned long COLOR_GRAY = 0xDCDCDC;