Previous 199869 Revisions Next

r20354 Saturday 19th January, 2013 at 20:41:56 UTC by R. Belmont
(MESS) PlayStation: fix sample signedness and stream rate for CDDA (redbook) audio [R. Belmont]
[src/emu/sound]spu.c
[src/mess/machine]psxcd.c

trunk/src/emu/sound/spu.c
r20353r20354
25382538      if (! cdda_buffer->get_bytes_in())
25392539         cdda_playing=false;
25402540
2541      if (n>0) printf("cdda buffer underflow (n=%d cdda_in=%d spf=%d)\n",n,cdda_buffer->get_bytes_in(),cdda_spf);
2541//      if (n>0) printf("cdda buffer underflow (n=%d cdda_in=%d spf=%d)\n",n,cdda_buffer->get_bytes_in(),cdda_spf);
25422542   }
25432543}
25442544
r20353r20354
30633063   signed short *dp=(signed short *)cdda_buffer->add_sector(sector);
30643064   memcpy(dp,cdda,cdda_sector_size);
30653065
3066   // data coming in in MAME is big endian as stored on the CD
3067   unsigned char *flip = (unsigned char *)dp;
3068   for (int i = 0; i < cdda_sector_size; i+= 2)
3069   {
3070      unsigned char temp = flip[i];
3071      flip[i] = flip[i+1];
3072      flip[i+1] = temp;
3073   }
3074
30663075   return true;
30673076}
30683077
trunk/src/mess/machine/psxcd.c
r20353r20354
12511251//
12521252//
12531253
1254bool psxcd_device::play_cdda_sector(const unsigned int sector,
1255                                                   unsigned char *rawsec)
1254bool psxcd_device::play_cdda_sector(const unsigned int sector, unsigned char *rawsec)
12561255{
1257   bool isdata=true;
1258
1259   if (rawsec[0]!=0)
1260   {
1261      isdata=false;
1262   } else
1263   {
1264      for (int i=0; i<10; i++)
1265         if (rawsec[i+1]!=0xff)
1266         {
1267            isdata=false;
1268            break;
1269         }
1270   }
1271
1272   if (! isdata)
1273   {
1274      return machine().device<spu_device>("spu")->play_cdda(sector,rawsec);
1275   } else
1276   {
1277      return true;
1278   }
1256   return machine().device<spu_device>("spu")->play_cdda(sector,rawsec);
12791257}
12801258
12811259//
r20353r20354
13851363      ev->t=next_sector_t - machine().device<cpu_device>("maincpu")->total_cycles();
13861364      ev->type=event_play_sector;
13871365
1388      next_sector_t+=cyc;
1366      next_sector_t+=cyc>>1;
13891367
13901368      next_read_event=ev;
13911369      add_system_event(ev);
r20353r20354
15231501   ev->t=next_sector_t - machine().device<cpu_device>("maincpu")->total_cycles();
15241502   ev->type=event_play_sector;
15251503
1526   next_sector_t+=cyc;
1504   next_sector_t+=cyc>>1;
15271505
15281506   next_read_event=ev;
15291507   add_system_event(ev);
r20353r20354
16781656
16791657   // ev->t is in maincpu clock cycles
16801658   UINT32 hz = m_sysclock / ev->t;
1681//  printf("add_system_event: event type %d for %d hz (using timer %d)\n", ev->type, hz, tnum);
1659//   printf("add_system_event: event type %d for %d hz (using timer %d)\n", ev->type, hz, tnum);
16821660   timer->adjust(attotime::from_hz(hz), tnum, attotime::never);
16831661
16841662   // back-reference the timer from the event

Previous 199869 Revisions Next


© 1997-2024 The MAME Team