Otclient
14/8/2020
streamsoundsource.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a copy
5
* of this software and associated documentation files (the "Software"), to deal
6
* in the Software without restriction, including without limitation the rights
7
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
* copies of the Software, and to permit persons to whom the Software is
9
* furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice shall be included in
12
* all copies or substantial portions of the Software.
13
*
14
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
* THE SOFTWARE.
21
*/
22
23
#ifndef STREAMSOUNDSOURCE_H
24
#define STREAMSOUNDSOURCE_H
25
26
#include "
soundsource.h
"
27
28
class
StreamSoundSource
:
public
SoundSource
29
{
30
enum
{
31
STREAM_BUFFER_SIZE = 1024 * 400,
32
STREAM_FRAGMENTS = 4,
33
STREAM_FRAGMENT_SIZE = STREAM_BUFFER_SIZE / STREAM_FRAGMENTS
34
};
35
36
public
:
37
enum
DownMix
{
NoDownMix
,
DownMixLeft
,
DownMixRight
};
38
39
StreamSoundSource
();
40
virtual
~StreamSoundSource
();
41
42
void
play
();
43
void
stop
();
44
45
bool
isPlaying
() {
return
m_playing; }
46
47
void
setSoundFile
(
const
SoundFilePtr
& soundFile);
48
49
void
downMix
(
DownMix
downMix
);
50
51
void
update
();
52
53
private
:
54
void
queueBuffers();
55
void
unqueueBuffers();
56
bool
fillBufferAndQueue(
uint
buffer);
57
58
SoundFilePtr
m_soundFile;
59
std::array<SoundBufferPtr,STREAM_FRAGMENTS> m_buffers;
60
DownMix
m_downMix;
61
stdext::boolean<false>
m_looping;
62
stdext::boolean<false>
m_playing;
63
stdext::boolean<false>
m_eof;
64
stdext::boolean<false>
m_waitingFile;
65
};
66
67
#endif
SoundSource
Definition:
soundsource.h:30
stdext::boolean< false >
StreamSoundSource::play
void play()
Definition:
streamsoundsource.cpp:51
StreamSoundSource::setSoundFile
void setSoundFile(const SoundFilePtr &soundFile)
Definition:
streamsoundsource.cpp:42
StreamSoundSource::stop
void stop()
Definition:
streamsoundsource.cpp:70
StreamSoundSource::NoDownMix
@ NoDownMix
Definition:
streamsoundsource.h:37
uint
unsigned int uint
Definition:
types.h:31
StreamSoundSource::DownMixLeft
@ DownMixLeft
Definition:
streamsoundsource.h:37
StreamSoundSource::update
void update()
Definition:
streamsoundsource.cpp:101
StreamSoundSource::DownMix
DownMix
Definition:
streamsoundsource.h:37
StreamSoundSource::downMix
void downMix(DownMix downMix)
Definition:
streamsoundsource.cpp:186
StreamSoundSource::isPlaying
bool isPlaying()
Definition:
streamsoundsource.h:45
StreamSoundSource::~StreamSoundSource
virtual ~StreamSoundSource()
Definition:
streamsoundsource.cpp:37
StreamSoundSource
Definition:
streamsoundsource.h:28
stdext::shared_object_ptr< SoundFile >
StreamSoundSource::DownMixRight
@ DownMixRight
Definition:
streamsoundsource.h:37
soundsource.h
StreamSoundSource::StreamSoundSource
StreamSoundSource()
Definition:
streamsoundsource.cpp:30
src
framework
sound
streamsoundsource.h
Generated by
1.8.17
For more information visit
https://forum.opentibia.dev/