[release] version bump to 13.0 beta1
[vuplus_xbmc] / xbmc / cores / AudioEngine / Engines / ActiveAE / ActiveAESound.h
1 #pragma once
2 /*
3  *      Copyright (C) 2010-2013 Team XBMC
4  *      http://xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include "utils/StdString.h"
23 #include "Interfaces/AESound.h"
24 #include "ActiveAEResample.h"
25 #include "filesystem/File.h"
26
27 class DllAvUtil;
28
29 namespace ActiveAE
30 {
31
32 class CActiveAESound : public IAESound
33 {
34 public:
35   CActiveAESound (const std::string &filename);
36   virtual ~CActiveAESound();
37
38   virtual void Play();
39   virtual void Stop();
40   virtual bool IsPlaying();
41
42   virtual void SetVolume(float volume) { m_volume = std::max(0.0f, std::min(1.0f, volume)); }
43   virtual float GetVolume() { return m_volume; }
44
45   uint8_t** InitSound(bool orig, SampleConfig config, int nb_samples);
46   bool StoreSound(bool orig, uint8_t **buffer, int samples, int linesize);
47   CSoundPacket *GetSound(bool orig);
48
49   bool IsConverted() { return m_isConverted; }
50   void SetConverted(bool state) { m_isConverted = state; }
51
52   bool Prepare();
53   void Finish();
54   int GetChunkSize();
55   int GetFileSize() { return m_fileSize; }
56   bool IsSeekPosible() { return m_isSeekPosible; }
57
58   static int Read(void *h, uint8_t* buf, int size);
59   static offset_t Seek(void *h, offset_t pos, int whence);
60
61 protected:
62   std::string m_filename;
63   XFILE::CFile *m_pFile;
64   bool m_isSeekPosible;
65   int m_fileSize;
66   float m_volume;
67
68   CSoundPacket *m_orig_sound;
69   CSoundPacket *m_dst_sound;
70
71   bool m_isConverted;
72 };
73 }