2024-03-23 18:41:26 -07:00
|
|
|
#pragma once
|
|
|
|
#include <sdbus-c++/sdbus-c++.h>
|
|
|
|
#include "playback.h"
|
|
|
|
class DBusAPI {
|
|
|
|
friend class DBusAPISender;
|
|
|
|
static const char *serviceName;
|
|
|
|
static const char *objectPath;
|
|
|
|
static const char *interfaceName;
|
|
|
|
std::unique_ptr<sdbus::IConnection> connection;
|
|
|
|
std::unique_ptr<sdbus::IObject> api;
|
|
|
|
public:
|
|
|
|
Playback *playback;
|
|
|
|
DBusAPI(Playback *playback);
|
|
|
|
};
|
|
|
|
class DBusAPISender {
|
|
|
|
std::unique_ptr<sdbus::IProxy> proxy;
|
|
|
|
std::unique_ptr<sdbus::IConnection> connection;
|
|
|
|
bool connected = true;
|
|
|
|
public:
|
|
|
|
void playFile(std::string file);
|
|
|
|
void setPitch(double pitch);
|
|
|
|
void setTempo(double tempo);
|
|
|
|
void setSpeed(double speed);
|
2024-03-26 18:39:02 -07:00
|
|
|
void setVolume(double volume);
|
|
|
|
double getPitch();
|
|
|
|
double getTempo();
|
|
|
|
double getSpeed();
|
|
|
|
double getVolume();
|
2024-03-23 18:41:26 -07:00
|
|
|
bool isOnlyInstance();
|
|
|
|
DBusAPISender();
|
|
|
|
};
|