new sound manager (adv&nds)

refs #99
 svn merge -r 212:213 https://amethyst.yui.ne.jp/svn-dev/x1/xmil/branches/yui/WORK_02
This commit is contained in:
yui 2015-11-23 02:17:09 +00:00
parent 99e54b2199
commit 3637bc6173
16 changed files with 83 additions and 94 deletions

View File

@ -1,22 +1,17 @@
#include "compiler.h"
#include "z80core.h"
#include "pccore.h"
#include "advpsg.h"
/**
* @file advpsg.c
* @brief Implementation of the PSG generator
*/
#include "compiler.h"
#include "advpsg.h"
#include "z80core.h"
#include "pccore.h"
// #define PSG0_DISABLE
// #define PSG1_DISABLE
// #define PSG2_DISABLE
enum {
PSGENV_INC = 15,
PSGENV_ONESHOT = 16,
PSGENV_LASTON = 32,
PSGENV_ONECYCLE = 64
};
// エンベロープパターン
static const UINT8 psgenv_pat[16] = {
PSGENV_ONESHOT,
@ -326,10 +321,6 @@ void advpsg_setreg(ADVPSG psg, REG8 reg, REG8 value) {
}
}
REG8 psggen_getreg(ADVPSG psg, REG8 reg) {
return(((UINT8 *)&psg->reg)[reg & 15]);
}
// ----

View File

