(MESS) PlayStation: fix sample signedness and stream rate for CDDA (redbook) audio [R. Belmont]

This commit is contained in:
R. Belmont 2013-01-19 20:41:56 +00:00
parent 4495e84e86
commit 9b3e3b51c3
2 changed files with 15 additions and 28 deletions

View File

@ -2538,7 +2538,7 @@ void spu_device::generate_cdda(void *ptr, const unsigned int sz)
if (! cdda_buffer->get_bytes_in())
cdda_playing=false;
if (n>0) printf("cdda buffer underflow (n=%d cdda_in=%d spf=%d)\n",n,cdda_buffer->get_bytes_in(),cdda_spf);
// if (n>0) printf("cdda buffer underflow (n=%d cdda_in=%d spf=%d)\n",n,cdda_buffer->get_bytes_in(),cdda_spf);
}
}
@ -3063,6 +3063,15 @@ bool spu_device::play_cdda(const unsigned int sector, const unsigned char *cdda)
signed short *dp=(signed short *)cdda_buffer->add_sector(sector);
memcpy(dp,cdda,cdda_sector_size);
// data coming in in MAME is big endian as stored on the CD
unsigned char *flip = (unsigned char *)dp;
for (int i = 0; i < cdda_sector_size; i+= 2)
{
unsigned char temp = flip[i];
flip[i] = flip[i+1];
flip[i+1] = temp;
}
return true;
}

View File

@ -1251,31 +1251,9 @@ void psxcd_device::read_sector()
//
//
bool psxcd_device::play_cdda_sector(const unsigned int sector,
unsigned char *rawsec)
bool psxcd_device::play_cdda_sector(const unsigned int sector, unsigned char *rawsec)
{
bool isdata=true;
if (rawsec[0]!=0)
{
isdata=false;
} else
{
for (int i=0; i<10; i++)
if (rawsec[i+1]!=0xff)
{
isdata=false;
break;
}
}
if (! isdata)
{
return machine().device<spu_device>("spu")->play_cdda(sector,rawsec);
} else
{
return true;
}
return machine().device<spu_device>("spu")->play_cdda(sector,rawsec);
}
//
@ -1385,7 +1363,7 @@ void psxcd_device::play_sector()
ev->t=next_sector_t - machine().device<cpu_device>("maincpu")->total_cycles();
ev->type=event_play_sector;
next_sector_t+=cyc;
next_sector_t+=cyc>>1;
next_read_event=ev;
add_system_event(ev);
@ -1523,7 +1501,7 @@ void psxcd_device::start_play()
ev->t=next_sector_t - machine().device<cpu_device>("maincpu")->total_cycles();
ev->type=event_play_sector;
next_sector_t+=cyc;
next_sector_t+=cyc>>1;
next_read_event=ev;
add_system_event(ev);
@ -1678,7 +1656,7 @@ void psxcd_device::add_system_event(event *ev)
// ev->t is in maincpu clock cycles
UINT32 hz = m_sysclock / ev->t;
// printf("add_system_event: event type %d for %d hz (using timer %d)\n", ev->type, hz, tnum);
// printf("add_system_event: event type %d for %d hz (using timer %d)\n", ev->type, hz, tnum);
timer->adjust(attotime::from_hz(hz), tnum, attotime::never);
// back-reference the timer from the event