LUAInterface should have all its functionality now (excluding input/controller management). Now we need a GUI to see how it works. Added new DSP function: ClearAudioBuffer, which clears the audio buffer for pausing. Currently it doesn't work with DSound.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4507 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY
2009-11-07 20:01:39 +00:00
parent ebaad032eb
commit a0129e51a3
18 changed files with 255 additions and 185 deletions
@@ -81,7 +81,14 @@ void AOSound::Update()
{
soundSyncEvent.Set();
}
void AOSound::Clear()
{
memset(realtimeBuffer, 0, sizeof(realtimeBuffer));
Update();
}
void AOSound::Stop()
{
soundCriticalSection.Enter();
@@ -51,6 +51,8 @@ public:
virtual void SoundLoop();
virtual void Stop();
virtual void Clear();
static bool isValid() {
return true;
@@ -170,6 +170,13 @@ void DSound::Update()
soundSyncEvent.Set();
}
void DSound::Clear()
{
memset(realtimeBuffer, 0, sizeof(realtimeBuffer));
Update();
}
void DSound::Stop()
{
soundCriticalSection.Enter();
@@ -78,6 +78,7 @@ public:
virtual void SoundLoop();
virtual void SetVolume(int volume);
virtual void Stop();
virtual void Clear();
static bool isValid() { return true; }
virtual bool usesMixer() const { return true; }
virtual void Update();
@@ -92,6 +92,13 @@ void OpenALStream::Update()
}
}
void OpenALStream::Clear()
{
memset(realtimeBuffer, 0, sizeof(realtimeBuffer));
Update();
}
THREAD_RETURN OpenALStream::ThreadFunc(void* args)
{
(reinterpret_cast<OpenALStream *>(args))->SoundLoop();
@@ -50,6 +50,7 @@ public:
virtual bool Start();
virtual void SoundLoop();
virtual void Stop();
virtual void Clear();
static bool isValid() { return true; }
virtual bool usesMixer() const { return true; }
virtual void Update();
@@ -44,6 +44,7 @@ public:
virtual void SoundLoop() {}
virtual void Stop() {}
virtual void Update() {}
virtual void Clear() {}
virtual void StartLogAudio(const char *filename) {
if (! m_logAudio) {
m_logAudio = true;
+4 -1
View File
@@ -40,6 +40,8 @@ PluginDSP::PluginDSP(const char *_Filename)
(LoadSymbol("DSP_SendAIBuffer"));
DSP_StopSoundStream = reinterpret_cast<TDSP_StopSoundStream>
(LoadSymbol("DSP_StopSoundStream"));
DSP_ClearAudioBuffer = reinterpret_cast<TDSP_ClearAudioBuffer>
(LoadSymbol("DSP_ClearAudioBuffer"));
if ((DSP_ReadMailboxHigh != 0) &&
(DSP_ReadMailboxLow != 0) &&
@@ -49,7 +51,8 @@ PluginDSP::PluginDSP(const char *_Filename)
(DSP_WriteControlRegister != 0) &&
(DSP_SendAIBuffer != 0) &&
(DSP_Update != 0) &&
(DSP_StopSoundStream != 0))
(DSP_StopSoundStream != 0) &&
(DSP_ClearAudioBuffer != 0))
validDSP = true;
}
+2
View File
@@ -30,6 +30,7 @@ typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short);
typedef void (__cdecl *TDSP_SendAIBuffer)(unsigned int address, int sample_rate);
typedef void (__cdecl *TDSP_Update)(int cycles);
typedef void (__cdecl *TDSP_StopSoundStream)();
typedef void (__cdecl *TDSP_ClearAudioBuffer)();
class PluginDSP : public CPlugin
{
@@ -47,6 +48,7 @@ public:
TDSP_SendAIBuffer DSP_SendAIBuffer;
TDSP_Update DSP_Update;
TDSP_StopSoundStream DSP_StopSoundStream;
TDSP_ClearAudioBuffer DSP_ClearAudioBuffer;
private:
bool validDSP;
+1
View File
@@ -575,6 +575,7 @@ void SetState(EState _State)
break;
case CORE_PAUSE:
CCPU::EnableStepping(true); // Break
CPluginManager::GetInstance().GetDSP()->DSP_ClearAudioBuffer();
break;
case CORE_RUN:
CCPU::EnableStepping(false);
File diff suppressed because it is too large Load Diff
+7
View File
@@ -41,6 +41,9 @@ FILE *g_recordfd = NULL;
u64 g_frameCounter = 0, g_lagCounter = 0;
bool g_bPolled = false;
int g_numRerecords = 0;
std::string g_recordFile;
void FrameUpdate() {
g_frameCounter++;
@@ -205,6 +208,8 @@ bool BeginRecordingInput(const char *filename, int controllers)
g_playMode = MODE_RECORDING;
g_recordFile = filename;
return true;
}
@@ -313,6 +318,8 @@ bool PlayInput(const char *filename)
g_numPads = header.numControllers;
g_padStates = new ControllerState[g_numPads];
g_numRerecords = header.numRerecords;
g_recordFile = filename;
g_playMode = MODE_PLAYING;
+5
View File
@@ -21,6 +21,8 @@
#include "Common.h"
#include "pluginspecs_pad.h"
#include <string>
// Per-(video )Frame actions
namespace Frame {
@@ -52,9 +54,12 @@ extern PlayMode g_playMode;
extern int g_framesToSkip, g_frameSkipCounter, g_numPads;
extern ControllerState *g_padStates;
extern FILE *g_recordfd;
extern std::string g_recordFile;
extern u64 g_frameCounter, g_lagCounter;
extern int g_numRerecords;
typedef struct {
u8 filetype[4]; // Unique Identifier (always "DTM"0x1A)
+10
View File
@@ -36,6 +36,7 @@
#include "minilzo.h"
// TODO: Move to namespace
// TODO: Investigate a memory leak on save/load state
@@ -453,3 +454,12 @@ void State_UndoSaveState()
{
State_LoadAs(FULL_STATESAVES_DIR "lastState.sav");
}
size_t State_GetSize()
{
// Measure the size of the buffer.
u8 *ptr = 0;
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
DoState(p);
return (size_t)ptr;
}
+2
View File
@@ -46,6 +46,8 @@ void State_LoadLastSaved();
void State_UndoSaveState();
void State_UndoLoadState();
size_t State_GetSize();
typedef struct
{
+5
View File
@@ -104,5 +104,10 @@ EXPORT void CALL DSP_SendAIBuffer(unsigned int address, int sample_rate);
// Purpose: Stops audio playback. Must be called before Shutdown().
EXPORT void CALL DSP_StopSoundStream();
// __________________________________________________________________________________________________
// Function: DSP_ClearAudioBuffer
// Purpose: Stops audio. Called while pausing to stop the annoying noises.
EXPORT void CALL DSP_ClearAudioBuffer();
#include "ExportEpilog.h"
#endif
@@ -383,3 +383,7 @@ void DSP_SendAIBuffer(unsigned int address, int sample_rate)
soundStream->Update();
}
void DSP_ClearAudioBuffer()
{
soundStream->Clear();
}
@@ -360,3 +360,9 @@ void DSP_SendAIBuffer(unsigned int address, int sample_rate)
if (/*(counter & 31) == 0 &&*/ soundStream)
soundStream->Update();
}
void DSP_ClearAudioBuffer()
{
soundStream->Clear();
}