Skip to content

Commit

Permalink
Cleaned up formatting and removed un-needed code
Browse files Browse the repository at this point in the history
  • Loading branch information
RisingFog committed Sep 29, 2014
1 parent 6c024cf commit 495cae6
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 126 deletions.
4 changes: 2 additions & 2 deletions Source/Core/AudioCommon/AudioCommon.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<ClCompile Include="aldlist.cpp" />
<ClCompile Include="AudioCommon.cpp" />
<ClCompile Include="DPL2Decoder.cpp" />
<ClCompile Include="AudioDumper.cpp" />
<ClCompile Include="AudioDumper.cpp" />
<ClCompile Include="Mixer.cpp" />
<ClCompile Include="NullSoundStream.cpp" />
<ClCompile Include="OpenALStream.cpp" />
Expand All @@ -55,7 +55,7 @@
<ClInclude Include="AudioCommon.h" />
<ClInclude Include="CoreAudioSoundStream.h" />
<ClInclude Include="DPL2Decoder.h" />
<ClInclude Include="AudioDumper.h" />
<ClInclude Include="AudioDumper.h" />
<ClInclude Include="Mixer.h" />
<ClInclude Include="NullSoundStream.h" />
<ClInclude Include="OpenALStream.h" />
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/AudioCommon/AudioCommon.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<ClCompile Include="XAudio2_7Stream.cpp">
<Filter>SoundStreams</Filter>
</ClCompile>
<ClCompile Include="AudioDumper.cpp" />
<ClCompile Include="AudioDumper.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="aldlist.h" />
Expand Down Expand Up @@ -59,7 +59,7 @@
<ClInclude Include="AlsaSoundStream.h">
<Filter>SoundStreams</Filter>
</ClInclude>
<ClInclude Include="AudioDumper.h" />
<ClInclude Include="AudioDumper.h" />
</ItemGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />
Expand Down
21 changes: 4 additions & 17 deletions Source/Core/AudioCommon/AudioCommonConfig.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
// Copyright (C) 2003 Dolphin Project.

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.

// This program 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 2.0 for more details.

// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/

// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.

#include "AudioCommon.h"
#include "CommonPaths.h"
#include "FileUtil.h"
#include "../../Core/Src/ConfigManager.h"
#include "Core/ConfigManager.h"

AudioCommonConfig ac_Config;

Expand Down
29 changes: 6 additions & 23 deletions Source/Core/AudioCommon/AudioCommonConfig.h
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
// Copyright (C) 2003 Dolphin Project.
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.

// This program 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 2.0 for more details.

// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/

// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _AUDIO_COMMON_CONFIG_H_
#define _AUDIO_COMMON_CONFIG_H_
#pragma once

#include <string>
#include "Common/IniFile.h"

// Backend Types
#define BACKEND_NULLSOUND "No audio output"
#define BACKEND_ALSA "ALSA"
#define BACKEND_AOSOUND "AOSound"
#define BACKEND_AOSOUND "AOSound"
#define BACKEND_COREAUDIO "CoreAudio"
#define BACKEND_DIRECTSOUND "DSound"
#define BACKEND_OPENAL "OpenAL"
#define BACKEND_PULSEAUDIO "Pulse"
#define BACKEND_XAUDIO2 "XAudio2"
#define BACKEND_XAUDIO2 "XAudio2"

struct AudioCommonConfig
{
Expand All @@ -49,5 +34,3 @@ struct AudioCommonConfig
// Update according to the values (stream/mixer)
void Update();
};

#endif //AUDIO_COMMON_CONFIG
31 changes: 5 additions & 26 deletions Source/Core/AudioCommon/AudioDumper.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
#include <string>
#include <sstream>
#include <string>

#include "AudioCommon/AudioDumper.h"
#include "Common/Common.h"
#include "AudioDumper.h"
#include "Common/FileUtil.h"

/* automatically dumps to a series of files, splitting segments whenever sample rate (supplied per block) changes
or 2GB is reached
*/





/*
if (ac_Config.m_DumpAudio)
{
std::string audio_file_name = File::GetUserPath(D_DUMPAUDIO_IDX) + "audiodump.wav";
File::CreateFullPath(audio_file_name);
mixer->StartLogAudio(audio_file_name.c_str());
}
*/

AudioDumper::AudioDumper (std::string _basename)
AudioDumper::AudioDumper(const std::string& _basename)
{
currentrate = 0;
fileopen = false;
Expand Down Expand Up @@ -60,26 +47,18 @@ bool AudioDumper::checkem (int srate)
fileindex++;
}
return true;

}

void AudioDumper::dumpsamplesBE (const short *buff, int nsamp, int srate)
void AudioDumper::DumpSamplesBE (const short *buff, int nsamp, int srate)
{
if (!checkem (srate))
return;
wfr.AddStereoSamplesBE (buff, nsamp);
}

void AudioDumper::dumpsamples (const short *buff, int nsamp, int srate)
void AudioDumper::DumpSamples (const short *buff, int nsamp, int srate)
{
if (!checkem (srate))
return;
wfr.AddStereoSamples (buff, nsamp);
}







21 changes: 6 additions & 15 deletions Source/Core/AudioCommon/AudioDumper.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#ifndef _AUDIODUMPER_H
#define _AUDIODUMPER_H
#pragma once

#include "WaveFile.h"
#include <string>
#include "AudioCommon/WaveFile.h"

struct AudioDumper
{
Expand All @@ -14,17 +13,9 @@ struct AudioDumper
std::string basename;
bool checkem (int srate);
public:
AudioDumper (std::string _basename);
AudioDumper(const std::string& _basename);
~AudioDumper ();

void dumpsamples (const short *buff, int nsamp, int srate);
void dumpsamplesBE (const short *buff, int nsamp, int srate);
};







#endif
void DumpSamples (const short *buff, int nsamp, int srate);
void DumpSamplesBE (const short *buff, int nsamp, int srate);
};
31 changes: 15 additions & 16 deletions Source/Core/Core/HW/DSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
// Nintendo games).

#include "AudioCommon/AudioCommon.h"
#include "AudioCommon/AudioDumper.h"

#include "Common/MemoryUtil.h"

Expand All @@ -40,8 +41,6 @@
#include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PowerPC.h"

#include "AudioCommon/AudioDumper.h"
#include "AudioCommon/AudioCommon.h"
#include "VideoCommon/AVIDump.h"

namespace DSP
Expand Down Expand Up @@ -275,8 +274,8 @@ void Init(bool hle)
et_GenerateDSPInterrupt = CoreTiming::RegisterEvent("DSPint", GenerateDSPInterrupt);
et_CompleteARAM = CoreTiming::RegisterEvent("ARAMint", CompleteARAM);

// AUDIO DUMP HACK
HackDump = new AudioDumper(std::string("dspdump"));
// AUDIO DUMP HACK
HackDump = new AudioDumper(std::string("dspdump"));
}

void Shutdown()
Expand All @@ -291,8 +290,8 @@ void Shutdown()
delete dsp_emulator;
dsp_emulator = nullptr;

delete HackDump;
HackDump = 0;
delete HackDump;
HackDump = 0;
}

void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
Expand Down Expand Up @@ -510,7 +509,7 @@ void UpdateDSPSlice(int cycles)
void UpdateAudioDMA()
{
static short zero_samples[8*2] = { 0 };
static int oldrate = 32000;
static int oldrate = 32000;
if (g_audioDMA.AudioDMAControl.Enable)
{
// Read audio at g_audioDMA.current_source_address in RAM and push onto an
Expand All @@ -533,23 +532,23 @@ void UpdateAudioDMA()
// We make the samples ready as soon as possible
void *address = Memory::GetPointer(g_audioDMA.SourceAddress);
AudioCommon::SendAIBuffer((short*)address, g_audioDMA.AudioDMAControl.NumBlocks * 8);
if (SConfig::GetInstance().m_DumpAudio)
HackDump->dumpsamplesBE((short*)address, g_audioDMA.AudioDMAControl.NumBlocks * 8, oldrate);
if (SConfig::GetInstance().m_DumpAudioToAVI)
AVIDump::AddSoundBE((short*)address, g_audioDMA.AudioDMAControl.NumBlocks * 8, oldrate);
if (SConfig::GetInstance().m_DumpAudio)
HackDump->DumpSamplesBE((short*)address, g_audioDMA.AudioDMAControl.NumBlocks * 8, oldrate);
if (SConfig::GetInstance().m_DumpAudioToAVI)
AVIDump::AddSoundBE((short*)address, g_audioDMA.AudioDMAControl.NumBlocks * 8, oldrate);
}
GenerateDSPInterrupt(DSP::INT_AID);
}
}
else
{
if (SConfig::GetInstance().m_DumpAudio)
HackDump->dumpsamples(&zero_samples[0], 8, oldrate);
if (SConfig::GetInstance().m_DumpAudioToAVI)
AVIDump::AddSound(&zero_samples[0], 8, oldrate);
if (SConfig::GetInstance().m_DumpAudio)
HackDump->DumpSamples(&zero_samples[0], 8, oldrate);
if (SConfig::GetInstance().m_DumpAudioToAVI)
AVIDump::AddSound(&zero_samples[0], 8, oldrate);
AudioCommon::SendAIBuffer(&zero_samples[0], 8);
}
oldrate = AudioInterface::GetAIDSampleRate();
oldrate = AudioInterface::GetAIDSampleRate();
}

