mirror of
https://github.com/libretro/pcsx2.git
synced 2024-11-24 17:59:47 +00:00
And there goes SPU2null. This one deserves a lot more work, though. A real gui and backporting all the changes I made to ZeroSPU2, for starters. (And again, Windows may or may not compile for it. Looking at the Visual C++ file, I'm pretty sure it already wasn't compiling.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1109 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
48c235830b
commit
456672168e
86
plugins/SPU2null/Linux/Config.cpp
Normal file
86
plugins/SPU2null/Linux/Config.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
/* SPU2null
|
||||
* Copyright (C) 2002-2005 SPU2null Team
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "SPU2.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
GtkWidget *MsgDlg;
|
||||
|
||||
void OnMsg_Ok()
|
||||
{
|
||||
gtk_widget_destroy(MsgDlg);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void SysMessage(char *fmt, ...)
|
||||
{
|
||||
GtkWidget *Ok, *Txt;
|
||||
GtkWidget *Box, *Box1;
|
||||
va_list list;
|
||||
char msg[512];
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(msg, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
|
||||
|
||||
MsgDlg = gtk_window_new(GTK_WINDOW_POPUP);
|
||||
gtk_window_set_position(GTK_WINDOW(MsgDlg), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_title(GTK_WINDOW(MsgDlg), "SPU2null Msg");
|
||||
gtk_container_set_border_width(GTK_CONTAINER(MsgDlg), 5);
|
||||
|
||||
Box = gtk_vbox_new(5, 0);
|
||||
gtk_container_add(GTK_CONTAINER(MsgDlg), Box);
|
||||
gtk_widget_show(Box);
|
||||
|
||||
Txt = gtk_label_new(msg);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5);
|
||||
gtk_widget_show(Txt);
|
||||
|
||||
Box1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(Box), Box1, FALSE, FALSE, 0);
|
||||
gtk_widget_show(Box1);
|
||||
|
||||
Ok = gtk_button_new_with_label("Ok");
|
||||
gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnMsg_Ok), NULL);
|
||||
gtk_container_add(GTK_CONTAINER(Box1), Ok);
|
||||
GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show(Ok);
|
||||
|
||||
gtk_widget_show(MsgDlg);
|
||||
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
EXPORT_C_(void) SPU2configure()
|
||||
{
|
||||
SysMessage("Nothing to Configure");
|
||||
}
|
||||
|
||||
EXPORT_C_(void) SPU2about()
|
||||
{
|
||||
SysMessage("%s %d.%d", libraryName, version, build);
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
}
|
27
plugins/SPU2null/Makefile.am
Normal file
27
plugins/SPU2null/Makefile.am
Normal file
@ -0,0 +1,27 @@
|
||||
# Create a shared library libSPU2null
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LIBRARIES = libSPU2null.a
|
||||
INCLUDES = -I@srcdir@/../../common/include -I@srcdir@/../../3rdparty -I@srcdir@/Linux
|
||||
|
||||
libSPU2null_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0)
|
||||
libSPU2null_a_CFLAGS = $(shell pkg-config --cflags gtk+-2.0)
|
||||
|
||||
# Create a shared object by faking an exe (thanks to ODE makefiles)
|
||||
traplibdir=$(prefix)
|
||||
|
||||
if DEBUGBUILD
|
||||
preext=d
|
||||
endif
|
||||
|
||||
EXEEXT=$(preext)@so_ext@
|
||||
|
||||
traplib_PROGRAMS=libSPU2null
|
||||
libSPU2null_SOURCES=
|
||||
libSPU2null_DEPENDENCIES = libSPU2null.a
|
||||
libSPU2null_LDFLAGS= @SHARED_LDFLAGS@
|
||||
libSPU2null_LDFLAGS+=-Wl,-soname,@libSPU2null_SONAME@
|
||||
libSPU2null_LDADD=$(libSPU2null_a_OBJECTS)
|
||||
|
||||
libSPU2null_a_SOURCES = SPU2.cpp SPU2.h Linux/Config.cpp
|
||||
|
||||
#SUBDIRS = Linux
|
1287
plugins/SPU2null/SPU2.cpp
Normal file
1287
plugins/SPU2null/SPU2.cpp
Normal file
File diff suppressed because it is too large
Load Diff
293
plugins/SPU2null/SPU2.h
Normal file
293
plugins/SPU2null/SPU2.h
Normal file
@ -0,0 +1,293 @@
|
||||
/* SPU2null
|
||||
* Copyright (C) 2002-2005 SPU2null Team
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __SPU2_H__
|
||||
#define __SPU2_H__
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#define SPU2defs
|
||||
#include "PS2Edefs.h"
|
||||
}
|
||||
|
||||
#ifdef __LINUX__
|
||||
#include <gtk/gtk.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK
|
||||
#else
|
||||
#define EXPORT_C_(type) extern "C" type
|
||||
#endif
|
||||
|
||||
extern FILE *spu2Log;
|
||||
#define SPU2_LOG __Log //debug mode
|
||||
|
||||
extern const unsigned char version;
|
||||
extern const unsigned char revision;
|
||||
extern const unsigned char build;
|
||||
extern const unsigned int minor;
|
||||
extern char *libraryName;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int Log;
|
||||
} Config;
|
||||
|
||||
extern Config conf;
|
||||
|
||||
void __Log(char *fmt, ...);
|
||||
void SaveConfig();
|
||||
void LoadConfig();
|
||||
void SysMessage(char *fmt, ...);
|
||||
|
||||
////////////////////
|
||||
// SPU2 Registers //
|
||||
////////////////////
|
||||
#define REG_VP_VOLL 0x0000
|
||||
#define REG_VP_VOLR 0x0002
|
||||
#define REG_VP_PITCH 0x0004
|
||||
#define REG_VP_ADSR1 0x0006
|
||||
#define REG_VP_ADSR2 0x0008
|
||||
#define REG_VP_ENVX 0x000A
|
||||
#define REG_VP_VOLXL 0x000C
|
||||
#define REG_VP_VOLXR 0x000E
|
||||
#define REG_C0_FMOD1 0x0180
|
||||
#define REG_C0_FMOD2 0x0182
|
||||
#define REG_C1_FMOD1 0x0580
|
||||
#define REG_C1_FMOD2 0x0582
|
||||
#define REG_S_NON 0x0184
|
||||
#define REG_S_VMIXL 0x0188
|
||||
#define REG_S_VMIXEL 0x018C
|
||||
#define REG_S_VMIXR 0x0190
|
||||
#define REG_S_VMIXER 0x0194
|
||||
#define REG_C0_MMIX 0x0198
|
||||
#define REG_C1_MMIX 0x0598
|
||||
#define REG_C0_CTRL 0x019A
|
||||
#define REG_C0_IRQA_HI 0x019C
|
||||
#define REG_C0_IRQA_LO 0x019D
|
||||
#define REG_C1_IRQA_HI 0x059C
|
||||
#define REG_C1_IRQA_LO 0x059D
|
||||
#define REG_C0_SPUON1 0x1A0
|
||||
#define REG_C0_SPUON2 0x1A2
|
||||
#define REG_C1_SPUON1 0x5A0
|
||||
#define REG_C1_SPUON2 0x5A2
|
||||
#define REG_C0_SPUOFF1 0x1A4
|
||||
#define REG_C0_SPUOFF2 0x1A6
|
||||
#define REG_C1_SPUOFF1 0x5A4
|
||||
#define REG_C1_SPUOFF2 0x5A6
|
||||
#define REG_C0_SPUADDR_HI 0x01A8
|
||||
#define REG_C0_SPUADDR_LO 0x01AA
|
||||
#define REG_C1_SPUADDR_HI 0x05A8
|
||||
#define REG_C1_SPUADDR_LO 0x05AA
|
||||
#define REG_C0_SPUDATA 0x01AC
|
||||
#define REG_C1_SPUDATA 0x05AC
|
||||
#define REG_C0_DMACTRL 0x01AE
|
||||
#define REG_C1_DMACTRL 0x05AE
|
||||
#define REG_C0_ADMAS 0x01B0
|
||||
#define REG_VA_SSA 0x01C0
|
||||
#define REG_VA_LSAX 0x01C4
|
||||
#define REG_VA_NAX 0x01C8
|
||||
#define REG_A_ESA 0x02E0
|
||||
#define REG_A_EEA 0x033C
|
||||
#define REG_C0_END1 0x0340
|
||||
#define REG_C0_END2 0x0342
|
||||
#define REG_C1_END1 0x0740
|
||||
#define REG_C1_END2 0x0742
|
||||
#define REG_C0_SPUSTAT 0x0344 //not sure!
|
||||
#define REG_C1_CTRL 0x059A
|
||||
#define REG_C1_ADMAS 0x05B0
|
||||
#define REG_C1_SPUSTAT 0x0744 //not sure!
|
||||
#define REG_P_MVOLL 0x0760
|
||||
#define REG_P_MVOLR 0x0762
|
||||
#define REG_P_EVOLL 0x0764
|
||||
#define REG_P_EVOLR 0x0766
|
||||
#define REG_P_AVOLL 0x0768
|
||||
#define REG_P_AVOLR 0x076A
|
||||
#define REG_P_BVOLL 0x076C
|
||||
#define REG_P_BVOLR 0x076E
|
||||
#define REG_P_MVOLXL 0x0770
|
||||
#define REG_P_MVOLXR 0x0772
|
||||
#define SPDIF_OUT 0x07C0
|
||||
#define REG_IRQINFO 0x07C2
|
||||
#define SPDIF_MODE 0x07C6
|
||||
#define SPDIF_MEDIA 0x07C8
|
||||
|
||||
#define spu2Rs16(mem) (*(s16*)&spu2regs[(mem) & 0xffff])
|
||||
#define spu2Ru16(mem) (*(u16*)&spu2regs[(mem) & 0xffff])
|
||||
//#define spu2Rs32(mem) (*(s32*)&spu2regs[(mem) & 0xffff])
|
||||
//#define spu2Ru32(mem) (*(u32*)&spu2regs[(mem) & 0xffff])
|
||||
|
||||
#define IRQINFO spu2Ru16(REG_IRQINFO)
|
||||
|
||||
#define SPU2_GET32BIT(lo,hi) (((u32)(spu2Ru16(hi)&0x3f)<<16)|(u32)spu2Ru16(lo))
|
||||
#define SPU2_SET32BIT(value, lo, hi) { \
|
||||
spu2Ru16(hi) = ((value)>>16)&0x3f; \
|
||||
spu2Ru16(lo) = (value)&0xffff; \
|
||||
} \
|
||||
|
||||
#define C0_IRQA SPU2_GET32BIT(REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
||||
#define C1_IRQA SPU2_GET32BIT(REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
||||
|
||||
#define C0_SPUADDR SPU2_GET32BIT(REG_C0_SPUADDR_LO, REG_C0_SPUADDR_HI)
|
||||
#define C1_SPUADDR SPU2_GET32BIT(REG_C1_SPUADDR_LO, REG_C1_SPUADDR_HI)
|
||||
|
||||
#define C0_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
||||
#define C1_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
||||
|
||||
#define SPU_NUMBER_VOICES 48
|
||||
|
||||
struct SPU_CONTROL_
|
||||
{
|
||||
u16 spuon : 1;
|
||||
u16 spuUnmute : 1;
|
||||
u16 noiseFreq : 6;
|
||||
u16 reverb : 1;
|
||||
u16 irq : 1;
|
||||
u16 dma : 2; // 1 - no dma, 2 - write, 3 - read
|
||||
u16 extr : 1; // external reverb
|
||||
u16 cdreverb : 1;
|
||||
u16 extAudio : 1;
|
||||
u16 extCd : 1;
|
||||
};
|
||||
|
||||
// the layout of each voice in wSpuRegs
|
||||
struct _SPU_VOICE
|
||||
{
|
||||
union
|
||||
{
|
||||
struct {
|
||||
u16 Vol : 14;
|
||||
u16 Inverted : 1;
|
||||
u16 Sweep0 : 1;
|
||||
} vol;
|
||||
struct {
|
||||
u16 Vol : 7;
|
||||
u16 res1 : 5;
|
||||
u16 Inverted : 1;
|
||||
u16 Decrease : 1; // if 0, increase
|
||||
u16 ExpSlope : 1; // if 0, linear slope
|
||||
u16 Sweep1 : 1; // always one
|
||||
} sweep;
|
||||
u16 word;
|
||||
} left, right;
|
||||
|
||||
u16 pitch : 14; // 1000 - no pitch, 2000 - pitch + 1, etc
|
||||
u16 res0 : 2;
|
||||
|
||||
u16 SustainLvl : 4;
|
||||
u16 DecayRate : 4;
|
||||
u16 AttackRate : 7;
|
||||
u16 AttackExp : 1; // if 0, linear
|
||||
|
||||
u16 ReleaseRate : 5;
|
||||
u16 ReleaseExp : 1; // if 0, linear
|
||||
u16 SustainRate : 7;
|
||||
u16 res1 : 1;
|
||||
u16 SustainDec : 1; // if 0, inc
|
||||
u16 SustainExp : 1; // if 0, linear
|
||||
|
||||
u16 AdsrVol;
|
||||
u16 Address; // add / 8
|
||||
u16 RepeatAddr; // gets reset when sample starts
|
||||
};
|
||||
|
||||
// ADSR INFOS PER CHANNEL
|
||||
struct ADSRInfoEx
|
||||
{
|
||||
int State;
|
||||
int AttackModeExp;
|
||||
int AttackRate;
|
||||
int DecayRate;
|
||||
int SustainLevel;
|
||||
int SustainModeExp;
|
||||
int SustainIncrease;
|
||||
int SustainRate;
|
||||
int ReleaseModeExp;
|
||||
int ReleaseRate;
|
||||
int EnvelopeVol;
|
||||
long lVolume;
|
||||
};
|
||||
|
||||
#define NSSIZE 48 // ~ 1 ms of data
|
||||
#define NSFRAMES 16 // gather at least NSFRAMES of NSSIZE before submitting
|
||||
#define NSPACKETS 4
|
||||
#define SPU_VOICE_STATE_SIZE (sizeof(VOICE_PROCESSED)-4*sizeof(void*))
|
||||
|
||||
struct VOICE_PROCESSED
|
||||
{
|
||||
VOICE_PROCESSED()
|
||||
{
|
||||
memset(this, 0, sizeof(VOICE_PROCESSED));
|
||||
}
|
||||
~VOICE_PROCESSED()
|
||||
{
|
||||
}
|
||||
|
||||
void SetVolume(int right);
|
||||
void StartSound();
|
||||
void VoiceChangeFrequency();
|
||||
void FModChangeFrequency(int ns);
|
||||
void Stop();
|
||||
|
||||
SPU_CONTROL_* GetCtrl();
|
||||
|
||||
// start save state
|
||||
|
||||
int iSBPos; // mixing stuff
|
||||
int spos;
|
||||
int sinc;
|
||||
|
||||
int iActFreq; // current psx pitch
|
||||
int iUsedFreq; // current pc pitch
|
||||
|
||||
int iStartAddr, iLoopAddr, iNextAddr;
|
||||
|
||||
ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start)
|
||||
bool bIgnoreLoop, bNew, bNoise, bReverb, bOn, bStop, bVolChanged;
|
||||
int memoffset; // if first core, 0, if second, 0x400
|
||||
|
||||
// end save state
|
||||
|
||||
///////////////////
|
||||
// Sound Buffers //
|
||||
///////////////////
|
||||
u8* pStart; // start and end addresses
|
||||
u8* pLoop, *pCurr;
|
||||
|
||||
_SPU_VOICE* pvoice;
|
||||
};
|
||||
|
||||
struct ADMA
|
||||
{
|
||||
unsigned short * MemAddr;
|
||||
long IntPointer;
|
||||
int Index;
|
||||
int AmountLeft;
|
||||
int Enabled;
|
||||
};
|
||||
|
||||
#endif /* __SPU2_H__ */
|
@ -1,25 +0,0 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
PLUGIN = libSPU2null.so
|
||||
CFLAGS+= -fPIC -Wall -O2 -fomit-frame-pointer -D__LINUX__ -I../../../common/include
|
||||
OBJS = SPU2.o
|
||||
DEPS:= $(OBJS:.o=.d)
|
||||
LIBS = $(shell pkg-config --libs gtk+-2.0)
|
||||
CFLAGS+= $(shell pkg-config --cflags gtk+-2.0)
|
||||
|
||||
all: plugin
|
||||
install: all
|
||||
|
||||
plugin: ${OBJS}
|
||||
rm -f ${PLUGIN}
|
||||
gcc -shared -Wl,-soname,${PLUGIN} ${CFLAGS} ${OBJS} -o ${PLUGIN} ${LIBS}
|
||||
strip --strip-unneeded --strip-debug ${PLUGIN}
|
||||
|
||||
clean:
|
||||
rm -f ${OBJS} ${DEPS}
|
||||
|
||||
%.o: %.cpp
|
||||
${CC} ${CFLAGS} -c -o $@ $< -MD -MF $(patsubst %.o,%.d,$@)
|
||||
|
||||
#-include ${DEPS}
|
File diff suppressed because it is too large
Load Diff
@ -1,280 +0,0 @@
|
||||
/* SPU2null
|
||||
* Copyright (C) 2002-2005 SPU2null Team
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __SPU2_H__
|
||||
#define __SPU2_H__
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
extern "C" {
|
||||
#define SPU2defs
|
||||
#include "PS2Edefs.h"
|
||||
}
|
||||
|
||||
#ifdef __LINUX__
|
||||
#include <gtk/gtk.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#endif
|
||||
|
||||
extern FILE *spu2Log;
|
||||
#define SPU2_LOG __Log //debug mode
|
||||
|
||||
|
||||
typedef struct {
|
||||
int Log;
|
||||
} Config;
|
||||
|
||||
extern Config conf;
|
||||
|
||||
void __Log(char *fmt, ...);
|
||||
void SaveConfig();
|
||||
void LoadConfig();
|
||||
void SysMessage(char *fmt, ...);
|
||||
|
||||
////////////////////
|
||||
// SPU2 Registers //
|
||||
////////////////////
|
||||
#define REG_VP_VOLL 0x0000
|
||||
#define REG_VP_VOLR 0x0002
|
||||
#define REG_VP_PITCH 0x0004
|
||||
#define REG_VP_ADSR1 0x0006
|
||||
#define REG_VP_ADSR2 0x0008
|
||||
#define REG_VP_ENVX 0x000A
|
||||
#define REG_VP_VOLXL 0x000C
|
||||
#define REG_VP_VOLXR 0x000E
|
||||
#define REG_C0_FMOD1 0x0180
|
||||
#define REG_C0_FMOD2 0x0182
|
||||
#define REG_C1_FMOD1 0x0580
|
||||
#define REG_C1_FMOD2 0x0582
|
||||
#define REG_S_NON 0x0184
|
||||
#define REG_S_VMIXL 0x0188
|
||||
#define REG_S_VMIXEL 0x018C
|
||||
#define REG_S_VMIXR 0x0190
|
||||
#define REG_S_VMIXER 0x0194
|
||||
#define REG_C0_MMIX 0x0198
|
||||
#define REG_C1_MMIX 0x0598
|
||||
#define REG_C0_CTRL 0x019A
|
||||
#define REG_C0_IRQA_HI 0x019C
|
||||
#define REG_C0_IRQA_LO 0x019D
|
||||
#define REG_C1_IRQA_HI 0x059C
|
||||
#define REG_C1_IRQA_LO 0x059D
|
||||
#define REG_C0_SPUON1 0x1A0
|
||||
#define REG_C0_SPUON2 0x1A2
|
||||
#define REG_C1_SPUON1 0x5A0
|
||||
#define REG_C1_SPUON2 0x5A2
|
||||
#define REG_C0_SPUOFF1 0x1A4
|
||||
#define REG_C0_SPUOFF2 0x1A6
|
||||
#define REG_C1_SPUOFF1 0x5A4
|
||||
#define REG_C1_SPUOFF2 0x5A6
|
||||
#define REG_C0_SPUADDR_HI 0x01A8
|
||||
#define REG_C0_SPUADDR_LO 0x01AA
|
||||
#define REG_C1_SPUADDR_HI 0x05A8
|
||||
#define REG_C1_SPUADDR_LO 0x05AA
|
||||
#define REG_C0_SPUDATA 0x01AC
|
||||
#define REG_C1_SPUDATA 0x05AC
|
||||
#define REG_C0_DMACTRL 0x01AE
|
||||
#define REG_C1_DMACTRL 0x05AE
|
||||
#define REG_C0_ADMAS 0x01B0
|
||||
#define REG_VA_SSA 0x01C0
|
||||
#define REG_VA_LSAX 0x01C4
|
||||
#define REG_VA_NAX 0x01C8
|
||||
#define REG_A_ESA 0x02E0
|
||||
#define REG_A_EEA 0x033C
|
||||
#define REG_C0_END1 0x0340
|
||||
#define REG_C0_END2 0x0342
|
||||
#define REG_C1_END1 0x0740
|
||||
#define REG_C1_END2 0x0742
|
||||
#define REG_C0_SPUSTAT 0x0344 //not sure!
|
||||
#define REG_C1_CTRL 0x059A
|
||||
#define REG_C1_ADMAS 0x05B0
|
||||
#define REG_C1_SPUSTAT 0x0744 //not sure!
|
||||
#define REG_P_MVOLL 0x0760
|
||||
#define REG_P_MVOLR 0x0762
|
||||
#define REG_P_EVOLL 0x0764
|
||||
#define REG_P_EVOLR 0x0766
|
||||
#define REG_P_AVOLL 0x0768
|
||||
#define REG_P_AVOLR 0x076A
|
||||
#define REG_P_BVOLL 0x076C
|
||||
#define REG_P_BVOLR 0x076E
|
||||
#define REG_P_MVOLXL 0x0770
|
||||
#define REG_P_MVOLXR 0x0772
|
||||
#define SPDIF_OUT 0x07C0
|
||||
#define REG_IRQINFO 0x07C2
|
||||
#define SPDIF_MODE 0x07C6
|
||||
#define SPDIF_MEDIA 0x07C8
|
||||
|
||||
#define spu2Rs16(mem) (*(s16*)&spu2regs[(mem) & 0xffff])
|
||||
#define spu2Ru16(mem) (*(u16*)&spu2regs[(mem) & 0xffff])
|
||||
//#define spu2Rs32(mem) (*(s32*)&spu2regs[(mem) & 0xffff])
|
||||
//#define spu2Ru32(mem) (*(u32*)&spu2regs[(mem) & 0xffff])
|
||||
|
||||
#define IRQINFO spu2Ru16(REG_IRQINFO)
|
||||
|
||||
#define SPU2_GET32BIT(lo,hi) (((u32)(spu2Ru16(hi)&0x3f)<<16)|(u32)spu2Ru16(lo))
|
||||
#define SPU2_SET32BIT(value, lo, hi) { \
|
||||
spu2Ru16(hi) = ((value)>>16)&0x3f; \
|
||||
spu2Ru16(lo) = (value)&0xffff; \
|
||||
} \
|
||||
|
||||
#define C0_IRQA SPU2_GET32BIT(REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
||||
#define C1_IRQA SPU2_GET32BIT(REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
||||
|
||||
#define C0_SPUADDR SPU2_GET32BIT(REG_C0_SPUADDR_LO, REG_C0_SPUADDR_HI)
|
||||
#define C1_SPUADDR SPU2_GET32BIT(REG_C1_SPUADDR_LO, REG_C1_SPUADDR_HI)
|
||||
|
||||
#define C0_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
||||
#define C1_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
||||
|
||||
#define SPU_NUMBER_VOICES 48
|
||||
|
||||
struct SPU_CONTROL_
|
||||
{
|
||||
u16 spuon : 1;
|
||||
u16 spuUnmute : 1;
|
||||
u16 noiseFreq : 6;
|
||||
u16 reverb : 1;
|
||||
u16 irq : 1;
|
||||
u16 dma : 2; // 1 - no dma, 2 - write, 3 - read
|
||||
u16 extr : 1; // external reverb
|
||||
u16 cdreverb : 1;
|
||||
u16 extAudio : 1;
|
||||
u16 extCd : 1;
|
||||
};
|
||||
|
||||
// the layout of each voice in wSpuRegs
|
||||
struct _SPU_VOICE
|
||||
{
|
||||
union
|
||||
{
|
||||
struct {
|
||||
u16 Vol : 14;
|
||||
u16 Inverted : 1;
|
||||
u16 Sweep0 : 1;
|
||||
} vol;
|
||||
struct {
|
||||
u16 Vol : 7;
|
||||
u16 res1 : 5;
|
||||
u16 Inverted : 1;
|
||||
u16 Decrease : 1; // if 0, increase
|
||||
u16 ExpSlope : 1; // if 0, linear slope
|
||||
u16 Sweep1 : 1; // always one
|
||||
} sweep;
|
||||
u16 word;
|
||||
} left, right;
|
||||
|
||||
u16 pitch : 14; // 1000 - no pitch, 2000 - pitch + 1, etc
|
||||
u16 res0 : 2;
|
||||
|
||||
u16 SustainLvl : 4;
|
||||
u16 DecayRate : 4;
|
||||
u16 AttackRate : 7;
|
||||
u16 AttackExp : 1; // if 0, linear
|
||||
|
||||
u16 ReleaseRate : 5;
|
||||
u16 ReleaseExp : 1; // if 0, linear
|
||||
u16 SustainRate : 7;
|
||||
u16 res1 : 1;
|
||||
u16 SustainDec : 1; // if 0, inc
|
||||
u16 SustainExp : 1; // if 0, linear
|
||||
|
||||
u16 AdsrVol;
|
||||
u16 Address; // add / 8
|
||||
u16 RepeatAddr; // gets reset when sample starts
|
||||
};
|
||||
|
||||
// ADSR INFOS PER CHANNEL
|
||||
struct ADSRInfoEx
|
||||
{
|
||||
int State;
|
||||
int AttackModeExp;
|
||||
int AttackRate;
|
||||
int DecayRate;
|
||||
int SustainLevel;
|
||||
int SustainModeExp;
|
||||
int SustainIncrease;
|
||||
int SustainRate;
|
||||
int ReleaseModeExp;
|
||||
int ReleaseRate;
|
||||
int EnvelopeVol;
|
||||
long lVolume;
|
||||
};
|
||||
|
||||
#define NSSIZE 48 // ~ 1 ms of data
|
||||
#define NSFRAMES 16 // gather at least NSFRAMES of NSSIZE before submitting
|
||||
#define NSPACKETS 4
|
||||
#define SPU_VOICE_STATE_SIZE (sizeof(VOICE_PROCESSED)-4*sizeof(void*))
|
||||
|
||||
struct VOICE_PROCESSED
|
||||
{
|
||||
VOICE_PROCESSED()
|
||||
{
|
||||
memset(this, 0, sizeof(VOICE_PROCESSED));
|
||||
}
|
||||
~VOICE_PROCESSED()
|
||||
{
|
||||
}
|
||||
|
||||
void SetVolume(int right);
|
||||
void StartSound();
|
||||
void VoiceChangeFrequency();
|
||||
void FModChangeFrequency(int ns);
|
||||
void Stop();
|
||||
|
||||
SPU_CONTROL_* GetCtrl();
|
||||
|
||||
// start save state
|
||||
|
||||
int iSBPos; // mixing stuff
|
||||
int spos;
|
||||
int sinc;
|
||||
|
||||
int iActFreq; // current psx pitch
|
||||
int iUsedFreq; // current pc pitch
|
||||
|
||||
int iStartAddr, iLoopAddr, iNextAddr;
|
||||
|
||||
ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start)
|
||||
bool bIgnoreLoop, bNew, bNoise, bReverb, bOn, bStop, bVolChanged;
|
||||
int memoffset; // if first core, 0, if second, 0x400
|
||||
|
||||
// end save state
|
||||
|
||||
///////////////////
|
||||
// Sound Buffers //
|
||||
///////////////////
|
||||
u8* pStart; // start and end addresses
|
||||
u8* pLoop, *pCurr;
|
||||
|
||||
_SPU_VOICE* pvoice;
|
||||
};
|
||||
|
||||
struct ADMA
|
||||
{
|
||||
unsigned short * MemAddr;
|
||||
long IntPointer;
|
||||
int Index;
|
||||
int AmountLeft;
|
||||
int Enabled;
|
||||
};
|
||||
|
||||
#endif /* __SPU2_H__ */
|
@ -92,7 +92,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy $(TargetPath) ..\..\..\..\bin\plugins"
|
||||
CommandLine="copy $(TargetPath) ..\..\..\..\..\bin\plugins"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
@ -170,7 +170,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy $(TargetPath) ..\..\..\..\bin\plugins"
|
||||
CommandLine="copy $(TargetPath) ..\..\..\..\..\bin\plugins"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
@ -187,7 +187,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SPU2.cpp"
|
||||
RelativePath="..\SPU2.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@ -201,11 +201,11 @@
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\PS2Edefs.h"
|
||||
RelativePath="..\..\..\common\include\PS2Edefs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PS2Etypes.h"
|
||||
RelativePath="..\..\..\common\include\PS2Etypes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@ -213,7 +213,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SPU2.h"
|
||||
RelativePath="..\SPU2.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
@ -1,13 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo ---------------
|
||||
echo Building SPU2null
|
||||
echo ---------------
|
||||
|
||||
curdir=`pwd`
|
||||
|
||||
echo -----------------
|
||||
echo Building SPU2null
|
||||
echo -----------------
|
||||
|
||||
cd ${curdir}/Src
|
||||
if test "${SPU2nullOPTIONS+set}" != set ; then
|
||||
export SPU2nullOPTIONS=""
|
||||
fi
|
||||
|
||||
if [ $# -gt 0 ] && [ $1 = "all" ]
|
||||
then
|
||||
|
||||
aclocal
|
||||
automake -a
|
||||
autoconf
|
||||
|
||||
./configure ${SPU2nullOPTIONS} --prefix=${PCSX2PLUGINS}
|
||||
make clean
|
||||
make $@
|
||||
make install
|
||||
|
||||
cp libSPU2null.so ${PCSX2PLUGINS}
|
||||
else
|
||||
make $@
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
80
plugins/SPU2null/configure.ac
Normal file
80
plugins/SPU2null/configure.ac
Normal file
@ -0,0 +1,80 @@
|
||||
AC_INIT(SPU2null, 0.5,arcum42@gmail.com)
|
||||
|
||||
AM_INIT_AUTOMAKE(SPU2null,0.8)
|
||||
|
||||
AC_PROG_CC([gcc g++ cl KCC CC cxx cc++ xlC aCC c++])
|
||||
AC_PROG_CXX([gcc g++ cl KCC CC cxx cc++ xlC aCC c++])
|
||||
AC_PROG_CPP([gcc g++ cl KCC CC cxx cc++ xlC aCC c++])
|
||||
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
|
||||
dnl necessary for compiling assembly
|
||||
AM_PROG_AS
|
||||
|
||||
AC_SUBST(SPU2null_CURRENT, 0)
|
||||
AC_SUBST(SPU2null_REVISION, 8)
|
||||
AC_SUBST(SPU2null_AGE, 0)
|
||||
AC_SUBST(SPU2null_RELEASE,[$SPU2null_CURRENT].[$SPU2null_REVISION].[$SPU2null_AGE])
|
||||
AC_SUBST(SPU2null_SONAME,libSPU2null.so.[$SPU2null_CURRENT].[$SPU2null_REVISION].[$SPU2null_AGE])
|
||||
|
||||
CFLAGS=
|
||||
CPPFLAGS=
|
||||
CXXFLAGS=
|
||||
|
||||
dnl Check for debug build
|
||||
AC_MSG_CHECKING(debug build)
|
||||
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [debug build]),
|
||||
debug=$enableval,debug=no)
|
||||
if test "x$debug" == xyes
|
||||
then
|
||||
AC_DEFINE(_DEBUG,1,[_DEBUG])
|
||||
CFLAGS+="-g -fPIC -Wall -Wno-unused-value "
|
||||
CPPFLAGS+="-g -fPIC -Wall -Wno-unused-value "
|
||||
CXXFLAGS+="-g -fPIC -Wall -Wno-unused-value "
|
||||
else
|
||||
AC_DEFINE(NDEBUG,1,[NDEBUG])
|
||||
CFLAGS+="-O3 -fomit-frame-pointer -fPIC -Wall -Wno-unused-value "
|
||||
CPPFLAGS+="-O3 -fomit-frame-pointer -fPIC -Wall -Wno-unused-value "
|
||||
CXXFLAGS+="-O3 -fomit-frame-pointer -fPIC -Wall -Wno-unused-value "
|
||||
fi
|
||||
AM_CONDITIONAL(DEBUGBUILD, test x$debug = xyes)
|
||||
AC_MSG_RESULT($debug)
|
||||
|
||||
AC_DEFINE(__LINUX__,1,[__LINUX__])
|
||||
|
||||
dnl Check for dev build
|
||||
AC_MSG_CHECKING(for development build...)
|
||||
AC_ARG_ENABLE(devbuild, AC_HELP_STRING([--enable-devbuild], [Special Build for developers that simplifies testing and adds extra checks]),
|
||||
devbuild=$enableval,devbuild=no)
|
||||
if test "x$devbuild" == xyes
|
||||
then
|
||||
AC_DEFINE(SPU2null_DEVBUILD,1,[SPU2null_DEVBUILD])
|
||||
fi
|
||||
AC_MSG_RESULT($devbuild)
|
||||
AM_CONDITIONAL(RELEASE_TO_PUBLIC, test x$devbuild = xno)
|
||||
|
||||
AC_CHECK_FUNCS([ _aligned_malloc _aligned_free ], AC_DEFINE(HAVE_ALIGNED_MALLOC))
|
||||
|
||||
dnl gtk
|
||||
AC_MSG_CHECKING(gtk2+)
|
||||
AC_CHECK_PROG(GTK_CONFIG, pkg-config, pkg-config)
|
||||
LIBS+=$(pkg-config --libs gtk+-2.0)
|
||||
|
||||
dnl bindir = pcsx2exe
|
||||
|
||||
dnl assuming linux environment
|
||||
so_ext=".so.$SPU2null_RELEASE"
|
||||
SHARED_LDFLAGS="-shared"
|
||||
AC_SUBST(so_ext)
|
||||
AC_SUBST(SHARED_LDFLAGS)
|
||||
|
||||
AC_CHECK_LIB(stdc++,main,[LIBS="$LIBS -lstdc++"])
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
])
|
||||
|
||||
echo "Configuration:"
|
||||
echo " Debug build? $debug"
|
||||
echo " Dev build? $devbuild"
|
1
plugins/SPU2null/install-sh
Symbolic link
1
plugins/SPU2null/install-sh
Symbolic link
@ -0,0 +1 @@
|
||||
/usr/share/automake-1.10/install-sh
|
1
plugins/SPU2null/missing
Symbolic link
1
plugins/SPU2null/missing
Symbolic link
@ -0,0 +1 @@
|
||||
/usr/share/automake-1.10/missing
|
Loading…
Reference in New Issue
Block a user