MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / cdda_play_func2

Function cdda_play_func2

src/blkdev_cdimage.cpp:597–863  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595}
596
597static bool cdda_play_func2 (struct cdunit *cdu, int *outpos)
598{
599 int cdda_pos = cdu->cdda_start;
600 int bufnum;
601 int oldplay;
602 int idleframes = 0;
603 int silentframes = 0;
604 bool foundsub;
605 int oldtrack = -1;
606 bool restart = false;
607 bool first = true;
608
609 cdu->thread_active = true;
610 memset(&cdu->cas, 0, sizeof(struct cd_audio_state));
611
612 while (cdu->cdda_play == 0)
613 sleep_millis(10);
614 oldplay = -1;
615
616 cdu->cda_bufon[0] = 0;
617 cdu->cda_bufon[1] = 0;
618 bufnum = 0;
619
620 cdu->cda = new cda_audio (CDDA_BUFFERS, 2352, 44100);
621
622 while (cdu->cdda_play > 0) {
623
624 if (oldplay != cdu->cdda_play) {
625 struct cdtoc *t;
626 int sector, diff;
627 struct timespec ts1, ts2;
628
629 idleframes = 0;
630 silentframes = 0;
631 foundsub = false;
632 clock_gettime(CLOCK_REALTIME, &ts1);
633 cdda_pos = cdu->cdda_start;
634 oldplay = cdu->cdda_play;
635 sector = cdu->cd_last_pos = cdda_pos;
636 t = findtoc (cdu, &sector, false);
637 if (!t) {
638 sector = cdu->cd_last_pos = cdda_pos + 2 * 75;
639 t = findtoc (cdu, &sector, false);
640 if (!t) {
641 write_log (_T("IMAGE CDDA: illegal sector number %d\n"), cdu->cdda_start);
642 setstate (cdu, AUDIO_STATUS_PLAY_ERROR, -1);
643 } else {
644 audio_unpack (cdu, t);
645 }
646 } else {
647 write_log (_T("IMAGE CDDA: playing from %d to %d, track %d ('%s', offset %lld, secoffset %d (%d))\n"),
648 cdu->cdda_start, cdu->cdda_end, t->track, t->fname, t->offset, sector, t->index1);
649 oldtrack = t->track;
650 audio_unpack (cdu, t);
651 }
652 idleframes = cdu->cdda_delay_frames;
653 while (cdu->cdda_paused && cdu->cdda_play > 0) {
654 sleep_millis(10);

Callers 1

cdda_play_funcFunction · 0.85

Calls 15

sleep_millisFunction · 0.85
findtocFunction · 0.85
setstateFunction · 0.85
audio_unpackFunction · 0.85
getsub_deinterleavedFunction · 0.85
do_readFunction · 0.85
zfile_fseekFunction · 0.85
zfile_freadFunction · 0.85
dosubFunction · 0.85
audio_cda_volumeFunction · 0.85
audio_cda_new_bufferFunction · 0.85

Tested by

no test coverage detected