Etterna 0.74.4
Loading...
Searching...
No Matches
RageSoundReader.h
1/* RageSoundReader - Data source for a RageSound. */
2
3#ifndef RAGE_SOUND_READER_H
4#define RAGE_SOUND_READER_H
5
7{
8 public:
9 virtual int GetLength() const = 0; /* ms */
10 virtual int GetLength_Fast() const { return GetLength(); } /* ms */
11 virtual int SetPosition(int iFrame) = 0;
12 virtual int Read(float* pBuf, int iFrames) = 0;
13 virtual ~RageSoundReader() = default;
14 virtual RageSoundReader* Copy() const = 0;
15 virtual int GetSampleRate() const = 0;
16 virtual unsigned GetNumChannels() const = 0;
17 virtual bool SetProperty(const std::string& sProperty, float fValue)
18 {
19 return false;
20 }
21 virtual RageSoundReader* GetSource() { return NULL; }
22
23 enum
24 {
25
26 RSRERROR = -1,
27 END_OF_FILE = -2,
28
29 /* A nonblocking buffer in the filter chain has underrun, and no data is
30 * currently available. */
31 WOULD_BLOCK = -3,
32
33 /* The source position has changed in an expected way, such as looping.
34 * Seeking manually will not cause this. */
35 STREAM_LOOPED = -4,
36 };
37
38 /* GetNextSourceFrame() provides the source frame associated with the next
39 * frame that will be read via Read(). GetStreamToSourceRatio() returns the
40 * ratio for extrapolating the source frames of the remainder of the block.
41 * These values are valid so long as no parameters are changed before the
42 * next Read(). */
43 virtual int GetNextSourceFrame() const = 0;
44 virtual float GetStreamToSourceRatio() const = 0;
45
46 virtual std::string GetError() const = 0;
47 int RetriedRead(float* pBuffer,
48 int iFrames,
49 int* iSourceFrame = NULL,
50 float* fRate = NULL);
51};
52
53#endif
Definition RageSoundReader.h:7