mirror of https://github.com/PCSX2/pcsx2.git
SPU2: Move files from host into main directory
And get rid of the questionable WavFile.
This commit is contained in:
parent
de7bbd6c37
commit
02dc164611
|
@ -277,6 +277,9 @@ set(pcsx2CDVDHeaders
|
|||
# SPU2 sources
|
||||
set(pcsx2SPU2Sources
|
||||
SPU2/ADSR.cpp
|
||||
SPU2/Config.cpp
|
||||
SPU2/ConfigDebug.cpp
|
||||
SPU2/ConfigSoundTouch.cpp
|
||||
SPU2/Debug.cpp
|
||||
SPU2/DplIIdecoder.cpp
|
||||
SPU2/Dma.cpp
|
||||
|
@ -293,12 +296,6 @@ set(pcsx2SPU2Sources
|
|||
SPU2/Wavedump_wav.cpp
|
||||
)
|
||||
|
||||
if(CUBEB_API)
|
||||
list(APPEND pcsx2SPU2Sources SPU2/SndOut_Cubeb.cpp)
|
||||
target_compile_definitions(PCSX2_FLAGS INTERFACE "SPU2X_CUBEB")
|
||||
target_link_libraries(PCSX2_FLAGS INTERFACE cubeb)
|
||||
endif()
|
||||
|
||||
# SPU2 headers
|
||||
set(pcsx2SPU2Headers
|
||||
SPU2/Config.h
|
||||
|
@ -312,9 +309,20 @@ set(pcsx2SPU2Headers
|
|||
SPU2/regs.h
|
||||
SPU2/SndOut.h
|
||||
SPU2/spdif.h
|
||||
SPU2/WavFile.h
|
||||
)
|
||||
|
||||
if(CUBEB_API)
|
||||
list(APPEND pcsx2SPU2Sources SPU2/SndOut_Cubeb.cpp)
|
||||
target_compile_definitions(PCSX2_FLAGS INTERFACE "SPU2X_CUBEB")
|
||||
target_link_libraries(PCSX2_FLAGS INTERFACE cubeb)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND pcsx2SPU2Sources
|
||||
SPU2/SndOut_XAudio2.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# DEV9 sources
|
||||
set(pcsx2DEV9Sources
|
||||
DEV9/AdapterUtils.cpp
|
||||
|
@ -636,26 +644,7 @@ set(pcsx2GSMetalShaders
|
|||
GS/Renderers/Metal/fxaa.metal
|
||||
)
|
||||
|
||||
list(APPEND pcsx2SPU2Headers
|
||||
SPU2/Host/Config.cpp
|
||||
SPU2/Host/ConfigDebug.cpp
|
||||
SPU2/Host/ConfigSoundTouch.cpp
|
||||
)
|
||||
list(APPEND pcsx2SPU2Headers
|
||||
SPU2/Host/Config.h
|
||||
SPU2/Host/Dialogs.h
|
||||
)
|
||||
if(NOT WIN32)
|
||||
list(APPEND pcsx2SPU2Headers
|
||||
SPU2/WavFile.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND pcsx2SPU2Sources
|
||||
SPU2/Windows/SndOut_XAudio2.cpp
|
||||
)
|
||||
|
||||
list(APPEND pcsx2DEV9Sources
|
||||
DEV9/Win32/pcap_io_win32.cpp
|
||||
DEV9/Win32/tap-win32.cpp
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
#include <cmath>
|
||||
|
||||
#include "SPU2/Global.h"
|
||||
#include "SPU2/Host/Config.h"
|
||||
#include "SPU2/Host/Dialogs.h"
|
||||
#include "SPU2/Config.h"
|
||||
#include "HostSettings.h"
|
||||
|
||||
int AutoDMAPlayRate[2] = {0, 0};
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
#include "Global.h"
|
||||
#include <string>
|
||||
#ifdef _WIN32
|
||||
#include <soundtouch\soundtouch\SoundTouch.h>
|
||||
#endif
|
||||
|
||||
namespace soundtouch
|
||||
{
|
||||
class SoundTouch;
|
||||
}
|
||||
|
||||
extern bool DebugEnabled;
|
||||
|
||||
|
@ -66,6 +68,7 @@ extern std::string MemDumpFileName;
|
|||
extern std::string RegDumpFileName;
|
||||
|
||||
extern int Interpolation;
|
||||
|
||||
extern int numSpeakers;
|
||||
extern float FinalVolume; // Global / pre-scale
|
||||
extern bool AdvancedVolumeControl;
|
||||
|
@ -80,15 +83,43 @@ extern float VolumeAdjustLFEdb;
|
|||
|
||||
extern int dplLevel;
|
||||
|
||||
extern int AutoDMAPlayRate[2];
|
||||
|
||||
extern u32 OutputModule;
|
||||
extern int SndOutLatencyMS;
|
||||
extern int SynchMode;
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
const int LATENCY_MAX = 3000;
|
||||
#else
|
||||
const int LATENCY_MAX = 750;
|
||||
#endif
|
||||
|
||||
const int LATENCY_MIN = 3;
|
||||
const int LATENCY_MIN_TIMESTRETCH = 15;
|
||||
|
||||
namespace SoundtouchCfg
|
||||
{
|
||||
extern void ApplySettings(soundtouch::SoundTouch& sndtouch);
|
||||
}
|
||||
extern const int SequenceLen_Min;
|
||||
extern const int SequenceLen_Max;
|
||||
|
||||
//////
|
||||
extern const int SeekWindow_Min;
|
||||
extern const int SeekWindow_Max;
|
||||
|
||||
extern const int Overlap_Min;
|
||||
extern const int Overlap_Max;
|
||||
|
||||
extern int SequenceLenMS;
|
||||
extern int SeekWindowMS;
|
||||
extern int OverlapMS;
|
||||
|
||||
extern void ReadSettings();
|
||||
extern void ApplySettings(soundtouch::SoundTouch& sndtouch);
|
||||
}; // namespace SoundtouchCfg
|
||||
|
||||
namespace DebugConfig
|
||||
{
|
||||
extern void ReadSettings();
|
||||
} // namespace DebugConfig
|
||||
|
||||
extern void ReadSettings();
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
#include "pcsx2/Config.h"
|
||||
|
||||
#include "SPU2/Global.h"
|
||||
#include "SPU2/Host/Dialogs.h"
|
||||
#include "SPU2/Host/Config.h"
|
||||
#include "SPU2/Config.h"
|
||||
#include "common/FileSystem.h"
|
||||
#include "common/Path.h"
|
||||
#include "common/StringUtil.h"
|
|
@ -16,7 +16,6 @@
|
|||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "SPU2/Global.h"
|
||||
#include "SPU2/Host/Dialogs.h"
|
||||
#include "SPU2/Config.h"
|
||||
#include "SoundTouch.h"
|
||||
#include "HostSettings.h"
|
|
@ -1,102 +0,0 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
extern bool DebugEnabled;
|
||||
|
||||
extern bool _MsgToConsole;
|
||||
extern bool _MsgKeyOnOff;
|
||||
extern bool _MsgVoiceOff;
|
||||
extern bool _MsgDMA;
|
||||
extern bool _MsgAutoDMA;
|
||||
extern bool _MsgOverruns;
|
||||
extern bool _MsgCache;
|
||||
|
||||
extern bool _AccessLog;
|
||||
extern bool _DMALog;
|
||||
extern bool _WaveLog;
|
||||
|
||||
extern bool _CoresDump;
|
||||
extern bool _MemDump;
|
||||
extern bool _RegDump;
|
||||
extern bool _visual_debug_enabled;
|
||||
|
||||
/*static __forceinline bool MsgToConsole() { return _MsgToConsole & DebugEnabled; }
|
||||
|
||||
static __forceinline bool MsgKeyOnOff() { return _MsgKeyOnOff & MsgToConsole(); }
|
||||
static __forceinline bool MsgVoiceOff() { return _MsgVoiceOff & MsgToConsole(); }
|
||||
static __forceinline bool MsgDMA() { return _MsgDMA & MsgToConsole(); }
|
||||
static __forceinline bool MsgAutoDMA() { return _MsgAutoDMA & MsgDMA(); }
|
||||
static __forceinline bool MsgOverruns() { return _MsgOverruns & MsgToConsole(); }
|
||||
static __forceinline bool MsgCache() { return _MsgCache & MsgToConsole(); }
|
||||
|
||||
static __forceinline bool AccessLog() { return _AccessLog & DebugEnabled; }
|
||||
static __forceinline bool DMALog() { return _DMALog & DebugEnabled; }
|
||||
static __forceinline bool WaveLog() { return _WaveLog & DebugEnabled; }
|
||||
|
||||
static __forceinline bool CoresDump() { return _CoresDump & DebugEnabled; }
|
||||
static __forceinline bool MemDump() { return _MemDump & DebugEnabled; }
|
||||
static __forceinline bool RegDump() { return _RegDump & DebugEnabled; }*/
|
||||
|
||||
|
||||
//extern wchar_t AccessLogFileName[255];
|
||||
//extern wchar_t WaveLogFileName[255];
|
||||
//extern wchar_t DMA4LogFileName[255];
|
||||
//extern wchar_t DMA7LogFileName[255];
|
||||
//extern wchar_t CoresDumpFileName[255];
|
||||
//extern wchar_t MemDumpFileName[255];
|
||||
//extern wchar_t RegDumpFileName[255];
|
||||
|
||||
extern int Interpolation;
|
||||
extern float FinalVolume;
|
||||
|
||||
extern int AutoDMAPlayRate[2];
|
||||
|
||||
extern u32 OutputModule;
|
||||
extern int SndOutLatencyMS;
|
||||
|
||||
extern int SynchMode;
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
const int LATENCY_MAX = 3000;
|
||||
#else
|
||||
const int LATENCY_MAX = 750;
|
||||
#endif
|
||||
|
||||
const int LATENCY_MIN = 3;
|
||||
const int LATENCY_MIN_TIMESTRETCH = 15;
|
||||
|
||||
namespace SoundtouchCfg
|
||||
{
|
||||
extern const int SequenceLen_Min;
|
||||
extern const int SequenceLen_Max;
|
||||
|
||||
extern const int SeekWindow_Min;
|
||||
extern const int SeekWindow_Max;
|
||||
|
||||
extern const int Overlap_Min;
|
||||
extern const int Overlap_Max;
|
||||
|
||||
extern int SequenceLenMS;
|
||||
extern int SeekWindowMS;
|
||||
extern int OverlapMS;
|
||||
|
||||
void ReadSettings();
|
||||
}; // namespace SoundtouchCfg
|
||||
|
||||
void ReadSettings();
|
|
@ -1,24 +0,0 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SPU2/Global.h"
|
||||
#include "SPU2/Config.h"
|
||||
|
||||
namespace DebugConfig
|
||||
{
|
||||
extern void ReadSettings();
|
||||
} // namespace DebugConfig
|
|
@ -1,150 +0,0 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Note the file is mostly a copy paste of the WavFile.h from SoundTouch library. It was
|
||||
// shrunken to support only output 16 bits wav files
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include <stdio.h>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "WavFile.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static const char riffStr[] = "RIFF";
|
||||
static const char waveStr[] = "WAVE";
|
||||
static const char fmtStr[] = "fmt ";
|
||||
static const char dataStr[] = "data";
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Class WavOutFile
|
||||
//
|
||||
|
||||
WavOutFile::WavOutFile(const char* fileName, int sampleRate, int bits, int channels)
|
||||
{
|
||||
bytesWritten = 0;
|
||||
fptr = fopen(fileName, "wb");
|
||||
if (fptr == nullptr)
|
||||
{
|
||||
string msg = "Error : Unable to open file \"";
|
||||
msg += fileName;
|
||||
msg += "\" for writing.";
|
||||
//pmsg = msg.c_str;
|
||||
throw runtime_error(msg);
|
||||
}
|
||||
|
||||
fillInHeader(sampleRate, bits, channels);
|
||||
writeHeader();
|
||||
}
|
||||
|
||||
|
||||
WavOutFile::~WavOutFile()
|
||||
{
|
||||
if (fptr)
|
||||
{
|
||||
finishHeader();
|
||||
fclose(fptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WavOutFile::fillInHeader(uint sampleRate, uint bits, uint channels)
|
||||
{
|
||||
// fill in the 'riff' part..
|
||||
|
||||
// copy string 'RIFF' to riff_char
|
||||
memcpy(&(header.riff.riff_char), riffStr, 4);
|
||||
// package_len unknown so far
|
||||
header.riff.package_len = 0;
|
||||
// copy string 'WAVE' to wave
|
||||
memcpy(&(header.riff.wave), waveStr, 4);
|
||||
|
||||
|
||||
// fill in the 'format' part..
|
||||
|
||||
// copy string 'fmt ' to fmt
|
||||
memcpy(&(header.format.fmt), fmtStr, 4);
|
||||
|
||||
header.format.format_len = 0x10;
|
||||
header.format.fixed = 1;
|
||||
header.format.channel_number = (short)channels;
|
||||
header.format.sample_rate = (int)sampleRate;
|
||||
header.format.bits_per_sample = (short)bits;
|
||||
header.format.byte_per_sample = (short)(bits * channels / 8);
|
||||
header.format.byte_rate = header.format.byte_per_sample * (int)sampleRate;
|
||||
header.format.sample_rate = (int)sampleRate;
|
||||
|
||||
// fill in the 'data' part..
|
||||
|
||||
// copy string 'data' to data_field
|
||||
memcpy(&(header.data.data_field), dataStr, 4);
|
||||
// data_len unknown so far
|
||||
header.data.data_len = 0;
|
||||
}
|
||||
|
||||
|
||||
void WavOutFile::finishHeader()
|
||||
{
|
||||
// supplement the file length into the header structure
|
||||
header.riff.package_len = bytesWritten + 36;
|
||||
header.data.data_len = bytesWritten;
|
||||
|
||||
writeHeader();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WavOutFile::writeHeader()
|
||||
{
|
||||
int res;
|
||||
|
||||
// write the supplemented header in the beginning of the file
|
||||
fseek(fptr, 0, SEEK_SET);
|
||||
res = fwrite(&header, sizeof(header), 1, fptr);
|
||||
if (res != 1)
|
||||
{
|
||||
throw runtime_error("Error while writing to a wav file.");
|
||||
}
|
||||
|
||||
// jump back to the end of the file
|
||||
fseek(fptr, 0, SEEK_END);
|
||||
}
|
||||
|
||||
|
||||
void WavOutFile::write(const short* buffer, int numElems)
|
||||
{
|
||||
int res;
|
||||
|
||||
// 16bit format & 16 bit samples
|
||||
|
||||
assert(header.format.bits_per_sample == 16);
|
||||
if (numElems < 1)
|
||||
return; // nothing to do
|
||||
|
||||
res = fwrite(buffer, 2, numElems, fptr);
|
||||
|
||||
if (res != numElems)
|
||||
{
|
||||
throw runtime_error("Error while writing to a wav file.");
|
||||
}
|
||||
bytesWritten += 2 * numElems;
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Note the file is mostly a copy paste of the WavFile.h from SoundTouch library. It was
|
||||
// shrunken to support only output 16 bits wav files
|
||||
|
||||
#ifndef WAVFILE_H
|
||||
#define WAVFILE_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef uint
|
||||
typedef unsigned int uint;
|
||||
#endif
|
||||
|
||||
|
||||
/// WAV audio file 'riff' section header
|
||||
typedef struct
|
||||
{
|
||||
char riff_char[4];
|
||||
int package_len;
|
||||
char wave[4];
|
||||
} WavRiff;
|
||||
|
||||
/// WAV audio file 'format' section header
|
||||
typedef struct
|
||||
{
|
||||
char fmt[4];
|
||||
int format_len;
|
||||
short fixed;
|
||||
short channel_number;
|
||||
int sample_rate;
|
||||
int byte_rate;
|
||||
short byte_per_sample;
|
||||
short bits_per_sample;
|
||||
} WavFormat;
|
||||
|
||||
/// WAV audio file 'data' section header
|
||||
typedef struct
|
||||
{
|
||||
char data_field[4];
|
||||
uint data_len;
|
||||
} WavData;
|
||||
|
||||
|
||||
/// WAV audio file header
|
||||
typedef struct
|
||||
{
|
||||
WavRiff riff;
|
||||
WavFormat format;
|
||||
WavData data;
|
||||
} WavHeader;
|
||||
|
||||
|
||||
/// Class for writing WAV audio files.
|
||||
class WavOutFile
|
||||
{
|
||||
private:
|
||||
/// Pointer to the WAV file
|
||||
FILE* fptr;
|
||||
|
||||
/// WAV file header data.
|
||||
WavHeader header;
|
||||
|
||||
/// Counter of how many bytes have been written to the file so far.
|
||||
int bytesWritten;
|
||||
|
||||
/// Fills in WAV file header information.
|
||||
void fillInHeader(const uint sampleRate, const uint bits, const uint channels);
|
||||
|
||||
/// Finishes the WAV file header by supplementing information of amount of
|
||||
/// data written to file etc
|
||||
void finishHeader();
|
||||
|
||||
/// Writes the WAV file header.
|
||||
void writeHeader();
|
||||
|
||||
public:
|
||||
/// Constructor: Creates a new WAV file. Throws a 'runtime_error' exception
|
||||
/// if file creation fails.
|
||||
WavOutFile(const char* fileName, ///< Filename
|
||||
int sampleRate, ///< Sample rate (e.g. 44100 etc)
|
||||
int bits, ///< Bits per sample (8 or 16 bits)
|
||||
int channels ///< Number of channels (1=mono, 2=stereo)
|
||||
);
|
||||
|
||||
/// Destructor: Finalizes & closes the WAV file.
|
||||
~WavOutFile();
|
||||
|
||||
/// Write data to WAV file. Throws a 'runtime_error' exception if writing to
|
||||
/// file fails.
|
||||
void write(const short* buffer, ///< Pointer to sample data buffer.
|
||||
int numElems ///< How many array items are to be written to file.
|
||||
);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -14,24 +14,21 @@
|
|||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "Global.h"
|
||||
#ifdef __POSIX__
|
||||
#include "WavFile.h"
|
||||
#else
|
||||
#include "soundtouch/source/SoundStretch/WavFile.h"
|
||||
|
||||
#include "SPU2/Global.h"
|
||||
#include "pcsx2/Config.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
#include "common/Path.h"
|
||||
#include "common/StringUtil.h"
|
||||
#endif
|
||||
#include "common/WAVWriter.h"
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
static WavOutFile* _new_WavOutFile(const char* destfile)
|
||||
{
|
||||
return new WavOutFile(destfile, SampleRate, 16, 2);
|
||||
}
|
||||
|
||||
namespace WaveDump
|
||||
{
|
||||
static WavOutFile* m_CoreWav[2][CoreSrc_Count];
|
||||
static std::unique_ptr<Common::WAVWriter> m_CoreWav[2][CoreSrc_Count];
|
||||
|
||||
static const char* m_tbl_CoreOutputTypeNames[CoreSrc_Count] =
|
||||
{
|
||||
|
@ -49,29 +46,18 @@ namespace WaveDump
|
|||
if (!WaveLog())
|
||||
return;
|
||||
|
||||
char wavfilename[256];
|
||||
|
||||
for (uint cidx = 0; cidx < 2; cidx++)
|
||||
{
|
||||
for (int srcidx = 0; srcidx < CoreSrc_Count; srcidx++)
|
||||
{
|
||||
safe_delete(m_CoreWav[cidx][srcidx]);
|
||||
#ifdef __POSIX__
|
||||
sprintf(wavfilename, "logs/spu2x-Core%ud-%s.wav",
|
||||
cidx, m_tbl_CoreOutputTypeNames[srcidx]);
|
||||
#else
|
||||
sprintf(wavfilename, "logs\\spu2x-Core%ud-%s.wav",
|
||||
cidx, m_tbl_CoreOutputTypeNames[srcidx]);
|
||||
#endif
|
||||
m_CoreWav[cidx][srcidx].reset();
|
||||
|
||||
try
|
||||
std::string wavfilename(Path::Combine(EmuFolders::Logs, fmt::format("spu2x-Core{}d-{}.wav", cidx, m_tbl_CoreOutputTypeNames[srcidx])));
|
||||
m_CoreWav[cidx][srcidx] = std::make_unique<Common::WAVWriter>();
|
||||
if (!m_CoreWav[cidx][srcidx]->Open(wavfilename.c_str(), SampleRate, 2))
|
||||
{
|
||||
m_CoreWav[cidx][srcidx] = _new_WavOutFile(wavfilename);
|
||||
}
|
||||
catch (std::runtime_error& ex)
|
||||
{
|
||||
printf("SPU2 > %s.\n\tWave Log for this core source disabled.", ex.what());
|
||||
m_CoreWav[cidx][srcidx] = nullptr;
|
||||
Console.Error(fmt::format("Failed to open '{}'. Wave Log for this core source disabled.", wavfilename));
|
||||
m_CoreWav[cidx][srcidx].reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,9 +70,7 @@ namespace WaveDump
|
|||
for (uint cidx = 0; cidx < 2; cidx++)
|
||||
{
|
||||
for (int srcidx = 0; srcidx < CoreSrc_Count; srcidx++)
|
||||
{
|
||||
safe_delete(m_CoreWav[cidx][srcidx]);
|
||||
}
|
||||
m_CoreWav[cidx][srcidx].reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +79,7 @@ namespace WaveDump
|
|||
if (!IsDevBuild)
|
||||
return;
|
||||
if (m_CoreWav[coreidx][src] != nullptr)
|
||||
m_CoreWav[coreidx][src]->write((s16*)&sample, 2);
|
||||
m_CoreWav[coreidx][src]->WriteFrames(reinterpret_cast<const s16*>(&sample), 1);
|
||||
}
|
||||
|
||||
void WriteCore(uint coreidx, CoreSourceType src, s16 left, s16 right)
|
||||
|
@ -104,54 +88,39 @@ namespace WaveDump
|
|||
}
|
||||
} // namespace WaveDump
|
||||
|
||||
#include "common/Threading.h"
|
||||
|
||||
using namespace Threading;
|
||||
|
||||
bool WavRecordEnabled = false;
|
||||
|
||||
static WavOutFile* m_wavrecord = nullptr;
|
||||
static std::unique_ptr<Common::WAVWriter> m_wavrecord;
|
||||
static std::mutex WavRecordMutex;
|
||||
|
||||
bool RecordStart(const std::string* filename)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::unique_lock lock(WavRecordMutex);
|
||||
safe_delete(m_wavrecord);
|
||||
if (filename)
|
||||
#ifdef _WIN32
|
||||
m_wavrecord = new WavOutFile(_wfopen(StringUtil::UTF8StringToWideString(*filename).c_str(), L"wb"), SampleRate, 16, 2);
|
||||
#else
|
||||
m_wavrecord = new WavOutFile(filename->c_str(), SampleRate, 16, 2);
|
||||
#endif
|
||||
else
|
||||
m_wavrecord = new WavOutFile("audio_recording.wav", SampleRate, 16, 2);
|
||||
WavRecordEnabled = true;
|
||||
return true;
|
||||
}
|
||||
catch (std::runtime_error&)
|
||||
m_wavrecord.reset();
|
||||
m_wavrecord = std::make_unique<Common::WAVWriter>();
|
||||
if (!m_wavrecord->Open(m_wavrecord ? filename->c_str() : "audio_recording.wav", SampleRate, 2))
|
||||
{
|
||||
m_wavrecord = nullptr; // not needed, but what the heck. :)
|
||||
if (filename)
|
||||
Console.Error("SPU2 couldn't open file for recording: %s.\nWavfile capture disabled.", filename->c_str());
|
||||
else
|
||||
Console.Error("SPU2 couldn't open file for recording: audio_recording.wav.\nWavfile capture disabled.");
|
||||
Console.Error("SPU2 couldn't open file for recording: %s.\nWavfile capture disabled.", filename ? filename->c_str() : "audio_recording.wav");
|
||||
m_wavrecord.reset();
|
||||
WavRecordEnabled = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
WavRecordEnabled = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void RecordStop()
|
||||
{
|
||||
WavRecordEnabled = false;
|
||||
std::unique_lock lock(WavRecordMutex);
|
||||
safe_delete(m_wavrecord);
|
||||
WavRecordEnabled = false;
|
||||
m_wavrecord.reset();
|
||||
}
|
||||
|
||||
void RecordWrite(const StereoOut16& sample)
|
||||
{
|
||||
std::unique_lock lock(WavRecordMutex);
|
||||
if (m_wavrecord == nullptr)
|
||||
if (!m_wavrecord)
|
||||
return;
|
||||
m_wavrecord->write((s16*)&sample, 2);
|
||||
m_wavrecord->WriteFrames(reinterpret_cast<const s16*>(&sample), 2);
|
||||
}
|
||||
|
|
|
@ -14,14 +14,11 @@
|
|||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "Global.h"
|
||||
#include "spu2.h"
|
||||
#include "Dma.h"
|
||||
#include "Host/Dialogs.h"
|
||||
#include "SPU2/Global.h"
|
||||
#include "SPU2/spu2.h"
|
||||
#include "SPU2/Dma.h"
|
||||
#include "R3000A.h"
|
||||
|
||||
using namespace Threading;
|
||||
|
||||
static int ConsoleSampleRate = 48000;
|
||||
int SampleRate = 48000;
|
||||
|
||||
|
|
|
@ -243,17 +243,18 @@
|
|||
<ClCompile Include="Recording\InputRecordingFile.cpp" />
|
||||
<ClCompile Include="Recording\PadData.cpp" />
|
||||
<ClCompile Include="Recording\Utilities\InputRecordingLogger.cpp" />
|
||||
<ClCompile Include="SPU2\Config.cpp" />
|
||||
<ClCompile Include="SPU2\ConfigDebug.cpp" />
|
||||
<ClCompile Include="SPU2\ConfigSoundTouch.cpp" />
|
||||
<ClCompile Include="SPU2\Debug.cpp" />
|
||||
<ClCompile Include="SPU2\Dma.cpp" />
|
||||
<ClCompile Include="SPU2\DplIIdecoder.cpp" />
|
||||
<ClCompile Include="SPU2\debug.cpp" />
|
||||
<ClCompile Include="SPU2\Host\Config.cpp" />
|
||||
<ClCompile Include="SPU2\Host\ConfigDebug.cpp" />
|
||||
<ClCompile Include="SPU2\Host\ConfigSoundTouch.cpp" />
|
||||
<ClCompile Include="SPU2\RegLog.cpp" />
|
||||
<ClCompile Include="SPU2\SndOut_Cubeb.cpp" />
|
||||
<ClCompile Include="SPU2\SndOut_XAudio2.cpp" />
|
||||
<ClCompile Include="SPU2\wavedump_wav.cpp" />
|
||||
<ClCompile Include="SPU2\SndOut.cpp" />
|
||||
<ClCompile Include="SPU2\Timestretcher.cpp" />
|
||||
<ClCompile Include="SPU2\dma.cpp" />
|
||||
<ClCompile Include="SPU2\RegTable.cpp" />
|
||||
<ClCompile Include="SPU2\spu2freeze.cpp" />
|
||||
<ClCompile Include="SPU2\spu2sys.cpp" />
|
||||
|
@ -330,7 +331,6 @@
|
|||
<ClCompile Include="GS\Renderers\Common\GSVertexTraceFMM.cpp" />
|
||||
<ClCompile Include="GS\GSXXH.cpp" />
|
||||
<ClCompile Include="GS\MultiISA.cpp" />
|
||||
<ClCompile Include="SPU2\Windows\SndOut_XAudio2.cpp" />
|
||||
<ClCompile Include="StateWrapper.cpp" />
|
||||
<ClCompile Include="USB\deviceproxy.cpp" />
|
||||
<ClCompile Include="USB\qemu-usb\bus.cpp" />
|
||||
|
@ -600,14 +600,13 @@
|
|||
<ClInclude Include="ShaderCacheVersion.h" />
|
||||
<ClInclude Include="SioTypes.h" />
|
||||
<ClInclude Include="SPU2\Config.h" />
|
||||
<ClInclude Include="SPU2\Debug.h" />
|
||||
<ClInclude Include="SPU2\Dma.h" />
|
||||
<ClInclude Include="SPU2\Global.h" />
|
||||
<ClInclude Include="SPU2\Host\Config.h" />
|
||||
<ClInclude Include="SPU2\Host\Dialogs.h" />
|
||||
<ClInclude Include="SPU2\interpolate_table.h" />
|
||||
<ClInclude Include="SPU2\SndOut.h" />
|
||||
<ClInclude Include="SPU2\spdif.h" />
|
||||
<ClInclude Include="SPU2\defs.h" />
|
||||
<ClInclude Include="SPU2\Dma.h" />
|
||||
<ClInclude Include="SPU2\regs.h" />
|
||||
<ClInclude Include="SPU2\Mixer.h" />
|
||||
<ClInclude Include="SPU2\spu2.h" />
|
||||
|
|
|
@ -833,9 +833,6 @@
|
|||
<ClCompile Include="FW.cpp">
|
||||
<Filter>System\Ps2\Iop\FW</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\Dma.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\spu2.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
|
@ -851,9 +848,6 @@
|
|||
<ClCompile Include="SPU2\ADSR.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\Debug.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\DplIIdecoder.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1232,15 +1226,6 @@
|
|||
<ClCompile Include="Frontend\XInputSource.cpp">
|
||||
<Filter>Host</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\Host\ConfigDebug.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\Host\ConfigSoundTouch.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\Host\Config.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Frontend\HostSettings.cpp">
|
||||
<Filter>Host</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1256,9 +1241,6 @@
|
|||
<ClCompile Include="PAD\Host\StateManagement.cpp">
|
||||
<Filter>System\Ps2\PAD</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\Windows\SndOut_XAudio2.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="windows\Optimus.cpp">
|
||||
<Filter>Host</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1416,6 +1398,24 @@
|
|||
<ClCompile Include="USB\usb-pad\usb-pad-sdl-ff.cpp">
|
||||
<Filter>System\Ps2\USB\usb-pad</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\Config.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\ConfigDebug.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\ConfigSoundTouch.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\Debug.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\Dma.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SPU2\SndOut_XAudio2.cpp">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Patch.h">
|
||||
|
@ -1787,9 +1787,6 @@
|
|||
<ClInclude Include="SPU2\defs.h">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SPU2\Dma.h">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SPU2\Global.h">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClInclude>
|
||||
|
@ -2172,12 +2169,6 @@
|
|||
<ClInclude Include="Frontend\XInputSource.h">
|
||||
<Filter>Host</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SPU2\Host\Config.h">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SPU2\Host\Dialogs.h">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HostSettings.h">
|
||||
<Filter>Host</Filter>
|
||||
</ClInclude>
|
||||
|
@ -2363,6 +2354,12 @@
|
|||
<ClInclude Include="USB\usb-pad\usb-pad-sdl-ff.h">
|
||||
<Filter>System\Ps2\USB\usb-pad</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SPU2\Debug.h">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SPU2\Dma.h">
|
||||
<Filter>System\Ps2\SPU2</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuildStep Include="rdebug\deci2.h">
|
||||
|
|
Loading…
Reference in New Issue