mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Kill Plugin_DSP_NULL
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@229 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -66,11 +66,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DebuggerWX", "Core\Debugger
|
||||
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_DSP_NULL", "Plugins\Plugin_DSP_NULL\Plugin_DSP_NULL.vcproj", "{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoCommon", "Core\VideoCommon\VideoCommon.vcproj", "{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
|
||||
@@ -256,18 +251,6 @@ Global
|
||||
{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}.Release|Win32.Build.0 = Release|Win32
|
||||
{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}.Release|x64.ActiveCfg = Release|x64
|
||||
{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}.Release|x64.Build.0 = Release|x64
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.Debug|x64.Build.0 = Debug|x64
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.DebugFast|Win32.Build.0 = DebugFast|Win32
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.DebugFast|x64.ActiveCfg = DebugFast|x64
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.DebugFast|x64.Build.0 = DebugFast|x64
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.Release|Win32.Build.0 = Release|Win32
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.Release|x64.ActiveCfg = Release|x64
|
||||
{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}.Release|x64.Build.0 = Release|x64
|
||||
{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,38 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "AboutDlg.h"
|
||||
|
||||
|
||||
LRESULT
|
||||
CAboutDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
CenterWindow(GetParent());
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
LRESULT
|
||||
CAboutDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
EndDialog(wID);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#pragma once
|
||||
|
||||
class CAboutDlg
|
||||
: public CDialogImpl<CAboutDlg>
|
||||
{
|
||||
public:
|
||||
|
||||
enum { IDD = IDD_ABOUT };
|
||||
|
||||
BEGIN_MSG_MAP(CAboutDlg)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
|
||||
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||
END_MSG_MAP()
|
||||
|
||||
// Handler prototypes (uncomment arguments if needed):
|
||||
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
|
||||
|
||||
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
|
||||
};
|
||||
@@ -1,87 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#include "Common.h"
|
||||
#include "IniFile.h"
|
||||
#include "Config.h"
|
||||
|
||||
CConfig g_Config;
|
||||
|
||||
|
||||
CConfig::CConfig()
|
||||
{
|
||||
Load();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CConfig::LoadDefaults()
|
||||
{
|
||||
m_EnableHLEAudio = true;
|
||||
m_EnableDTKMusic = true;
|
||||
m_Interpolation = true;
|
||||
m_DumpSampleMinLength = true;
|
||||
m_SampleRate = 48000;
|
||||
m_DumpSamples = false;
|
||||
m_AntiGap = false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CConfig::Load()
|
||||
{
|
||||
// first load defaults
|
||||
LoadDefaults();
|
||||
|
||||
IniFile file;
|
||||
file.Load("DSP.ini");
|
||||
file.Get("Config", "EnableHLEAudio", &m_EnableHLEAudio, true);
|
||||
file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true);
|
||||
file.Get("Config", "Interpolation", &m_Interpolation, true);
|
||||
file.Get("Config", "DumpSamples", &m_DumpSamples, false);
|
||||
file.Get("Config", "DumpSampleMinLength", &m_DumpSampleMinLength, true);
|
||||
#ifdef _WIN32
|
||||
file.Get("Config", "DumpSamplePath", &m_szSamplePath, "C:\\");
|
||||
#else
|
||||
file.Get("Config", "DumpSamplePath", &m_szSamplePath, "/dev/null/");
|
||||
#endif
|
||||
file.Get("Config", "SampleRate", &m_SampleRate, 48000);
|
||||
file.Get("Config", "AntiGap", &m_AntiGap, false);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CConfig::Save()
|
||||
{
|
||||
IniFile file;
|
||||
file.Load("DSP.ini");
|
||||
file.Set("Config", "EnableHLEAudio", m_EnableHLEAudio);
|
||||
file.Set("Config", "EnableDTKMusic", m_EnableDTKMusic);
|
||||
file.Set("Config", "Interpolation", m_Interpolation);
|
||||
file.Set("Config", "DumpSamples", m_DumpSamples);
|
||||
file.Set("Config", "DumpSampleMinLength", m_DumpSampleMinLength);
|
||||
#ifdef _WIN32
|
||||
file.Set("Config", "DumpSamplePath", m_szSamplePath);
|
||||
#else
|
||||
file.Set("Config", "DumpSamplePath", m_szSamplePath);
|
||||
#endif
|
||||
file.Set("Config", "SampleRate", m_SampleRate);
|
||||
file.Set("Config", "AntiGap", m_AntiGap);
|
||||
file.Save("DSP.ini");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
|
||||
#include <string>
|
||||
|
||||
struct CConfig
|
||||
{
|
||||
bool m_AntiGap;
|
||||
bool m_EnableHLEAudio;
|
||||
bool m_EnableDTKMusic;
|
||||
bool m_Interpolation;
|
||||
bool m_DumpSamples;
|
||||
std::string m_szSamplePath;
|
||||
int m_SampleRate;
|
||||
bool m_DumpSampleMinLength;
|
||||
|
||||
CConfig();
|
||||
|
||||
void LoadDefaults();
|
||||
|
||||
void Load();
|
||||
|
||||
void Save();
|
||||
};
|
||||
|
||||
extern CConfig g_Config;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "ConfigDlg.h"
|
||||
|
||||
LRESULT
|
||||
CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
g_Config.Load();
|
||||
//CenterWindow(this->GetParent());
|
||||
CenterWindow(GetParent());
|
||||
m_buttonEnableHLEAudio = GetDlgItem(IDC_ENABLE_HLE_AUDIO);
|
||||
m_buttonEnableDTKMusic = GetDlgItem(IDC_ENABLE_DTK_MUSIC);
|
||||
m_buttonAntiGap = GetDlgItem(IDC_ANTIGAP);
|
||||
m_buttonDumpSamples = GetDlgItem(IDC_DUMPSAMPLES);
|
||||
m_editDumpSamplePath = GetDlgItem(IDC_SAMPLEDUMPPATH);
|
||||
m_comboSampleRate = GetDlgItem(IDC_SAMPLERATE);
|
||||
|
||||
m_buttonEnableHLEAudio.SetCheck(g_Config.m_EnableHLEAudio ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_buttonEnableDTKMusic.SetCheck(g_Config.m_EnableDTKMusic ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_buttonAntiGap.SetCheck(g_Config.m_AntiGap ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_buttonDumpSamples.SetCheck(g_Config.m_DumpSamples ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_editDumpSamplePath.SetWindowText(g_Config.m_szSamplePath.c_str());
|
||||
m_comboSampleRate.AddString("44100");
|
||||
m_comboSampleRate.AddString("48000");
|
||||
m_comboSampleRate.SetCurSel(g_Config.m_SampleRate == 44100 ? 0 : 1);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
LRESULT
|
||||
CConfigDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
if (wID == IDOK)
|
||||
{
|
||||
g_Config.m_EnableHLEAudio = (m_buttonEnableHLEAudio.GetCheck() == BST_CHECKED) ? true : false;
|
||||
g_Config.m_EnableDTKMusic = (m_buttonEnableDTKMusic.GetCheck() == BST_CHECKED) ? true : false;
|
||||
g_Config.m_DumpSamples = (m_buttonDumpSamples.GetCheck() == BST_CHECKED) ? true : false;
|
||||
g_Config.m_AntiGap = (m_buttonAntiGap.GetCheck() == BST_CHECKED) ? true : false;
|
||||
char temp[MAX_PATH];
|
||||
m_editDumpSamplePath.GetWindowText(temp, MAX_PATH);
|
||||
g_Config.m_szSamplePath = temp;
|
||||
g_Config.m_SampleRate = (m_comboSampleRate.GetCurSel() == 0 ? 44100 : 48000);
|
||||
g_Config.Save();
|
||||
}
|
||||
|
||||
EndDialog(wID);
|
||||
g_Config.Save();
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#pragma once
|
||||
|
||||
class CConfigDlg
|
||||
: public CDialogImpl<CConfigDlg>
|
||||
{
|
||||
public:
|
||||
|
||||
enum { IDD = IDD_SETTINGS };
|
||||
|
||||
BEGIN_MSG_MAP(CConfigDlg)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
|
||||
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||
END_MSG_MAP()
|
||||
|
||||
private:
|
||||
|
||||
CButton m_buttonEnableHLEAudio;
|
||||
CButton m_buttonEnableDTKMusic;
|
||||
CButton m_buttonDumpSamples;
|
||||
CButton m_buttonAntiGap;
|
||||
CEdit m_editDumpSamplePath;
|
||||
CComboBox m_comboSampleRate;
|
||||
|
||||
// Handler prototypes (uncomment arguments if needed):
|
||||
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
|
||||
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
|
||||
};
|
||||
@@ -1,105 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "PCHW/DSoundStream.h"
|
||||
#endif
|
||||
|
||||
#include "DSPHandler.h"
|
||||
|
||||
CDSPHandler* CDSPHandler::m_pInstance = NULL;
|
||||
|
||||
CDSPHandler::CDSPHandler()
|
||||
: m_pUCode(NULL),
|
||||
m_bHalt(false),
|
||||
m_bAssertInt(false)
|
||||
{
|
||||
SetUCode(UCODE_ROM);
|
||||
m_DSPControl.DSPHalt = 1;
|
||||
m_DSPControl.DSPInit = 1;
|
||||
}
|
||||
|
||||
|
||||
CDSPHandler::~CDSPHandler()
|
||||
{
|
||||
delete m_pUCode;
|
||||
}
|
||||
|
||||
|
||||
void CDSPHandler::Update()
|
||||
{
|
||||
if (m_pUCode != NULL)
|
||||
{
|
||||
m_pUCode->Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unsigned short CDSPHandler::WriteControlRegister(unsigned short _Value)
|
||||
{
|
||||
UDSPControl Temp(_Value);
|
||||
|
||||
if (Temp.DSPReset)
|
||||
{
|
||||
SetUCode(UCODE_ROM);
|
||||
Temp.DSPReset = 0;
|
||||
}
|
||||
|
||||
if (Temp.DSPInit == 0)
|
||||
{
|
||||
// copy 128 byte from ARAM 0x000000 to IMEM
|
||||
SetUCode(UCODE_INIT_AUDIO_SYSTEM);
|
||||
Temp.DSPInitCode = 0;
|
||||
// MessageBox(NULL, "UCODE_INIT_AUDIO_SYSTEM", "DSP-HLE", MB_OK);
|
||||
}
|
||||
|
||||
m_DSPControl.Hex = Temp.Hex;
|
||||
|
||||
return(m_DSPControl.Hex);
|
||||
}
|
||||
|
||||
|
||||
unsigned short CDSPHandler::ReadControlRegister()
|
||||
{
|
||||
return(m_DSPControl.Hex);
|
||||
}
|
||||
|
||||
|
||||
void CDSPHandler::SendMailToDSP(u32 _uMail)
|
||||
{
|
||||
if (m_pUCode != NULL)
|
||||
{
|
||||
m_pUCode->HandleMail(_uMail);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IUCode* CDSPHandler::GetUCode()
|
||||
{
|
||||
return m_pUCode;
|
||||
}
|
||||
|
||||
|
||||
void CDSPHandler::SetUCode(u32 _crc)
|
||||
{
|
||||
delete m_pUCode;
|
||||
|
||||
m_MailHandler.Clear();
|
||||
m_pUCode = UCodeFactory(_crc, m_MailHandler);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
#ifndef _DSPHANDLER_H
|
||||
#define _DSPHANDLER_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "MailHandler.h"
|
||||
#include "UCodes/UCodes.h"
|
||||
|
||||
// CDSPHandler
|
||||
class CDSPHandler
|
||||
{
|
||||
public:
|
||||
|
||||
void Update();
|
||||
unsigned short WriteControlRegister(unsigned short _Value);
|
||||
unsigned short ReadControlRegister();
|
||||
void SendMailToDSP(u32 _uMail);
|
||||
IUCode* GetUCode();
|
||||
void SetUCode(u32 _crc);
|
||||
|
||||
CMailHandler& AccessMailHandler() {return(m_MailHandler);}
|
||||
|
||||
static CDSPHandler& GetInstance()
|
||||
{
|
||||
return(*m_pInstance);
|
||||
}
|
||||
|
||||
static void Destroy()
|
||||
{
|
||||
delete m_pInstance;
|
||||
}
|
||||
|
||||
static CDSPHandler& CreateInstance()
|
||||
{
|
||||
if (m_pInstance == NULL)
|
||||
{
|
||||
m_pInstance = new CDSPHandler();
|
||||
}
|
||||
|
||||
return(*m_pInstance);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
CDSPHandler();
|
||||
~CDSPHandler();
|
||||
|
||||
// UDSPControl
|
||||
union UDSPControl
|
||||
{
|
||||
u16 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
|
||||
unsigned DSPAssertInt : 1;
|
||||
unsigned DSPHalt : 1;
|
||||
|
||||
unsigned AI : 1;
|
||||
unsigned AI_mask : 1;
|
||||
unsigned ARAM : 1;
|
||||
unsigned ARAM_mask : 1;
|
||||
unsigned DSP : 1;
|
||||
unsigned DSP_mask : 1;
|
||||
|
||||
unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag
|
||||
unsigned DSPInitCode : 1;
|
||||
unsigned DSPInit : 1; // DSPInit() writes to this flag
|
||||
unsigned pad : 4;
|
||||
};
|
||||
|
||||
UDSPControl(u16 _Hex = 0)
|
||||
: Hex(_Hex)
|
||||
{}
|
||||
};
|
||||
|
||||
// singleton instance
|
||||
static CDSPHandler* m_pInstance;
|
||||
|
||||
IUCode* m_pUCode;
|
||||
UDSPControl m_DSPControl;
|
||||
CMailHandler m_MailHandler;
|
||||
|
||||
bool m_bHalt;
|
||||
bool m_bAssertInt;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,55 +0,0 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Globals.h"
|
||||
|
||||
|
||||
void DebugLog(const char* _fmt, ...)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
char Msg[512];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, _fmt);
|
||||
vsprintf(Msg, _fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
g_dspInitialize.pLog(Msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
extern u8* g_pMemory;
|
||||
|
||||
// TODO: Wii support?
|
||||
#define RAM_MASK 0x1FFFFFF
|
||||
|
||||
u8 Memory_Read_U8(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return(g_pMemory[_uAddress]);
|
||||
}
|
||||
|
||||
|
||||
u16 Memory_Read_U16(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return(Common::swap16(*(u16*)&g_pMemory[_uAddress]));
|
||||
}
|
||||
|
||||
|
||||
u32 Memory_Read_U32(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return(Common::swap32(*(u32*)&g_pMemory[_uAddress]));
|
||||
}
|
||||
|
||||
|
||||
float Memory_Read_Float(u32 _uAddress)
|
||||
{
|
||||
u32 uTemp = Memory_Read_U32(_uAddress);
|
||||
return(*(float*)&uTemp);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef _GLOBALS_H
|
||||
#define _GLOBALS_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "pluginspecs_dsp.h"
|
||||
|
||||
extern DSPInitialize g_dspInitialize;
|
||||
void DebugLog(const char* _fmt, ...);
|
||||
|
||||
u8 Memory_Read_U8(u32 _uAddress);
|
||||
u16 Memory_Read_U16(u32 _uAddress);
|
||||
u32 Memory_Read_U32(u32 _uAddress);
|
||||
float Memory_Read_Float(u32 _uAddress);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#include "MailHandler.h"
|
||||
|
||||
|
||||
CMailHandler::CMailHandler()
|
||||
{}
|
||||
|
||||
|
||||
CMailHandler::~CMailHandler()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
void CMailHandler::PushMail(u32 _Mail)
|
||||
{
|
||||
m_Mails.push(_Mail);
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
u16
|
||||
CMailHandler::ReadDSPMailboxHigh()
|
||||
{
|
||||
// check if we have a mail for the core
|
||||
if (!m_Mails.empty())
|
||||
{
|
||||
u16 result = (m_Mails.front() >> 16) & 0xFFFF;
|
||||
|
||||
Update();
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
return(0x00);
|
||||
}
|
||||
|
||||
|
||||
u16
|
||||
CMailHandler::ReadDSPMailboxLow()
|
||||
{
|
||||
// check if we have a mail for the core
|
||||
if (!m_Mails.empty())
|
||||
{
|
||||
u16 result = m_Mails.front() & 0xFFFF;
|
||||
m_Mails.pop();
|
||||
|
||||
Update();
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
return(0x00);
|
||||
}
|
||||
|
||||
|
||||
void CMailHandler::Clear()
|
||||
{
|
||||
while (!m_Mails.empty())
|
||||
{
|
||||
m_Mails.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
CMailHandler::IsEmpty()
|
||||
{
|
||||
return(m_Mails.empty());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CMailHandler::Halt(bool _Halt)
|
||||
{
|
||||
if (_Halt)
|
||||
{
|
||||
Clear();
|
||||
m_Mails.push(0x80544348);
|
||||
}
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CMailHandler::Update()
|
||||
{
|
||||
if (!IsEmpty())
|
||||
{
|
||||
// g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#ifndef _MAILHANDLER_H
|
||||
#define _MAILHANDLER_H
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
class CMailHandler
|
||||
{
|
||||
public:
|
||||
|
||||
CMailHandler();
|
||||
|
||||
~CMailHandler();
|
||||
|
||||
void PushMail(u32 _Mail);
|
||||
|
||||
void Clear();
|
||||
|
||||
void Halt(bool _Halt);
|
||||
|
||||
bool IsEmpty();
|
||||
|
||||
u16 ReadDSPMailboxHigh();
|
||||
|
||||
u16 ReadDSPMailboxLow();
|
||||
|
||||
void Update();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// mail handler
|
||||
std::queue<u32>m_Mails;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
#include <ao/ao.h>
|
||||
#include <pthread.h>
|
||||
#include "AOSoundStream.h"
|
||||
|
||||
namespace AOSound
|
||||
{
|
||||
pthread_t thread;
|
||||
StreamCallback callback;
|
||||
|
||||
char *buffer;
|
||||
int buf_size;
|
||||
|
||||
ao_device *device;
|
||||
ao_sample_format format;
|
||||
int default_driver;
|
||||
|
||||
int bufferSize;
|
||||
int totalRenderedBytes;
|
||||
int sampleRate;
|
||||
volatile int threadData;
|
||||
int currentPos;
|
||||
int lastPos;
|
||||
short realtimeBuffer[1024 * 1024];
|
||||
int AOSound_GetSampleRate()
|
||||
{
|
||||
return sampleRate;
|
||||
}
|
||||
bool WriteDataToBuffer(int dwOffset,char* soundData, int dwSoundBytes)
|
||||
{
|
||||
//void* ptr1, * ptr2;
|
||||
//DWORD numBytes1, numBytes2;
|
||||
// Obtain memory address of write block. This will be in two parts if the block wraps around.
|
||||
//HRESULT hr = dsBuffer->Lock(dwOffset, dwSoundBytes, &ptr1, &numBytes1, &ptr2, &numBytes2, 0);
|
||||
|
||||
// If the buffer was lost, restore and retry lock.
|
||||
/*if (DSERR_BUFFERLOST == hr)
|
||||
{
|
||||
dsBuffer->Restore();
|
||||
hr = dsBuffer->Lock(dwOffset, dwSoundBytes, &ptr1, &numBytes1, &ptr2, &numBytes2, 0);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
memcpy(ptr1, soundData, numBytes1);
|
||||
|
||||
if (ptr2 != 0)
|
||||
{
|
||||
memcpy(ptr2, soundData + numBytes1, numBytes2);
|
||||
}
|
||||
|
||||
// Release the data back to DirectSound.
|
||||
dsBuffer->Unlock(ptr1, numBytes1, ptr2, numBytes2);
|
||||
return(true);
|
||||
}
|
||||
|
||||
return(false);*/
|
||||
if(soundData[0] != 0)
|
||||
ao_play(device, soundData, dwSoundBytes);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void* soundThread(void*)
|
||||
{
|
||||
currentPos = 0;
|
||||
lastPos = 0;
|
||||
|
||||
// Prefill buffer?
|
||||
//writeDataToBuffer(0,realtimeBuffer,bufferSize);
|
||||
// dsBuffer->Lock(0, bufferSize, (void **)&p1, &num1, (void **)&p2, &num2, 0);
|
||||
//dsBuffer->Play(0, 0, DSBPLAY_LOOPING);
|
||||
|
||||
while (!threadData)
|
||||
{
|
||||
// No blocking inside the csection
|
||||
//dsBuffer->GetCurrentPosition((DWORD*)¤tPos, 0);
|
||||
int numBytesToRender = 256;
|
||||
|
||||
if (numBytesToRender >= 256)
|
||||
{
|
||||
(*callback)(realtimeBuffer, numBytesToRender >> 2, 16, 44100, 2);
|
||||
|
||||
WriteDataToBuffer(0, (char*)realtimeBuffer, numBytesToRender);
|
||||
//currentPos = ModBufferSize(lastPos + numBytesToRender);
|
||||
//totalRenderedBytes += numBytesToRender;
|
||||
|
||||
//lastPos = currentPos;
|
||||
}
|
||||
|
||||
//WaitForSingleObject(soundSyncEvent, MAXWAIT);
|
||||
}
|
||||
|
||||
//dsBuffer->Stop();
|
||||
return(0); //hurra!
|
||||
}
|
||||
bool AOSound_StartSound(int _sampleRate, StreamCallback _callback)
|
||||
{
|
||||
callback = _callback;
|
||||
threadData = 0;
|
||||
sampleRate = _sampleRate;
|
||||
|
||||
//no security attributes, automatic resetting, init state nonset, untitled
|
||||
//soundSyncEvent = CreateEvent(0, false, false, 0);
|
||||
ao_initialize();
|
||||
default_driver = ao_default_driver_id();
|
||||
format.bits = 16;
|
||||
format.channels = 2;
|
||||
format.rate = sampleRate;
|
||||
format.byte_format = AO_FMT_LITTLE;
|
||||
|
||||
//vi vill ha access till DSOUND så...
|
||||
device = ao_open_live(default_driver, &format, NULL /* no options */);
|
||||
if (device == NULL) {
|
||||
fprintf(stderr, "Error opening device.\n");
|
||||
return 1;
|
||||
}
|
||||
buf_size = format.bits/8 * format.channels * format.rate;
|
||||
buffer = (char*)calloc(buf_size, sizeof(char));
|
||||
pthread_create(&thread, NULL, soundThread, (void *)NULL);
|
||||
return(true);
|
||||
}
|
||||
void AOSound_StopSound()
|
||||
{
|
||||
ao_close(device);
|
||||
ao_shutdown();
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#ifndef __AOSOUNDSTREAM_H__
|
||||
#define __AOSOUNDSTREAM_H__
|
||||
|
||||
namespace AOSound
|
||||
{
|
||||
typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels);
|
||||
|
||||
bool AOSound_StartSound(int sampleRate, StreamCallback _callback);
|
||||
void AOSound_UpdateSound();
|
||||
void AOSound_StopSound();
|
||||
|
||||
float AOSound_GetTimer();
|
||||
int AOSound_GetCurSample();
|
||||
int AOSound_GetSampleRate();
|
||||
}
|
||||
|
||||
|
||||
#endif //__AOSOUNDSTREAM_H__
|
||||
@@ -1,254 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <mmsystem.h>
|
||||
#include <dsound.h>
|
||||
|
||||
#include "dsoundstream.h"
|
||||
|
||||
namespace DSound
|
||||
{
|
||||
#define BUFSIZE 32768
|
||||
#define MAXWAIT 70 //ms
|
||||
|
||||
CRITICAL_SECTION soundCriticalSection;
|
||||
HANDLE soundSyncEvent;
|
||||
HANDLE hThread;
|
||||
|
||||
StreamCallback callback;
|
||||
|
||||
//lite mojs
|
||||
IDirectSound8* ds;
|
||||
IDirectSoundBuffer* dsBuffer;
|
||||
|
||||
//tja.. behövs
|
||||
int bufferSize; //i bytes
|
||||
int totalRenderedBytes;
|
||||
int sampleRate;
|
||||
|
||||
//med den här synkar vi stängning..
|
||||
//0=vi spelar oväsen, 1=stäng tråden NU!
|
||||
volatile int threadData;
|
||||
|
||||
inline int FIX128(int x)
|
||||
{
|
||||
return(x & (~127));
|
||||
}
|
||||
|
||||
|
||||
int DSound_GetSampleRate()
|
||||
{
|
||||
return(sampleRate);
|
||||
}
|
||||
|
||||
|
||||
bool CreateBuffer()
|
||||
{
|
||||
PCMWAVEFORMAT pcmwf;
|
||||
DSBUFFERDESC dsbdesc;
|
||||
|
||||
memset(&pcmwf, 0, sizeof(PCMWAVEFORMAT));
|
||||
memset(&dsbdesc, 0, sizeof(DSBUFFERDESC));
|
||||
|
||||
pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM;
|
||||
pcmwf.wf.nChannels = 2;
|
||||
pcmwf.wf.nSamplesPerSec = sampleRate;
|
||||
pcmwf.wf.nBlockAlign = 4;
|
||||
pcmwf.wf.nAvgBytesPerSec = pcmwf.wf.nSamplesPerSec * pcmwf.wf.nBlockAlign;
|
||||
pcmwf.wBitsPerSample = 16;
|
||||
|
||||
//buffer description
|
||||
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
|
||||
dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_STICKYFOCUS; //VIKTIGT //DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY;
|
||||
dsbdesc.dwBufferBytes = bufferSize = BUFSIZE;
|
||||
dsbdesc.lpwfxFormat = (WAVEFORMATEX*)&pcmwf;
|
||||
|
||||
if (SUCCEEDED(ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, NULL)))
|
||||
{
|
||||
dsBuffer->SetCurrentPosition(0);
|
||||
return(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Failed.
|
||||
dsBuffer = NULL;
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool WriteDataToBuffer(DWORD dwOffset, // Our own write cursor.
|
||||
char* soundData, // Start of our data.
|
||||
DWORD dwSoundBytes) // Size of block to copy.
|
||||
{
|
||||
void* ptr1, * ptr2;
|
||||
DWORD numBytes1, numBytes2;
|
||||
// Obtain memory address of write block. This will be in two parts if the block wraps around.
|
||||
HRESULT hr = dsBuffer->Lock(dwOffset, dwSoundBytes, &ptr1, &numBytes1, &ptr2, &numBytes2, 0);
|
||||
|
||||
// If the buffer was lost, restore and retry lock.
|
||||
if (DSERR_BUFFERLOST == hr)
|
||||
{
|
||||
dsBuffer->Restore();
|
||||
hr = dsBuffer->Lock(dwOffset, dwSoundBytes, &ptr1, &numBytes1, &ptr2, &numBytes2, 0);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
memcpy(ptr1, soundData, numBytes1);
|
||||
|
||||
if (ptr2 != 0)
|
||||
{
|
||||
memcpy(ptr2, soundData + numBytes1, numBytes2);
|
||||
}
|
||||
|
||||
// Release the data back to DirectSound.
|
||||
dsBuffer->Unlock(ptr1, numBytes1, ptr2, numBytes2);
|
||||
return(true);
|
||||
}
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
inline int ModBufferSize(int x)
|
||||
{
|
||||
return((x + bufferSize) % bufferSize);
|
||||
}
|
||||
|
||||
|
||||
int currentPos;
|
||||
int lastPos;
|
||||
short realtimeBuffer[1024 * 1024];
|
||||
|
||||
//Själva tråden
|
||||
DWORD WINAPI soundThread(void*)
|
||||
{
|
||||
currentPos = 0;
|
||||
lastPos = 0;
|
||||
|
||||
// Prefill buffer?
|
||||
//writeDataToBuffer(0,realtimeBuffer,bufferSize);
|
||||
// dsBuffer->Lock(0, bufferSize, (void **)&p1, &num1, (void **)&p2, &num2, 0);
|
||||
dsBuffer->Play(0, 0, DSBPLAY_LOOPING);
|
||||
|
||||
while (!threadData)
|
||||
{
|
||||
// No blocking inside the csection
|
||||
EnterCriticalSection(&soundCriticalSection);
|
||||
dsBuffer->GetCurrentPosition((DWORD*)¤tPos, 0);
|
||||
int numBytesToRender = FIX128(ModBufferSize(currentPos - lastPos));
|
||||
|
||||
if (numBytesToRender >= 256)
|
||||
{
|
||||
(*callback)(realtimeBuffer, numBytesToRender >> 2, 16, 44100, 2);
|
||||
|
||||
WriteDataToBuffer(lastPos, (char*)realtimeBuffer, numBytesToRender);
|
||||
currentPos = ModBufferSize(lastPos + numBytesToRender);
|
||||
totalRenderedBytes += numBytesToRender;
|
||||
|
||||
lastPos = currentPos;
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&soundCriticalSection);
|
||||
WaitForSingleObject(soundSyncEvent, MAXWAIT);
|
||||
}
|
||||
|
||||
dsBuffer->Stop();
|
||||
return(0); //hurra!
|
||||
}
|
||||
|
||||
|
||||
bool DSound_StartSound(HWND window, int _sampleRate, StreamCallback _callback)
|
||||
{
|
||||
callback = _callback;
|
||||
threadData = 0;
|
||||
sampleRate = _sampleRate;
|
||||
|
||||
//no security attributes, automatic resetting, init state nonset, untitled
|
||||
soundSyncEvent = CreateEvent(0, false, false, 0);
|
||||
|
||||
//vi initierar den...........
|
||||
InitializeCriticalSection(&soundCriticalSection);
|
||||
|
||||
//vi vill ha access till DSOUND så...
|
||||
if (FAILED(DirectSoundCreate8(0, &ds, 0)))
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
ds->SetCooperativeLevel(window, DSSCL_NORMAL);
|
||||
|
||||
if (!CreateBuffer())
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
DWORD num1;
|
||||
short* p1;
|
||||
dsBuffer->Lock(0, bufferSize, (void* *)&p1, &num1, 0, 0, 0);
|
||||
memset(p1, 0, num1);
|
||||
dsBuffer->Unlock(p1, num1, 0, 0);
|
||||
totalRenderedBytes = -bufferSize;
|
||||
DWORD h;
|
||||
hThread = CreateThread(0, 0, soundThread, 0, 0, &h);
|
||||
SetThreadPriority(hThread, THREAD_PRIORITY_ABOVE_NORMAL);
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
void DSound_UpdateSound()
|
||||
{
|
||||
SetEvent(soundSyncEvent);
|
||||
}
|
||||
|
||||
|
||||
void DSound_StopSound()
|
||||
{
|
||||
EnterCriticalSection(&soundCriticalSection);
|
||||
threadData = 1;
|
||||
//kick the thread if it's waiting
|
||||
SetEvent(soundSyncEvent);
|
||||
LeaveCriticalSection(&soundCriticalSection);
|
||||
WaitForSingleObject(hThread, INFINITE);
|
||||
CloseHandle(hThread);
|
||||
|
||||
dsBuffer->Release();
|
||||
ds->Release();
|
||||
|
||||
CloseHandle(soundSyncEvent);
|
||||
}
|
||||
|
||||
|
||||
int DSound_GetCurSample()
|
||||
{
|
||||
EnterCriticalSection(&soundCriticalSection);
|
||||
int playCursor;
|
||||
dsBuffer->GetCurrentPosition((DWORD*)&playCursor, 0);
|
||||
playCursor = ModBufferSize(playCursor - lastPos) + totalRenderedBytes;
|
||||
LeaveCriticalSection(&soundCriticalSection);
|
||||
return(playCursor);
|
||||
}
|
||||
|
||||
|
||||
float DSound_GetTimer()
|
||||
{
|
||||
return((float)DSound_GetCurSample() * (1.0f / (4.0f * 44100.0f)));
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#ifndef __SOUNDSTREAM_H__
|
||||
#define __SOUNDSTREAM_H__
|
||||
|
||||
namespace DSound
|
||||
{
|
||||
typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels);
|
||||
|
||||
bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback);
|
||||
void DSound_UpdateSound();
|
||||
void DSound_StopSound();
|
||||
|
||||
float DSound_GetTimer();
|
||||
int DSound_GetCurSample();
|
||||
int DSound_GetSampleRate();
|
||||
}
|
||||
|
||||
|
||||
#endif //__SOUNDSTREAM_H__
|
||||
@@ -1,48 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#include "../Config.h"
|
||||
#include "../Globals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
volatile bool mixer_HLEready = false;
|
||||
|
||||
void Mixer(short* buffer, int numSamples, int bits, int rate, int channels)
|
||||
{
|
||||
// silence
|
||||
memset(buffer, 0, numSamples * 2 * sizeof(short));
|
||||
|
||||
// first get th DTK Music
|
||||
if (g_Config.m_EnableDTKMusic)
|
||||
{
|
||||
g_dspInitialize.pGetAudioStreaming(buffer, numSamples);
|
||||
}
|
||||
|
||||
//if this was called directly from the HLE, and not by timeout
|
||||
if (g_Config.m_EnableHLEAudio && (mixer_HLEready || g_Config.m_AntiGap))
|
||||
{
|
||||
IUCode* pUCode = CDSPHandler::GetInstance().GetUCode();
|
||||
|
||||
if (pUCode != NULL)
|
||||
{
|
||||
pUCode->MixAdd(buffer, numSamples);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#ifndef _MIXER_H
|
||||
#define _MIXER_H
|
||||
|
||||
extern volatile bool mixer_HLEready;
|
||||
void Mixer(short* buffer, int numSamples, int bits, int rate, int channels);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user