Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
badaix committed Feb 17, 2025
1 parent 685a53a commit 16ba42b
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions client/player/wasapi_player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,37 @@ class AudioSessionEventListener : public IAudioSessionEvents
bool muted_ = false;

public:
/// c'tor
AudioSessionEventListener() : _cRef(1)
{
}

/// @return volume
float getVolume()
{
return volume_;
}

/// @return if muted
bool getMuted()
{
return muted_;
}

/// d'tor
~AudioSessionEventListener()
{
}

// IUnknown methods -- AddRef, Release, and QueryInterface

/// documentation missing
ULONG STDMETHODCALLTYPE AddRef()
{
return InterlockedIncrement(&_cRef);
}

/// documentation missing
ULONG STDMETHODCALLTYPE Release()
{
ULONG ulRef = InterlockedDecrement(&_cRef);
Expand All @@ -76,34 +82,42 @@ class AudioSessionEventListener : public IAudioSessionEvents
return ulRef;
}

/// documentation missing
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID** ppvInterface);

// Notification methods for audio session events

/// OnDisplayNameChanged callback
HRESULT STDMETHODCALLTYPE OnDisplayNameChanged(LPCWSTR NewDisplayName, LPCGUID EventContext)
{
return S_OK;
}

/// OnIconPathChanged callback
HRESULT STDMETHODCALLTYPE OnIconPathChanged(LPCWSTR NewIconPath, LPCGUID EventContext)
{
return S_OK;
}

/// OnSimpleVolumeChanged callback
HRESULT STDMETHODCALLTYPE OnSimpleVolumeChanged(float NewVolume, BOOL NewMute, LPCGUID EventContext);

/// OnChannelVolumeChanged callback
HRESULT STDMETHODCALLTYPE OnChannelVolumeChanged(DWORD ChannelCount, float NewChannelVolumeArray[], DWORD ChangedChannel, LPCGUID EventContext)
{
return S_OK;
}

/// OnGroupingParamChanged callback
HRESULT STDMETHODCALLTYPE OnGroupingParamChanged(LPCGUID NewGroupingParam, LPCGUID EventContext)
{
return S_OK;
}

/// OnStateChanged callback
HRESULT STDMETHODCALLTYPE OnStateChanged(AudioSessionState NewState);

/// OnSessionDisconnected callback
HRESULT STDMETHODCALLTYPE OnSessionDisconnected(AudioSessionDisconnectReason DisconnectReason);
};

Expand All @@ -116,31 +130,37 @@ class AudioEndpointVolumeCallback : public IAudioEndpointVolumeCallback
bool muted_ = false;

public:
/// c'tor
AudioEndpointVolumeCallback() : _cRef(1)
{
}

/// d'tor
~AudioEndpointVolumeCallback()
{
}

/// @return volume
float getVolume()
{
return volume_;
}

/// @return if muted
bool getMuted()
{
return muted_;
}

// IUnknown methods -- AddRef, Release, and QueryInterface

/// documentation missing
ULONG STDMETHODCALLTYPE AddRef()
{
return InterlockedIncrement(&_cRef);
}

/// documentation missing
ULONG STDMETHODCALLTYPE Release()
{
ULONG ulRef = InterlockedDecrement(&_cRef);
Expand All @@ -151,6 +171,7 @@ class AudioEndpointVolumeCallback : public IAudioEndpointVolumeCallback
return ulRef;
}

/// documentation missing
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID** ppvInterface)
{
if (IID_IUnknown == riid)
Expand All @@ -174,6 +195,7 @@ class AudioEndpointVolumeCallback : public IAudioEndpointVolumeCallback

// Callback method for endpoint-volume-change notifications.

/// documentation missing
HRESULT STDMETHODCALLTYPE OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify);
};

Expand All @@ -183,14 +205,17 @@ static constexpr auto WASAPI = "wasapi";
class WASAPIPlayer : public Player
{
public:
/// c'tor
WASAPIPlayer(boost::asio::io_context& io_context, const ClientSettings::Player& settings, std::shared_ptr<Stream> stream);
/// d'tor
virtual ~WASAPIPlayer();

/// @return list of available PCM devices
static std::vector<PcmDevice> pcm_list();

protected:
virtual void worker();
virtual bool needsThread() const override
void worker() override;
bool needsThread() const override
{
return true;
}
Expand Down

0 comments on commit 16ba42b

Please sign in to comment.