mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-06 10:09:33 +02:00
Add documentation
This commit is contained in:
parent
29b4a3e9da
commit
063a1fad0d
1 changed files with 17 additions and 2 deletions
|
@ -47,15 +47,18 @@ namespace player
|
||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// Volume
|
||||||
struct Volume
|
struct Volume
|
||||||
{
|
{
|
||||||
double volume{1.0};
|
double volume{1.0}; ///< volume [0..1]
|
||||||
bool mute{false};
|
bool mute{false}; ///< muted?
|
||||||
};
|
};
|
||||||
|
|
||||||
using volume_callback = std::function<void(const Volume& volume)>;
|
using volume_callback = std::function<void(const Volume& volume)>;
|
||||||
|
|
||||||
|
/// c'tor
|
||||||
Player(boost::asio::io_context& io_context, const ClientSettings::Player& settings, std::shared_ptr<Stream> stream);
|
Player(boost::asio::io_context& io_context, const ClientSettings::Player& settings, std::shared_ptr<Stream> stream);
|
||||||
|
/// d'tor
|
||||||
virtual ~Player();
|
virtual ~Player();
|
||||||
|
|
||||||
/// Set audio volume in range [0..1]
|
/// Set audio volume in range [0..1]
|
||||||
|
@ -89,9 +92,12 @@ protected:
|
||||||
/// @param muted muted or not
|
/// @param muted muted or not
|
||||||
virtual void setHardwareVolume(const Volume& volume);
|
virtual void setHardwareVolume(const Volume& volume);
|
||||||
|
|
||||||
|
/// set volume polynomial: volume^exp
|
||||||
void setVolume_poly(double volume, double exp);
|
void setVolume_poly(double volume, double exp);
|
||||||
|
/// set volume exponential: (base^volume - 1) / (base - 1)
|
||||||
void setVolume_exp(double volume, double base);
|
void setVolume_exp(double volume, double base);
|
||||||
|
|
||||||
|
/// adjust volume of buffer by the current volume setting
|
||||||
void adjustVolume(char* buffer, size_t frames);
|
void adjustVolume(char* buffer, size_t frames);
|
||||||
|
|
||||||
/// Notify the server about hardware volume changes
|
/// Notify the server about hardware volume changes
|
||||||
|
@ -103,14 +109,23 @@ protected:
|
||||||
onVolumeChanged_(volume);
|
onVolumeChanged_(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// asio IO context
|
||||||
boost::asio::io_context& io_context_;
|
boost::asio::io_context& io_context_;
|
||||||
|
/// is the player started?
|
||||||
std::atomic<bool> active_;
|
std::atomic<bool> active_;
|
||||||
|
/// the played stream
|
||||||
std::shared_ptr<Stream> stream_;
|
std::shared_ptr<Stream> stream_;
|
||||||
|
/// runs the worker function if "needsThread" is true
|
||||||
std::thread playerThread_;
|
std::thread playerThread_;
|
||||||
|
/// player settings
|
||||||
ClientSettings::Player settings_;
|
ClientSettings::Player settings_;
|
||||||
|
/// player volume
|
||||||
Player::Volume volume_;
|
Player::Volume volume_;
|
||||||
|
/// current volume correction factor (according to "setVolume")
|
||||||
double volCorrection_;
|
double volCorrection_;
|
||||||
|
/// callback for local volume changes that are reported back to the server
|
||||||
volume_callback onVolumeChanged_;
|
volume_callback onVolumeChanged_;
|
||||||
|
/// mutex
|
||||||
mutable std::mutex mutex_;
|
mutable std::mutex mutex_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue