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