Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Engine
CAudioReader.h
1
/*
2
!@
3
MIT License
4
5
Copyright (c) 2012 - 2019 Skylicht Technology CO., LTD
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10
subject to the following conditions:
11
12
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20
This file is part of the "Skylicht Engine".
21
https://github.com/skylicht-lab/skylicht-engine
22
!#
23
*/
24
25
#ifndef _SKYLICHTAUDIO_AUDIOEREADER_
26
#define _SKYLICHTAUDIO_AUDIOEREADER_
27
28
#include "Driver/ISoundSource.h"
29
#include "Driver/ISoundDriver.h"
30
#include "Decoder/IAudioDecoder.h"
31
#include "Thread/IMutex.h"
32
33
using namespace
Skylicht::System
;
34
35
namespace
Skylicht
36
{
37
namespace
Audio
38
{
45
class
CAudioReader
46
{
47
protected
:
48
bool
m_isError;
49
int
m_initState;
50
51
IAudioDecoder
* m_decoder;
52
ISoundDriver
* m_driver;
53
54
IMutex
* m_mutex;
55
IStream
* m_stream;
56
57
ISoundSource::ESourceState m_state;
58
IAudioDecoder::EDecoderType m_decodeType;
59
60
public
:
61
CAudioReader(
IStream
* stream, IAudioDecoder::EDecoderType type,
ISoundDriver
* driver);
62
63
CAudioReader(
const
char
* file,
ISoundDriver
* driver);
64
65
virtual
~CAudioReader();
66
70
void
initReader
();
71
76
EStatus
initDecoder
();
77
84
EStatus
readAudio
(
unsigned
char
* data,
int
size);
85
90
IAudioDecoder::EDecoderType
getDecoderType
()
91
{
92
return
m_decodeType;
93
}
94
99
IAudioDecoder
*
getDecoder
()
100
{
101
return
m_decoder;
102
}
103
108
IStream
*
getStream
()
109
{
110
return
m_stream;
111
}
112
117
ISoundSource::ESourceState
getState
()
118
{
119
return
m_state;
120
}
121
};
122
}
123
}
124
125
#endif
Skylicht::Audio::CAudioReader::initReader
void initReader()
Initialize the reader and create the appropriate decoder.
Skylicht::Audio::CAudioReader::getState
ISoundSource::ESourceState getState()
Get the current state of the reader.
Definition
CAudioReader.h:117
Skylicht::Audio::CAudioReader::readAudio
EStatus readAudio(unsigned char *data, int size)
Read and decode audio data into a buffer as raw PCM samples.
Skylicht::Audio::CAudioReader::getDecoderType
IAudioDecoder::EDecoderType getDecoderType()
Get the decoder type.
Definition
CAudioReader.h:90
Skylicht::Audio::CAudioReader::getDecoder
IAudioDecoder * getDecoder()
Get the underlying decoder.
Definition
CAudioReader.h:99
Skylicht::Audio::CAudioReader::getStream
IStream * getStream()
Get the underlying stream.
Definition
CAudioReader.h:108
Skylicht::Audio::CAudioReader::initDecoder
EStatus initDecoder()
Initialize the decoder.
Skylicht::Audio::IAudioDecoder
Definition
IAudioDecoder.h:46
Skylicht::Audio::ISoundDriver
Definition
ISoundDriver.h:36
Skylicht::Audio::IStream
Interface for an audio data stream (File, Memory, etc.).
Definition
IStream.h:107
Skylicht::System::IMutex
Definition
IMutex.h:34
Skylicht::Audio
Handles all core audio functionality.
Definition
AudioDebugLog.h:31
Skylicht::System
The foundation for thread and process handling.
Definition
CNullMutex.h:32
Skylicht
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition
AudioDebugLog.h:29
Generated by
1.17.0