Permalink
Browse files

[AE][GUI] Add Audio category to System Information GUI window and pop…

…ulate with current AudioEngine audio device capabilities enumeration results.
  • Loading branch information...
1 parent 8913d21 commit 9b5ede774f9d9313b241d8defd4271f3157d82a9 @DDDamian committed Jun 4, 2012
@@ -132,6 +132,21 @@
<label>13280</label>
</control>
<control type="button" id="98">
+ <description>Button Audio</description>
+ <height>60</height>
+ <width>241</width>
+ <textoffsetx>0</textoffsetx>
+ <align>right</align>
+ <aligny>center</aligny>
+ <font>font13_title</font>
+ <textcolor>grey2</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <texturefocus border="5">MenuItemFO.png</texturefocus>
+ <texturenofocus border="5">MenuItemNF.png</texturenofocus>
+ <pulseonselect>false</pulseonselect>
+ <label>292</label>
+ </control>
+ <control type="button" id="99">
<description>Button Hardware</description>
<height>60</height>
<width>241</width>
View
@@ -76,6 +76,7 @@
#include "interfaces/info/InfoBool.h"
#include "TextureCache.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
+#include "cores/AudioEngine/AEFactory.h"
#define SYSHEATUPDATEINTERVAL 60000
@@ -1681,6 +1682,11 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
return strLabel;
}
+AEDeviceReport* CGUIInfoManager::GetAudioDeviceReport()
+{
+ return CAEFactory::AE->GetDeviceReport();
+}
+
// tries to get a integer value for use in progressbars/sliders and such
bool CGUIInfoManager::GetInt(int &value, int info, int contextWindow, const CGUIListItem *item /* = NULL */) const
{
View
@@ -656,6 +656,9 @@ class CGUIInfoManager : public IMsgTargetCallback
CStdString GetVersion();
CStdString GetBuild();
+ /* Retrieve AudioEngine current audio device report */
+ AEDeviceReport* GetAudioDeviceReport();
+
bool GetDisplayAfterSeek();
void SetDisplayAfterSeek(unsigned int timeOut = 2500, int seekOffset = 0);
void SetSeeking(bool seeking) { m_playerSeeking = seeking; };
@@ -22,6 +22,7 @@
#include "Interfaces/AE.h"
#include "threads/Thread.h"
+#include <string.h>
enum AEEngine
{
@@ -38,6 +39,9 @@ class CAEFactory
static IAE *AE;
static bool LoadEngine();
static bool StartEngine();
+
+ virtual std::string DeviceReport() {return this->DeviceReport();};
+
private:
static bool LoadEngine(enum AEEngine engine);
};
@@ -331,6 +331,9 @@ void CSoftAE::InternalOpenSink()
((std::string)newFormat.m_channelLayout).c_str(),
newFormat.m_sampleRate);
+ /* create device report for SystemInfo GUI window */
+ GenerateDeviceReport();
+
reInit = (reInit || m_chLayout != m_sinkFormat.m_channelLayout);
m_chLayout = m_sinkFormat.m_channelLayout;
@@ -481,6 +484,9 @@ void CSoftAE::OnSettingsChange(std::string setting)
OpenSink();
}
+ if (setting == "audiooutput.passthroughdevice" || "audiooutput.audiodevice")
@Memphiz

Memphiz Jun 4, 2012

is allways true - is there a compare operator missing?

@DDDamian

DDDamian Jun 4, 2012

Owner

True if either of these devices changed since last check - forces report info refresh.