static void Do_ARAM_DMA()
Expand Down
27 changes: 8 additions & 19 deletions Source/Core/VideoCommon/AVIDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include "AudioCommon/AudioCommon.h" // for m_DumpAudioToAVI
#include "Core/ConfigManager.h" // for EuRGB60

// DUMP HACK
#include "Core/CoreTiming.h"
#include "Core/HW/SystemTimers.h"

HWND m_emuWnd;
LONG m_byteBuffer;
LONG m_frameCount;
Expand Down Expand Up @@ -76,7 +80,7 @@ bool AVIDump::Start(HWND hWnd, int w, int h)
// clear CFR frame cache on start, not on file create (which is also segment switch)
SetBitmapFormat();
if (SConfig::GetInstance().m_DumpAudioToAVI)
StoreFrame(NULL);
StoreFrame(nullptr);


return CreateFile();
Expand Down Expand Up @@ -200,7 +204,7 @@ void AVIDump::CloseFile()
if (m_streamSound)
{
AVIStreamClose(m_streamSound);
m_streamSound = NULL;
m_streamSound = nullptr;
}

if (m_file)
Expand Down Expand Up @@ -232,17 +236,8 @@ void AVIDump::Stop()
NOTICE_LOG(VIDEO, "Stop");
}

// DUMP HACK
#include "Core/CoreTiming.h"
#include "Core/HW/SystemTimers.h"

void AVIDump::AddSoundBE(const short *data, int nsamp, int rate)
{
/* do these checks in AddSound
if (!m_streamSound)
return;
*/

static short *buff = NULL;
static int nsampf = 0;
if (nsampf < nsamp)
Expand All @@ -260,7 +255,7 @@ void AVIDump::AddSoundBE(const short *data, int nsamp, int rate)

// interleave is extra big (10s) because the buffer must be able to store potentially quite a bit of data,
// audio before the video dump starts
const int soundinterleave = 480000;
static const int soundinterleave = 480000;

void AVIDump::AddSoundInternal(const short *data, int nsamp)
{
Expand All @@ -287,9 +282,6 @@ void AVIDump::AddSoundInternal(const short *data, int nsamp)
{
if (m_streamSound)
AVIStreamWrite(m_streamSound, m_samplesSound, soundinterleave, buff, soundinterleave * 4, 0, NULL, &m_byteBuffer);
else
; // audio stream should have been ready by now, nothing to be done

m_totalBytes += m_byteBuffer;
m_samplesSound += soundinterleave;
buffpos = 0;
Expand All @@ -300,8 +292,6 @@ void AVIDump::AddSoundInternal(const short *data, int nsamp)
{
if (m_streamSound)
AVIStreamWrite(m_streamSound, m_samplesSound, buffpos / 2, buff, buffpos * 2, 0, NULL, &m_byteBuffer);
else
; // shouldn't happen?
m_totalBytes += m_byteBuffer;
m_samplesSound += buffpos / 2;
buffpos = 0;
Expand Down Expand Up @@ -383,7 +373,7 @@ void AVIDump::StoreFrame(const void *data)

}

void *AVIDump::GetFrame(void)
void *AVIDump::GetFrame()
{
return storedframe;
}
Expand Down Expand Up @@ -419,7 +409,6 @@ void AVIDump::AddFrame(const u8* data)
m_fileCount++;
CreateFile();
}

}
else
{
Expand Down
Loading

0 comments on commit 495cae6

Please sign in to comment.