Permalink
Browse files

AESinkPULSE: Let Engine handle our volume

  • Loading branch information...
1 parent b50a14d commit 566e0efb7617bcf78063b6a3ad9ccc4005f39a70 @fritsch fritsch committed Feb 22, 2014
Showing with 1 addition and 27 deletions.
  1. +1 −23 xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp
  2. +0 −4 xbmc/cores/AudioEngine/Sinks/AESinkPULSE.h
@@ -483,8 +483,6 @@ bool CAESinkPULSE::Initialize(AEAudioFormat &format, std::string &device)
}
m_Channels = format.m_channelLayout.Count();
- pa_cvolume_reset(&m_Volume, m_Channels);
-
pa_format_info *info[1];
info[0] = pa_format_info_new();
info[0]->encoding = AEFormatToPulseEncoding(format.m_dataFormat);
@@ -594,7 +592,7 @@ bool CAESinkPULSE::Initialize(AEAudioFormat &format, std::string &device)
buffer_attr.fragsize = (uint32_t) latency;
}
- if (pa_stream_connect_playback(m_Stream, isDefaultDevice ? NULL : device.c_str(), sinkStruct.isHWDevice ? &buffer_attr : NULL, ((pa_stream_flags)(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_ADJUST_LATENCY)), m_passthrough ? NULL : &m_Volume, NULL) < 0)
+ if (pa_stream_connect_playback(m_Stream, isDefaultDevice ? NULL : device.c_str(), sinkStruct.isHWDevice ? &buffer_attr : NULL, ((pa_stream_flags)(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_ADJUST_LATENCY)), NULL, NULL) < 0)
{
CLog::Log(LOGERROR, "PulseAudio: Failed to connect stream to output");
pa_threaded_mainloop_unlock(m_MainLoop);
@@ -752,26 +750,6 @@ void CAESinkPULSE::Drain()
pa_threaded_mainloop_unlock(m_MainLoop);
}
-void CAESinkPULSE::SetVolume(float volume)
-{
- if (m_IsAllocated && !m_passthrough)
- {
- pa_threaded_mainloop_lock(m_MainLoop);
- pa_volume_t pavolume = pa_sw_volume_from_linear(volume);
- if ( pavolume <= 0 )
- pa_cvolume_mute(&m_Volume, m_Channels);
- else
- pa_cvolume_set(&m_Volume, m_Channels, pavolume);
- pa_operation *op = pa_context_set_sink_input_volume(m_Context, pa_stream_get_index(m_Stream), &m_Volume, NULL, NULL);
- if (op == NULL)
- CLog::Log(LOGERROR, "PulseAudio: Failed to set volume");
- else
- pa_operation_unref(op);
-
- pa_threaded_mainloop_unlock(m_MainLoop);
- }
-}
-
void CAESinkPULSE::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
pa_context *context;
@@ -44,9 +44,6 @@ class CAESinkPULSE : public IAESink
virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false);
virtual void Drain ();
- virtual bool HasVolume() { return true; };
- virtual void SetVolume(float volume);
-
static void EnumerateDevicesEx(AEDeviceInfoList &list, bool force = false);
bool IsInitialized();
CCriticalSection m_sec;
@@ -64,7 +61,6 @@ class CAESinkPULSE : public IAESink
unsigned int m_Channels;
pa_stream *m_Stream;
- pa_cvolume m_Volume;
pa_context *m_Context;
pa_threaded_mainloop *m_MainLoop;

0 comments on commit 566e0ef

Please sign in to comment.