//---------------------------------------------------------------------------

#ifndef mainH
#define mainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "wclAudio.hpp"
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TfmMain : public TForm
{
__published:	// IDE-managed Components
        TLabel *laEndPoints;
        TComboBox *cbEndpoints;
        TButton *btOpen;
        TButton *btClose;
        TListBox *lbLog;
        TButton *btClear;
        TwclAudioSwitcher *AudioSwitcher;
        TwclAudioMeter *AudioMeter;
        TTimer *Timer;
        TProgressBar *pbMaster;
        TCheckBox *cbMute;
        TTrackBar *tbMaster;
        TwclAudioVolume *AudioVolume;
        void __fastcall btClearClick(TObject *Sender);
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall FormDestroy(TObject *Sender);
        void __fastcall AudioSwitcherClosed(TObject *Sender);
        void __fastcall AudioSwitcherOpened(TObject *Sender);
        void __fastcall AudioSwitcherDeviceRemoved(TObject *Sender,
          const String Id);
        void __fastcall AudioSwitcherDeviceAdded(TObject *Sender,
          const String Id);
        void __fastcall AudioMeterOpened(TObject *Sender);
        void __fastcall AudioMeterClosed(TObject *Sender);
        void __fastcall AudioMeterDisconnected(TObject *Sender);
        void __fastcall btCloseClick(TObject *Sender);
        void __fastcall btOpenClick(TObject *Sender);
        void __fastcall TimerTimer(TObject *Sender);
        void __fastcall AudioSwitcherStateChanged(TObject *Sender,
          const String Id, const TwclAudioDeviceState State);
        void __fastcall AudioSwitcherDefaultDeviceChanged(TObject *Sender,
		  const String Id, const TwclAudioDeviceDataFlow Flow,
          const TwclAudioDeviceRole Role);
        void __fastcall AudioVolumeOpened(TObject *Sender);
        void __fastcall AudioVolumeClosed(TObject *Sender);
        void __fastcall AudioVolumeDisconnected(TObject *Sender);
        void __fastcall tbMasterChange(TObject *Sender);
        void __fastcall cbMuteClick(TObject *Sender);
        void __fastcall AudioVolumeChanged(TObject *Sender,
          const bool Muted, const float Volume,
          const TwclAudioPeakValues Volumes);
private:	// User declarations
        DynamicArray<TProgressBar*> FBars;
        void Trace(const String& Msg);
        void Trace(const String& Msg, const int Error);

        void AddDevice(const TwclAudioDevice& Device);
        void DeleteDevice(const String& Id);
        void SelectActiveDevice();
        void UpdateChannelsValue();
public:		// User declarations
        __fastcall TfmMain(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TfmMain *fmMain;
//---------------------------------------------------------------------------
#endif
