World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Media.h
См. документацию.
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 
6 #include "src/tools/MemBuffer.h"
7 
9  public:
11  virtual ~IAudioDataSource() {}
12 
13  virtual bool Open() = 0;
14  virtual void Close() = 0;
15 
16  virtual size_t GetSampleRate() = 0;
17  virtual size_t GetChannelCount() = 0;
18  virtual PMemBuffer GetNextBuffer() = 0;
19 };
20 typedef std::shared_ptr<IAudioDataSource> PAudioDataSource;
21 
24 
25 class IAudioTrack {
26  public:
28  virtual ~IAudioTrack() {}
29 
30  virtual bool Open(PAudioDataSource data_source) = 0;
31  virtual bool IsValid() = 0;
32 
33  virtual bool Play() = 0;
34  virtual bool Stop() = 0;
35  virtual bool Pause() = 0;
36  virtual bool Resume() = 0;
37  virtual bool SetVolume(float volume) = 0;
38  virtual float GetVolume() = 0;
39 };
40 typedef std::shared_ptr<IAudioTrack> PAudioTrack;
41 
42 PAudioTrack CreateAudioTrack(const std::string &file_path);
43 
44 class IAudioSample {
45  public:
47  virtual ~IAudioSample() {}
48 
49  virtual bool Open(PAudioDataSource data_source) = 0;
50  virtual bool IsValid() = 0;
51 
52  virtual bool Play(bool loop = false, bool positioned = false) = 0;
53  virtual bool Stop() = 0;
54  virtual bool SetVolume(float volume) = 0;
55  virtual bool SetPosition(float x, float y, float z, float max_dist) = 0;
56 };
57 typedef std::shared_ptr<IAudioSample> PAudioSample;
58 
60 
62  public:
64  virtual ~IVideoDataSource() {}
65 
66  virtual bool Open() = 0;
67  virtual void Close() = 0;
68 
69  virtual size_t GetFrameRate() = 0;
70  virtual size_t GetWidth() = 0;
71  virtual size_t GetHeight() = 0;
72  virtual PMemBuffer GetNextFrame() = 0;
73 };
74 typedef std::shared_ptr<IAudioDataSource> PAudioDataSource;
75 
76 class IMovie {
77  public:
78  IMovie() {}
79  virtual ~IMovie() {}
80 
81  virtual unsigned int GetWidth() const = 0;
82  virtual unsigned int GetHeight() const = 0;
83 
84  virtual bool Play(bool loop = false) = 0;
85  virtual bool Stop() = 0;
86  virtual bool IsPlaing() const = 0;
87  virtual PMemBuffer GetFrame() = 0;
88 };
89 typedef std::shared_ptr<IMovie> PMovie;
IMovie::Play
virtual bool Play(bool loop=false)=0
IAudioDataSource::IAudioDataSource
IAudioDataSource()
Definition: Media.h:10
IAudioTrack::Resume
virtual bool Resume()=0
IAudioDataSource::GetSampleRate
virtual size_t GetSampleRate()=0
IVideoDataSource::GetWidth
virtual size_t GetWidth()=0
IAudioTrack::IsValid
virtual bool IsValid()=0
IVideoDataSource::~IVideoDataSource
virtual ~IVideoDataSource()
Definition: Media.h:64
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:407
MemBuffer.h
IMovie::GetHeight
virtual unsigned int GetHeight() const =0
IVideoDataSource::IVideoDataSource
IVideoDataSource()
Definition: Media.h:63
IMovie
Definition: Media.h:76
PAudioDataSource
std::shared_ptr< IAudioDataSource > PAudioDataSource
Definition: Media.h:20
CreateAudioBufferDataSource
PAudioDataSource CreateAudioBufferDataSource(PMemBuffer buffer)
Definition: MediaPlayer.cpp:1176
IVideoDataSource::GetFrameRate
virtual size_t GetFrameRate()=0
IAudioSample::IAudioSample
IAudioSample()
Definition: Media.h:46
IAudioDataSource::GetChannelCount
virtual size_t GetChannelCount()=0
IAudioDataSource
Definition: Media.h:8
buffer
EGLContext EGLenum EGLClientBuffer buffer
Definition: SDL_egl.h:952
IAudioTrack::IAudioTrack
IAudioTrack()
Definition: Media.h:27
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
IAudioTrack::SetVolume
virtual bool SetVolume(float volume)=0
IMovie::IsPlaing
virtual bool IsPlaing() const =0
IVideoDataSource::GetHeight
virtual size_t GetHeight()=0
IVideoDataSource::Close
virtual void Close()=0
IAudioTrack::Play
virtual bool Play()=0
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
PAudioTrack
std::shared_ptr< IAudioTrack > PAudioTrack
Definition: Media.h:40
IAudioTrack::GetVolume
virtual float GetVolume()=0
CreateAudioSample
PAudioSample CreateAudioSample(PMemBuffer buffer)
Definition: OpenALSoundProvider.cpp:873
PAudioSample
std::shared_ptr< IAudioSample > PAudioSample
Definition: Media.h:57
IAudioDataSource::Open
virtual bool Open()=0
IAudioSample::SetPosition
virtual bool SetPosition(float x, float y, float z, float max_dist)=0
IMovie::GetFrame
virtual PMemBuffer GetFrame()=0
CreateAudioFileDataSource
PAudioDataSource CreateAudioFileDataSource(const std::string &file_name)
Definition: MediaPlayer.cpp:1169
IVideoDataSource::Open
virtual bool Open()=0
IAudioTrack::~IAudioTrack
virtual ~IAudioTrack()
Definition: Media.h:28
IAudioSample
Definition: Media.h:44
IMovie::GetWidth
virtual unsigned int GetWidth() const =0
IAudioSample::Play
virtual bool Play(bool loop=false, bool positioned=false)=0
IMovie::Stop
virtual bool Stop()=0
IAudioDataSource::~IAudioDataSource
virtual ~IAudioDataSource()
Definition: Media.h:11
IAudioSample::~IAudioSample
virtual ~IAudioSample()
Definition: Media.h:47
IAudioTrack
Definition: Media.h:25
IAudioSample::SetVolume
virtual bool SetVolume(float volume)=0
IAudioDataSource::GetNextBuffer
virtual PMemBuffer GetNextBuffer()=0
IAudioSample::Stop
virtual bool Stop()=0
IMovie::IMovie
IMovie()
Definition: Media.h:78
IVideoDataSource
Definition: Media.h:61
IAudioTrack::Stop
virtual bool Stop()=0
IVideoDataSource::GetNextFrame
virtual PMemBuffer GetNextFrame()=0
IAudioSample::Open
virtual bool Open(PAudioDataSource data_source)=0
PMovie
std::shared_ptr< IMovie > PMovie
Definition: Media.h:89
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:691
IAudioTrack::Pause
virtual bool Pause()=0
IAudioDataSource::Close
virtual void Close()=0
IAudioTrack::Open
virtual bool Open(PAudioDataSource data_source)=0
IAudioSample::IsValid
virtual bool IsValid()=0
PMemBuffer
std::shared_ptr< IMemBuffer > PMemBuffer
Definition: MemBuffer.h:13
CreateAudioTrack
PAudioTrack CreateAudioTrack(const std::string &file_path)
Definition: OpenALSoundProvider.cpp:657
IMovie::~IMovie
virtual ~IMovie()
Definition: Media.h:79