forked from len0rd/rockbox
Commit FS #7379 - This patch fixes most of the sound problems from the previous version. This is a complete rewrite of VisualBoyAdvance's sound code from C++ to C. This patch also eliminates the need for some large tables giving more room in IRAM and the plugin buffer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13947 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e9c09d4d0e
commit
fa3fc0c5c7
7 changed files with 696 additions and 354 deletions
|
|
@ -562,10 +562,3 @@ void mbc_reset(void)
|
|||
mbc.enableram = 0;
|
||||
mem_updatemap();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ struct ram
|
|||
int loaded;
|
||||
};
|
||||
|
||||
|
||||
extern struct mbc mbc;
|
||||
extern struct rom rom;
|
||||
extern struct ram ram;
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@ struct pcm pcm IBSS_ATTR;
|
|||
bool doneplay=1;
|
||||
bool bufnum=0;
|
||||
|
||||
static unsigned short *buf=0;
|
||||
static unsigned short *buf=0, *hwbuf=0;
|
||||
|
||||
static bool newly_started;
|
||||
|
||||
void get_more(unsigned char** start, size_t* size)
|
||||
{
|
||||
*start = (unsigned char*)(&buf[pcm.len*doneplay]);
|
||||
memcpy(hwbuf, &buf[pcm.len*doneplay], BUF_SIZE*sizeof(short));
|
||||
*start = (unsigned char*)(hwbuf);
|
||||
*size = BUF_SIZE*sizeof(short);
|
||||
doneplay=1;
|
||||
}
|
||||
|
|
@ -29,14 +30,20 @@ void pcm_init(void)
|
|||
return;
|
||||
|
||||
newly_started = true;
|
||||
|
||||
|
||||
#if defined(HW_HAVE_11) && !defined(TOSHIBA_GIGABEAT_F)
|
||||
pcm.hz = SAMPR_11;
|
||||
#else
|
||||
pcm.hz = SAMPR_44;
|
||||
#endif
|
||||
|
||||
pcm.stereo = 1;
|
||||
|
||||
pcm.len = BUF_SIZE;
|
||||
if(!buf)
|
||||
{
|
||||
buf = my_malloc(pcm.len * N_BUFS *sizeof(short));
|
||||
hwbuf = my_malloc(pcm.len *sizeof(short));
|
||||
|
||||
pcm.buf = buf;
|
||||
pcm.pos = 0;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ void *sys_timer(void);
|
|||
int sys_elapsed(long *oldtick);
|
||||
int pcm_submit(void);
|
||||
void pcm_init(void);
|
||||
void sound_dirty(void);
|
||||
void doevents(void) ICODE_ATTR;
|
||||
void ev_poll(void);
|
||||
int do_user_menu(void);
|
||||
|
|
|
|||
|
|
@ -89,24 +89,24 @@ struct svar svars[] =
|
|||
|
||||
I4("S1on", &snd.ch[0].on),
|
||||
I4("S1p ", &snd.ch[0].pos),
|
||||
I4("S1c ", &snd.ch[0].cnt),
|
||||
I4("S1ec", &snd.ch[0].encnt),
|
||||
I4("S1sc", &snd.ch[0].swcnt),
|
||||
I4("S1c ", &snd.ch[0].len),
|
||||
I4("S1ec", &snd.ch[0].enlen),
|
||||
I4("S1sc", &snd.ch[0].swlen),
|
||||
|
||||
I4("S2on", &snd.ch[1].on),
|
||||
I4("S2p ", &snd.ch[1].pos),
|
||||
I4("S2c ", &snd.ch[1].cnt),
|
||||
I4("S2ec", &snd.ch[1].encnt),
|
||||
|
||||
I4("S2c ", &snd.ch[1].len),
|
||||
I4("S2ec", &snd.ch[1].enlen),
|
||||
|
||||
I4("S3on", &snd.ch[2].on),
|
||||
I4("S3p ", &snd.ch[2].pos),
|
||||
I4("S3c ", &snd.ch[2].cnt),
|
||||
|
||||
I4("S3c ", &snd.ch[2].len),
|
||||
|
||||
I4("S4on", &snd.ch[3].on),
|
||||
I4("S4p ", &snd.ch[3].pos),
|
||||
I4("S4c ", &snd.ch[3].cnt),
|
||||
I4("S4ec", &snd.ch[3].encnt),
|
||||
|
||||
I4("S4c ", &snd.ch[3].len),
|
||||
I4("S4ec", &snd.ch[3].enlen),
|
||||
|
||||
I4("hdma", &hw.hdma),
|
||||
|
||||
I4("sram", &sramblock),
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -5,18 +5,34 @@
|
|||
|
||||
struct sndchan
|
||||
{
|
||||
int on;
|
||||
unsigned pos;
|
||||
int cnt, encnt, swcnt;
|
||||
int len, enlen, swlen;
|
||||
int swfreq;
|
||||
int freq;
|
||||
int envol, endir;
|
||||
/* S1, S2, S3, S4 */
|
||||
int on, len, skip, cont;
|
||||
unsigned int pos;
|
||||
|
||||
/* S1, S2, S4 */
|
||||
int enlen, envol, endir, enlenreload;
|
||||
|
||||
/* S1, S2 */
|
||||
const byte *wave;
|
||||
|
||||
/* S1 only */
|
||||
int swlen, swlenreload, swsteps, swstep, swdir;
|
||||
|
||||
/* S3 only */
|
||||
int outputlevel;
|
||||
|
||||
/* S4 only */
|
||||
int shiftskip, shiftpos, shiftright, shiftleft;
|
||||
int nsteps, clock;
|
||||
|
||||
};
|
||||
|
||||
struct snd
|
||||
{
|
||||
int level1, level2, balance;
|
||||
bool gbDigitalSound;
|
||||
int rate;
|
||||
int quality;
|
||||
struct sndchan ch[4];
|
||||
};
|
||||
|
||||
|
|
@ -29,12 +45,8 @@ extern struct snd snd;
|
|||
|
||||
byte sound_read(byte r) ICODE_ATTR;
|
||||
void sound_write(byte r, byte b) ICODE_ATTR;
|
||||
void sound_dirty(void) ICODE_ATTR;
|
||||
void sound_dirty(void);
|
||||
void sound_reset(void);
|
||||
void sound_mix(void) ICODE_ATTR;
|
||||
void s1_init(void);
|
||||
void s2_init(void);
|
||||
void s3_init(void);
|
||||
void s4_init(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue