Etterna
0.74.4
Loading...
Searching...
No Matches
src
RageUtil
Sound
RageSoundReader_Preload.h
1
/* RageSoundReader_Preload - Preload sounds from another reader into memory. */
2
3
#ifndef RAGE_SOUND_READER_PRELOAD
4
#define RAGE_SOUND_READER_PRELOAD
5
6
#include "RageSoundReader.h"
7
8
class
RageSoundReader_Preload
:
public
RageSoundReader
9
{
10
public
:
11
RageSoundReader_Preload
();
12
/* Return true if the sound has been preloaded, in which case source will
13
* be deleted. Otherwise, return false. */
14
bool
Open(
RageSoundReader
* pSource);
15
int
GetLength()
const override
;
16
int
GetLength_Fast()
const override
;
17
int
SetPosition(
int
iFrame)
override
;
18
int
Read(
float
* pBuffer,
int
iLength)
override
;
19
int
GetSampleRate()
const override
{
return
m_iSampleRate; }
20
unsigned
GetNumChannels()
const override
{
return
m_iChannels; }
21
int
GetNextSourceFrame()
const override
;
22
float
GetStreamToSourceRatio()
const override
{
return
m_fRate; }
23
std::string GetError()
const override
{
return
""
; }
24
25
/* Return the total number of copies of this sound. (If 1 is returned,
26
* this is the last copy.) */
27
int
GetReferenceCount()
const
;
28
29
RageSoundReader_Preload
* Copy()
const override
;
30
~RageSoundReader_Preload
()
override
=
default
;
31
32
/* Attempt to preload a sound. pSound must be rewound. */
33
static
bool
PreloadSound(
RageSoundReader
*& pSound);
34
35
private
:
36
std::shared_ptr<std::string> m_Buffer;
37
bool
m_bBufferIs16Bit{
false
};
38
39
/* Bytes: */
40
int
m_iPosition{ 0 };
41
42
int
GetTotalFrames()
const
;
43
44
int
m_iSampleRate{ 0 };
45
unsigned
m_iChannels{ 0 };
46
float
m_fRate{ 0.0f };
47
};
48
49
#endif
RageSoundReader_Preload
Definition
RageSoundReader_Preload.h:9
RageSoundReader
Definition
RageSoundReader.h:7
Generated by
1.9.8