looper/dbus.hpp
2024-03-26 18:39:02 -07:00

31 lines
No EOL
859 B
C++

#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);
void setVolume(double volume);
double getPitch();
double getTempo();
double getSpeed();
double getVolume();
bool isOnlyInstance();
DBusAPISender();
};