提交 c90a5adf 编写于 作者: Z Zihao Yu

Merge branch 'fix-audio' into 'master'

Fix audio

See merge request projectn/nexus-am!45
......@@ -2,6 +2,7 @@ AM_SRCS := navy/trm.c \
navy/ioe.c \
navy/dev/input.c \
navy/dev/timer.c \
dummy/audio.c \
navy/dev/video.c
NAVY_MAKEFILE = Makefile.navy
......
......@@ -4,6 +4,7 @@ AM_SRCS += sdi/trm.c \
nemu/common/input.c \
nemu/common/timer.c \
nemu/common/video.c \
dummy/audio.c \
dummy/cte.c \
dummy/vme.c \
dummy/mpe.c \
......
......@@ -13,6 +13,7 @@ AM_SRCS := noop/isa/riscv/trm.c \
noop/common/input.c \
noop/common/timer.c \
nemu/common/video.c \
dummy/audio.c \
noop/isa/riscv/instr.c \
dummy/mpe.c \
nemu/isa/riscv/boot/start.S
......
#include <am.h>
void __am_audio_init() {
}
size_t __am_audio_write(uintptr_t reg, void *buf, size_t size) {
return 0;
}
size_t __am_audio_read(uintptr_t reg, void *buf, size_t size) {
return 0;
}
......@@ -20,11 +20,11 @@
# define AUDIO_COUNT_ADDR 0x214
# define AUDIO_SBUF_ADDR 0xa0800000
#elif defined(__ARCH_RISCV64_NOOP) || defined(__ARCH_RISCV32_NOOP)
# define KBD_ADDR 0x40900000
# define RTC_ADDR 0x4800bff8
# define SCREEN_ADDR 0x40800000
# define SYNC_ADDR 0x40800004
# define FB_ADDR 0x41000000
//# define KBD_ADDR 0x40900000
# define RTC_ADDR 0x3800bff8
# define SCREEN_ADDR 0x40001000
# define SYNC_ADDR 0x40001004
# define FB_ADDR 0x50000000
#else
# define SERIAL_PORT 0xa10003f8
# define KBD_ADDR 0xa1000060
......
......@@ -8,7 +8,7 @@
#if defined(__PLATFORM_NEMU__)
# define NR_FRAMESKIP 1
# define SOUND_CONFIG SOUND_LQ
#elif defined(__PLATFORM_NOOP__)
#elif defined(__PLATFORM_NOOP__) || defined(__PLATFORM_SDI__) || defined(__PLATFORM_NAVY__)
# define NR_FRAMESKIP 2
# define SOUND_CONFIG SOUND_NONE
#else
......
......@@ -45,7 +45,6 @@ InitSound()
const int soundrate = 11025;
const int soundq = 0;
#endif
const int soundbufsize = 128;
const int soundvolume = 150;
const int soundtrianglevolume = 256;
const int soundsquare1volume = 256;
......@@ -53,6 +52,8 @@ InitSound()
const int soundnoisevolume = 256;
const int soundpcmvolume = 256;
#if SOUND_CONFIG != SOUND_NONE
const int soundbufsize = 128;
_DEV_AUDIO_INIT_t init;
init.freq = soundrate;
init.channels = 1;
......@@ -64,6 +65,7 @@ InitSound()
s_BufferSize = init.bufsize;
init.bufsize *= sizeof(int16_t);
_io_write(_DEV_AUDIO, _DEVREG_AUDIO_INIT, &init, sizeof(init));
#endif
FCEUI_SetSoundVolume(soundvolume);
FCEUI_SetSoundQuality(soundq);
......@@ -92,10 +94,14 @@ GetMaxSound(void)
uint32
GetWriteSound(void)
{
#if SOUND_CONFIG != SOUND_NONE
_DEV_AUDIO_SBSTAT_t audio;
_io_read(_DEV_AUDIO, _DEVREG_AUDIO_SBSTAT, &audio, sizeof(audio));
audio.count /= sizeof(int16_t);
return s_BufferSize - audio.count;
#else
return 0;
#endif
}
/**
......@@ -105,6 +111,7 @@ GetWriteSound(void)
WriteSound(int32 *buf,
int Count)
{
#if SOUND_CONFIG != SOUND_NONE
extern int EmulationPaused;
if (EmulationPaused == 0) {
// FECUX stores each PCM sample as 32-bit data,
......@@ -125,6 +132,7 @@ WriteSound(int32 *buf,
_io_write(_DEV_AUDIO, _DEVREG_AUDIO_SBCTRL, &audio, sizeof(audio));
free(buf16);
}
#endif
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册