Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/psx/mednadisc/cdrom/CDAFReader.h
2 views
1
#ifndef __MDFN_CDAFREADER_H
2
#define __MDFN_CDAFREADER_H
3
4
#include "Stream.h"
5
6
class CDAFReader
7
{
8
public:
9
CDAFReader();
10
virtual ~CDAFReader();
11
12
virtual uint64 FrameCount(void) = 0;
13
INLINE uint64 Read(uint64 frame_offset, int16 *buffer, uint64 frames)
14
{
15
uint64 ret;
16
17
if(LastReadPos != frame_offset)
18
{
19
//puts("SEEK");
20
if(!Seek_(frame_offset))
21
return(0);
22
LastReadPos = frame_offset;
23
}
24
25
ret = Read_(buffer, frames);
26
LastReadPos += ret;
27
return(ret);
28
}
29
30
private:
31
virtual uint64 Read_(int16 *buffer, uint64 frames) = 0;
32
virtual bool Seek_(uint64 frame_offset) = 0;
33
34
uint64 LastReadPos;
35
};
36
37
// AR_Open(), and CDAFReader, will NOT take "ownership" of the Stream object(IE it won't ever delete it). Though it does assume it has exclusive access
38
// to it for as long as the CDAFReader object exists.
39
CDAFReader *CDAFR_Open(Stream *fp);
40
41
#endif
42
43