// AudioVolumeDlg.h : header file
//

#pragma once
#include "afxwin.h"
#include "afxcmn.h"

#include "..\..\..\..\Source\Bluetooth\wclAudio.h"

using namespace wclCommon;
using namespace wclAudio;

#define ID_TIMER	100


// CAudioVolumeDlg dialog
class CAudioVolumeDlg : public CDialog
{
// Construction
public:
	CAudioVolumeDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_AUDIOVOLUME_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()

private:
	CComboBox cbEndpoints;
	CListBox lbLog;
	CProgressCtrl pbMaster;
	CSliderCtrl tbMaster;
	CButton cbMute;

	CwclAudioSwitcher AudioSwitcher;
	CwclAudioMeter AudioMeter;
	CwclAudioVolume AudioVolume;

	std::vector<CProgressCtrl*> FBars;

	void Trace(const CString& Msg);
	void Trace(const CString& Msg, const int Error);
	
	void AddDevice(const wclAudioDevice& Device);
	void DeleteDevice(const tstring& Id);
	void SelectActiveDevice();
	void UpdateChannelsValue();

	void AudioSwitcherClosed(void* Sender);
	void AudioSwitcherOpened(void* Sender);
	void AudioSwitcherDeviceRemoved(void* Sender, const tstring& Id);
	void AudioSwitcherDeviceAdded(void* Sender, const tstring& Id);
	void AudioSwitcherStateChanged(void* Sender, const tstring& Id,
		const wclAudioDeviceState State);
	void AudioSwitcherDefaultDeviceChanged(void* Sender,
		const tstring& Id, const wclAudioDeviceDataFlow Flow,
		const wclAudioDeviceRole Role);

	void AudioMeterOpened(void* Sender);
	void AudioMeterClosed(void* Sender);
	void AudioMeterDisconnected(void* Sender);

	void AudioVolumeOpened(void* Sender);
	void AudioVolumeClosed(void* Sender);
	void AudioVolumeDisconnected(void* Sender);
	void AudioVolumeChanged(void* Sender, const bool Muted,
		const float Volume, const wclAudioPeakValues& Volumes);

public:
	afx_msg void OnDestroy();
	afx_msg void OnBnClickedButtonClose();
	afx_msg void OnBnClickedButtonOpen();
	afx_msg void OnTimer(UINT_PTR uTime);
	afx_msg void OnBnClickedCheckMute();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
};
