3 * Copyright (C) 2010-2013 Team XBMC
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)
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.
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/>.
22 #include "Interfaces/AESink.h"
23 #include "Utils/AEDeviceInfo.h"
24 #include "threads/CriticalSection.h"
32 class CAESinkAUDIOTRACK : public IAESink
35 virtual const char *GetName() { return "AUDIOTRACK"; }
38 virtual ~CAESinkAUDIOTRACK();
40 virtual bool Initialize(AEAudioFormat &format, std::string &device);
41 virtual void Deinitialize();
43 virtual double GetDelay ();
44 virtual double GetCacheTotal ();
45 virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false);
46 virtual void Drain ();
47 virtual bool HasVolume ();
48 virtual void SetVolume (float scale);
49 static void EnumerateDevicesEx(AEDeviceInfoList &list, bool force = false);
52 jni::CJNIAudioTrack *m_at_jni;
53 // m_frames_written must wrap at UINT32_MAX
54 uint32_t m_frames_written;
56 static CAEDeviceInfo m_info;
57 AEAudioFormat m_format;
58 AEAudioFormat m_lastFormat;
60 volatile int m_min_frames;
61 int16_t *m_alignedS16;
62 unsigned int m_sink_frameSize;
64 double m_audiotrackbuffer_sec;