Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Stream
CFileStream.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_FILESTREAM_H_
26
#define _SKYLICHTAUDIO_FILESTREAM_H_
27
28
#include "stdafx.h"
29
#include "IStream.h"
30
31
namespace
Skylicht
32
{
33
namespace
Audio
34
{
39
class
CFileStreamCursor :
public
IStreamCursor
40
{
41
protected
:
42
FILE *m_file;
43
int
m_size;
44
int
m_pos;
45
46
unsigned
char
* m_buffer;
47
int
m_bufferSize;
48
int
m_bufferAvailableBytes;
49
int
m_bufferPos;
50
int
m_bufferOffset;
51
public
:
52
CFileStreamCursor(FILE *file);
53
virtual
~CFileStreamCursor();
54
55
virtual
int
seek
(
int
pos,
EOrigin
origin);
56
virtual
int
tell
();
57
virtual
int
read
(
unsigned
char
* buff,
int
len);
58
virtual
bool
endOfStream
();
59
virtual
int
size
();
60
virtual
bool
readyReadData
(
int
len);
61
};
62
67
class
CFileStream :
public
IStream
68
{
69
protected
:
70
std::string m_fileName;
71
FILE *m_file;
72
int
m_size;
73
74
public
:
75
CFileStream(
const
char
*fileName);
76
virtual
~CFileStream();
77
82
bool
isError
();
83
88
virtual
IStreamCursor
*
createCursor
();
89
};
90
}
91
}
92
93
#endif
Skylicht::Audio::CFileStreamCursor::size
virtual int size()
Get total size of the stream.
Skylicht::Audio::CFileStreamCursor::read
virtual int read(unsigned char *buff, int len)
Read data from the stream.
Skylicht::Audio::CFileStreamCursor::readyReadData
virtual bool readyReadData(int len)
Check if a certain amount of data is ready to be read.
Skylicht::Audio::CFileStreamCursor::seek
virtual int seek(int pos, EOrigin origin)
Move the cursor position.
Skylicht::Audio::CFileStreamCursor::endOfStream
virtual bool endOfStream()
Check if the cursor is at the end of the stream.
Skylicht::Audio::CFileStreamCursor::tell
virtual int tell()
Get current cursor position.
Skylicht::Audio::CFileStream::isError
bool isError()
Check if the file failed to open.
Skylicht::Audio::CFileStream::createCursor
virtual IStreamCursor * createCursor()
Create a new file cursor.
Skylicht::Audio::IStreamCursor
Interface for a stream cursor, providing seek and read operations on an audio stream.
Definition
IStream.h:39
Skylicht::Audio::IStreamCursor::EOrigin
EOrigin
Origin for seek operations.
Definition
IStream.h:45
Skylicht::Audio
Handles all core audio functionality.
Definition
AudioDebugLog.h:31
Skylicht
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition
AudioDebugLog.h:29
Generated by
1.17.0