@ -1,14 +1,11 @@
/**
* @file advpsg.h
* @brief Interface of the PSG generator
*/
typedef struct {
UINT8 tune[3][2]; // 0
UINT8 noise; // 6
UINT8 mixer; // 7
UINT8 vol[3]; // 8
UINT8 envtime[2]; // b
UINT8 env; // d
UINT8 io1;
UINT8 io2;
} PSGREG;
#pragma once
#include "sound/psggen.h"
typedef struct {
PSGREG reg;

View File

@ -35,8 +35,16 @@ REG8 IOINPCALL sndboard_psgsta(UINT port) {
// ----
void sndboard_reset(void) {
void sndboard_initialize(void)
{
}
void sndboard_deinitialize(void)
{
}
void sndboard_reset(void)
{
advpsg_reset(&advpsg);
}

View File

@ -3,6 +3,8 @@
.global sndboard_psgreg
.global sndboard_psgdat
.global sndboard_psgsta
.global sndboard_initialize
.global sndboard_deinitialize
.global sndboard_reset
.extern advpsg_setreg
.extern advpsg_reset
@ -52,6 +54,9 @@ advpsg: .fill ADVPSG_SIZE, 1, 0
.code 32
.align 0
sndboard_initialize:
sndboard_deinitialize:
mov pc, lr
sndboard_reset:
ldr r0, 200f

View File

@ -9,11 +9,12 @@
#include "iocore.h"
#include "keystat.h"
#include "sound.h"
#include "sndctrl.h"
static UINT8 s_rapids;
/* OPM */
#if defined(SUPPORT_TURBOZ) || defined(SUPPORT_OPM)
OPM g_opm;
void IOOUTCALL opm_o(UINT port, REG8 dat)
{
REG8 lsb;
@ -54,6 +55,12 @@ REG8 IOINPCALL opm_i(UINT port)
#endif
/* PSG */
static UINT8 s_rapids;
PSG g_psg;
void IOOUTCALL sndboard_psgreg(UINT port, REG8 dat)
{
g_psg.s.addr = dat;
@ -105,11 +112,14 @@ REG8 IOINPCALL sndboard_psgsta(UINT port)
}
}
/**
* Initialize
*/
void sndboard_initialize(void)
{
#if defined(SUPPORT_TURBOZ) || defined(SUPPORT_OPM)
opm_construct(&g_opm);
#endif
#endif /* defined(SUPPORT_TURBOZ) || defined(SUPPORT_OPM) */
psg_construct(&g_psg);
}

View File

@ -5,16 +5,23 @@
#pragma once
#if defined(SUPPORT_TURBOZ) || defined(SUPPORT_OPM)
#include "opm.h"
#endif /* defined(SUPPORT_TURBOZ) || defined(SUPPORT_OPM) */
#include "psg.h"
#ifdef __cplusplus
extern "C"
{
#endif
#if defined(SUPPORT_TURBOZ) || defined(SUPPORT_OPM)
extern OPM g_opm;
void IOOUTCALL opm_o(UINT port, REG8 dat);
REG8 IOINPCALL opm_i(UINT port);
#endif
#endif /* defined(SUPPORT_TURBOZ) || defined(SUPPORT_OPM) */
extern PSG g_psg;
void IOOUTCALL sndboard_psgreg(UINT port, REG8 dat);
void IOOUTCALL sndboard_psgdat(UINT port, REG8 dat);
REG8 IOINPCALL sndboard_psgsta(UINT port);

View File

@ -21,11 +21,12 @@ Z80A = ../z80ands
Z80C = ../z80ac
IO = ../io
VRAM = ./vram
SOUND = ./sound
SOUND = ../sound
FDD = ./fdd
TARGET = .
TARGET2 = ./nds
PATCH = ./patch
ASOUND = ./sound
HEADERS = $(TARGET2)/compiler.h $(BASE)/common.h \
$(COMMON)/milstr.h $(COMMON)/_memory.h $(TARGET2)/trace.h \
@ -282,7 +283,7 @@ $(OBJ)/sio.o: $(IO)/sio.c $(HEADERS) $(Z80CORES) $(PCCORES) $(IOCORES) \
$(CC) $(COPT9) -c $< -o $@
$(OBJ)/sndboard.o: $(PATCH)/sndboard.c $(HEADERS) $(PCCORES) $(IOCORES) \
$(TARGET)/ipcxfer.h $(SOUND)/nds9psg.h
$(TARGET)/ipcxfer.h $(ASOUND)/nds9psg.h
$(CC) $(COPT9) -c $< -o $@
$(OBJ)/sndboard.oa :$(PATCH)/sndboard.s $(TARGET2)/ramptr.inc
@ -378,12 +379,12 @@ $(OBJ)/vsyncff.o: $(VRAM)/vsyncff.cpp
$(OBJ)/nds9psg.o: $(SOUND)/nds9psg.cpp $(HEADERS) $(TARGET)/ipcxfer.h \
$(SOUND)/nds9psg.h
$(OBJ)/nds9psg.o: $(ASOUND)/nds9psg.cpp $(HEADERS) $(TARGET)/ipcxfer.h \
$(ASOUND)/nds9psg.h
$(CXX) $(COPT9) -c $< -o $@
$(OBJ)/nds7psg.o: $(SOUND)/nds7psg.cpp $(HEADERS) $(TARGET)/ipcxfer.h \
$(SOUND)/nds7psg.h
$(OBJ)/nds7psg.o: $(ASOUND)/nds7psg.cpp $(HEADERS) $(TARGET)/ipcxfer.h \
$(ASOUND)/nds7psg.h
$(CXX) $(COPT7) -c $< -o $@
@ -410,11 +411,11 @@ $(OBJ)/xmil9.o: $(TARGET)/xmil9.cpp $(HEADERS) $(TARGET)/xmil9.h \
$(TARGET)/sysmng.h $(Z80CORES) $(PCCORES) $(IOCORES) \
$(TARGET)/joymng.h $(BASE)/timing.h $(VRAM)/makescrn.h \
$(FDD)/fddfile.h $(PATCH)/font.h $(TARGET)/ipcxfer.h \
$(SOUND)/nds9psg.h $(VRAM)/vram.h $(VRAM)/vsyncff.h
$(ASOUND)/nds9psg.h $(VRAM)/vram.h $(VRAM)/vsyncff.h
$(CXX) $(COPT9) -c $< -o $@
$(OBJ)/xmil7.o: $(TARGET)/xmil7.cpp $(HEADERS) $(TARGET)/xmil7.h \
$(TARGET)/ipcxfer.h $(SOUND)/nds7psg.h
$(TARGET)/ipcxfer.h $(ASOUND)/nds7psg.h
$(CXX) $(COPT7) -c $< -o $@
$(OBJ)/joymng.o: $(TARGET)/joymng.cpp $(HEADERS) $(TARGET)/mousemng.h

View File

@ -1,7 +1,7 @@
#include "compiler.h"
#include "libnds.h"
#include "iocore.h"
#include "nds9psg.h"
#include "sound/nds9psg.h"
#include "makescrn.h"

View File

@ -1,8 +1,8 @@
#include "compiler.h"
#include "pccore.h"
#include "iocore.h"
#include"z80core.h"
#include "nds9psg.h"
#include "z80core.h"
#include "sound/nds9psg.h"
#if defined(SUPPORT_ROMEO2)
#include <nds/registers_alt.h>
#include "romeo2.h"
@ -139,6 +139,14 @@ REG8 IOINPCALL opm_i(UINT uPort)
// ----
void sndboard_initialize(void)
{
}
void sndboard_deinitialize(void)
{
}
void sndboard_reset()
{
#if defined(SUPPORT_ROMEO2)

View File

@ -1,8 +0,0 @@
// #include "opmgen.h"
// #include "psggen.h"
#define sndctrl_initialize()
#define sndctrl_deinitialize()
#define sndctrl_reset()

View File

@ -1,17 +0,0 @@
#ifndef SOUNDCALL
#define SOUNDCALL
#endif
typedef void (SOUNDCALL * SOUNDCB)(void *hdl, SINT32 *pcm, UINT count);
#define sound_create(r, m) (FAILURE)
#define sound_destroy()
#define sound_reset()
#define sound_changeclock()
#define sound_streamregist(h, c)
#define sound_sync()
#define sound_makesample(l)
#define sound_pcmlock() (NULL)
#define sound_pcmunlock(h)

View File

@ -4,7 +4,7 @@
#if defined(_WIN32) && defined(NDS_SIMULATE)
#include "dosio.h"
#endif
#include "nds7psg.h"
#include "sound/nds7psg.h"
#include "softkbd7.h"
static void touch()

View File

@ -13,7 +13,7 @@
#include "makescrn.h"
#include "fddfile.h"
#include "font.h"
#include "nds9psg.h"
#include "sound/nds9psg.h"
#include "vram.h"
#include "vsyncff.h"
#include "resource.h"

View File

@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I ".\\" /I ".\patch" /I ".\win32s" /I "..\\" /I "..\common" /I "..\z80ac" /I "..\io" /I ".\vram" /I ".\sound" /I ".\fdd" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "TRACE" /D MAKESCRN_VRAMFF=1 /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I ".\\" /I ".\patch" /I ".\win32s" /I "..\\" /I "..\common" /I "..\z80ac" /I "..\io" /I ".\vram" /I "..\sound" /I ".\fdd" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "TRACE" /D MAKESCRN_VRAMFF=1 /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x411 /d "NDEBUG"
# ADD RSC /l 0x411 /d "NDEBUG"
@ -68,7 +68,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".\\" /I ".\patch" /I ".\win32s" /I "..\\" /I "..\common" /I "..\z80ac" /I "..\io" /I ".\vram" /I ".\sound" /I ".\fdd" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D MAKESCRN_VRAMFF=1 /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".\\" /I ".\patch" /I ".\win32s" /I "..\\" /I "..\common" /I "..\z80ac" /I "..\io" /I ".\vram" /I "..\sound" /I ".\fdd" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D MAKESCRN_VRAMFF=1 /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x411 /d "_DEBUG"
# ADD RSC /l 0x411 /d "_DEBUG"

View File

@ -6,15 +6,14 @@
#include "compiler.h"
#include "sndctrl.h"
#if !defined(DISABLE_SOUND)
#include "soundmng.h"
#include "pccore.h"
#include "sound.h"
#if defined(SUPPORT_TURBOZ) || defined(SUPPORT_OPM)
OPM g_opm;
#endif
PSG g_psg;
#include "opmgen.h"
#include "psggen.h"
#include "soundmng.h"
/**
* Initialize
*/
void sndctrl_initialize(void)
{
UINT rate;
@ -29,13 +28,12 @@ void sndctrl_initialize(void)
psggen_setvol(xmilcfg.vol_ssg);
}
/**
* Deinitialize
*/
void sndctrl_deinitialize(void)
{
soundmng_stop();
sound_destroy();
}
void sndctrl_reset(void)
{
}
#endif

View File

@ -5,9 +5,6 @@
#pragma once
#include "opm.h"
#include "psg.h"
#if !defined(DISABLE_SOUND)
#ifdef __cplusplus
@ -15,14 +12,8 @@ extern "C"
{
#endif
#if defined(SUPPORT_TURBOZ) || defined(SUPPORT_OPM)
extern OPM g_opm;
#endif
extern PSG g_psg;
void sndctrl_initialize(void);
void sndctrl_deinitialize(void);
void sndctrl_reset(void);
#ifdef __cplusplus
}
@ -32,7 +23,5 @@ void sndctrl_reset(void);
#define sndctrl_initialize()
#define sndctrl_deinitialize()
#define sndctrl_reset()
#endif