+ GenerateDeviceReport();
+
if (setting == "audiooutput.dontnormalizelevels" || setting == "audiooutput.stereoupmix")
{
/* re-init stream reamppers */
@@ -1185,6 +1191,84 @@ unsigned int CSoftAE::RunStreamStage(unsigned int channelCount, void *out, bool
return mixed;
}
+AEDeviceReport* CSoftAE::GetDeviceReport()
+{
+ return &m_DeviceReport;
+}
+
+void CSoftAE::GenerateDeviceReport()
+{
+ if (!m_sink)
+ return;
+
+ CAESinkFactory::EnumerateEx(m_sinkInfoList);
+ for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt)
+ {
+ for (AEDeviceInfoList::iterator itt2 = itt->m_deviceInfoList.begin(); itt2 != itt->m_deviceInfoList.end(); ++itt2)
+ {
+ std::string strTmpDevice = itt->m_sinkName + ":" + itt2->m_deviceName;
+ if (itt->m_sinkName + ":" + itt2->m_deviceName == m_passthroughDevice)
+ {
+ m_DeviceReport.m_drDevice = itt2->m_displayName;
+ m_DeviceReport.m_drDevType = itt2->DeviceTypeToString(itt2->m_deviceType);
+ switch ((AEDeviceType)itt2->m_deviceType)
+ {
+ case AE_DEVTYPE_PCM:
+ m_DeviceReport.m_drDevType = "Audio Path: " + itt->m_sinkName + " to Analog";
+ break;
+ case AE_DEVTYPE_IEC958:
+ m_DeviceReport.m_drDevType = "Audio Path: " + itt->m_sinkName + " to SPDIF Optical or CoAxial";
+ break;
+ case AE_DEVTYPE_HDMI:
+ m_DeviceReport.m_drDevType = "Audio Path: " + itt->m_sinkName + " to HDMI";
+ break;
+ case AE_DEVTYPE_DP:
+ m_DeviceReport.m_drDevType = "Audio Path: " + itt->m_sinkName + " to Other";
+ break;
+ default:
+ m_DeviceReport.m_drDevType = "Audio Path: " + itt->m_sinkName + " to Unknown";
+ }
+ m_DeviceReport.m_drChannels = "Channels: " + (std::string)itt2->m_channels;
+ std::stringstream ss;
+ for (AESampleRateList::iterator itt3 = itt2->m_sampleRates.begin(); itt3 != itt2->m_sampleRates.end(); ++itt3)
+ {
+ if (itt3 != itt2->m_sampleRates.begin())
+ ss << ',';
+ ss << *itt3;
+ }
+ m_DeviceReport.m_drSampleRates = "Sample Rates: " + (std::string)ss.str();
+ for (AEDataFormatList::iterator itt3 = itt2->m_dataFormats.begin(); itt3 != itt2->m_dataFormats.end(); ++itt3)
+ {
+ switch (*itt3)
+ {
+ case AE_FMT_AC3:
+ m_DeviceReport.m_drAC3ok = "Dolby Digital OK";
+ break;
+ case AE_FMT_DTS:
+ m_DeviceReport.m_drDTSok = "DTS OK";
+ break;
+ case AE_FMT_AAC:
+ m_DeviceReport.m_drAACok = "AAC OK";
+ break;
+ case AE_FMT_TRUEHD:
+ m_DeviceReport.m_drTRUEHDok = "TrueHD OK";
+ break;
+ case AE_FMT_DTSHD:
+ m_DeviceReport.m_drDTSHDok = "DTS-HD OK";
+ break;
+ case AE_FMT_LPCM:
+ m_DeviceReport.m_drLPCMok = "MultiChannel LPCM OK";
+ break;
+ }
+ }
+ return;
+ }
+ }
+ }
+ m_DeviceReport.m_drDevice = "No audio passthrough device selected";
+ return;
+}
@jmarshallnz

jmarshallnz Jun 4, 2012

This all needs to be localisable?

+
inline void CSoftAE::ResumeSlaveStreams(const StreamList &streams)
{
if (streams.empty())
@@ -110,6 +110,11 @@ class CSoftAE : public IThreadedAE
void PauseStream (CSoftAEStream *stream);
void ResumeStream(CSoftAEStream *stream);
+ AEDeviceReport m_DeviceReport;
+
+ /* provide device report for SystemInfo */
+ AEDeviceReport* GetDeviceReport();
+
private:
CThread *m_thread;
@@ -124,6 +129,8 @@ class CSoftAE : public IThreadedAE
bool SetupEncoder(AEAudioFormat &format);
void Deinitialize();
+ void GenerateDeviceReport();
+
IAESink *GetSink(AEAudioFormat &desiredFormat, bool passthrough, std::string &device);
void StopAllSounds();
@@ -33,6 +33,20 @@
typedef std::pair<std::string, std::string> AEDevice;
typedef std::vector<AEDevice> AEDeviceList;
+typedef struct
+{
+ std::string m_drDevice;
+ std::string m_drDevType;
+ std::string m_drChannels;
+ std::string m_drSampleRates;
+ std::string m_drAC3ok;
+ std::string m_drDTSok;
+ std::string m_drAACok;
+ std::string m_drLPCMok;
+ std::string m_drTRUEHDok;
+ std::string m_drDTSHDok;
@jmarshallnz

jmarshallnz Jun 4, 2012

an array of bools?

@DDDamian

DDDamian Jun 4, 2012

Owner

Will convert to bools for efficiency.

+} AEDeviceReport;
+
/* forward declarations */
class IAEStream;
class IAESound;
@@ -158,5 +172,7 @@ class IAE
* @returns true if the AudioEngine is capable of RAW output
*/
virtual bool SupportsRaw() { return false; }
+
+ virtual AEDeviceReport* GetDeviceReport() { return NULL; }
};
@@ -34,7 +34,8 @@
#define CONTROL_BT_DEFAULT 95
#define CONTROL_BT_NETWORK 96
#define CONTROL_BT_VIDEO 97
-#define CONTROL_BT_HARDWARE 98
+#define CONTROL_BT_AUDIO 98
+#define CONTROL_BT_HARDWARE 99
#define CONTROL_START CONTROL_BT_STORAGE
#define CONTROL_END CONTROL_BT_HARDWARE
@@ -138,6 +139,26 @@ void CGUIWindowSystemInfo::FrameMove()
#endif
SetControlLabel(i++, "%s %s", 22010, SYSTEM_GPU_TEMPERATURE);
}
+ else if (m_section == CONTROL_BT_AUDIO)
+ {
+ AEDeviceReport* pDeviceReport = g_infoManager.GetAudioDeviceReport();
@jmarshallnz

jmarshallnz Jun 4, 2012

Why not direct from AE rather than via the infomanager?

@DDDamian

DDDamian Jun 4, 2012

Owner

More just to follow the centralized depository created by the info manager - certainly reduces redirects to pull straight from AE.

+ SET_CONTROL_LABEL(i++, (CStdString)pDeviceReport->m_drDevice);
+ SET_CONTROL_LABEL(i++, (CStdString)pDeviceReport->m_drDevType);
+ SET_CONTROL_LABEL(i++, (CStdString)pDeviceReport->m_drChannels);
+ SET_CONTROL_LABEL(i++, (CStdString)pDeviceReport->m_drSampleRates);
+ if ((CStdString)pDeviceReport->m_drAC3ok != "")
+ SET_CONTROL_LABEL(i++, (CStdString)pDeviceReport->m_drAC3ok);
+ if ((CStdString)pDeviceReport->m_drDTSok != "")
+ SET_CONTROL_LABEL(i++, (CStdString)pDeviceReport->m_drDTSok);
+ if ((CStdString)pDeviceReport->m_drAACok != "")
+ SET_CONTROL_LABEL(i++, (CStdString)pDeviceReport->m_drAACok);
+ if ((CStdString)pDeviceReport->m_drTRUEHDok != "")
+ SET_CONTROL_LABEL(i++, (CStdString)pDeviceReport->m_drTRUEHDok);
+ if ((CStdString)pDeviceReport->m_drDTSHDok != "")
+ SET_CONTROL_LABEL(i++, (CStdString)pDeviceReport->m_drDTSHDok);
+ if ((CStdString)pDeviceReport->m_drLPCMok != "")
+ SET_CONTROL_LABEL(i++, (CStdString)pDeviceReport->m_drLPCMok);
+ }
else if (m_section == CONTROL_BT_HARDWARE)
{
SET_CONTROL_LABEL(40,g_localizeStrings.Get(20160));

0 comments on commit 9b5ede7

Please sign in to comment.