mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-30 15:32:37 +00:00
Export lots of methods. Still a lot to go.
This commit is contained in:
parent
fa55035de0
commit
57f43057c9
@ -50,25 +50,25 @@ namespace musik { namespace core { namespace audio {
|
||||
NoDelete = 2
|
||||
};
|
||||
|
||||
Buffer(Flags flags = NoFlags) noexcept;
|
||||
Buffer(float* buffer, int samples) noexcept;
|
||||
EXPORT Buffer(Flags flags = NoFlags) noexcept;
|
||||
EXPORT Buffer(float* buffer, int samples) noexcept;
|
||||
|
||||
virtual ~Buffer();
|
||||
EXPORT virtual ~Buffer();
|
||||
|
||||
long SampleRate() const noexcept override;
|
||||
void SetSampleRate(long sampleRate) noexcept override;
|
||||
int Channels() const noexcept override;
|
||||
void SetChannels(int channels) noexcept override;
|
||||
float* BufferPointer() const noexcept override;
|
||||
long Samples() const noexcept override;
|
||||
void SetSamples(long samples) override;
|
||||
long Bytes() const noexcept override;
|
||||
void Release() noexcept override { delete this; }
|
||||
EXPORT long SampleRate() const noexcept override;
|
||||
EXPORT void SetSampleRate(long sampleRate) noexcept override;
|
||||
EXPORT int Channels() const noexcept override;
|
||||
EXPORT void SetChannels(int channels) noexcept override;
|
||||
EXPORT float* BufferPointer() const noexcept override;
|
||||
EXPORT long Samples() const noexcept override;
|
||||
EXPORT void SetSamples(long samples) override;
|
||||
EXPORT long Bytes() const noexcept override;
|
||||
EXPORT void Release() noexcept override { delete this; }
|
||||
|
||||
double Position() const noexcept;
|
||||
void SetPosition(double position) noexcept;
|
||||
void Copy(float const* buffer, long samples, long offset = 0);
|
||||
void CopyFormat(Buffer* fromBuffer) noexcept;
|
||||
EXPORT double Position() const noexcept;
|
||||
EXPORT void SetPosition(double position) noexcept;
|
||||
EXPORT void Copy(float const* buffer, long samples, long offset = 0);
|
||||
EXPORT void CopyFormat(Buffer* fromBuffer) noexcept;
|
||||
|
||||
private:
|
||||
void ResizeBuffer();
|
||||
|
@ -55,35 +55,35 @@ namespace musik { namespace core { namespace audio {
|
||||
public sigslot::has_slots<>
|
||||
{
|
||||
public:
|
||||
CrossfadeTransport();
|
||||
virtual ~CrossfadeTransport();
|
||||
EXPORT CrossfadeTransport();
|
||||
EXPORT virtual ~CrossfadeTransport();
|
||||
|
||||
void StopImmediately();
|
||||
EXPORT void StopImmediately();
|
||||
|
||||
void Start(const std::string& uri, Gain gain, StartMode mode) override;
|
||||
void PrepareNextTrack(const std::string& uri, Gain gain) override;
|
||||
EXPORT void Start(const std::string& uri, Gain gain, StartMode mode) override;
|
||||
EXPORT void PrepareNextTrack(const std::string& uri, Gain gain) override;
|
||||
|
||||
std::string Uri() override;
|
||||
EXPORT std::string Uri() override;
|
||||
|
||||
void Stop() override;
|
||||
bool Pause() override;
|
||||
bool Resume() override;
|
||||
EXPORT void Stop() override;
|
||||
EXPORT bool Pause() override;
|
||||
EXPORT bool Resume() override;
|
||||
|
||||
double Position() override;
|
||||
void SetPosition(double seconds) override;
|
||||
EXPORT double Position() override;
|
||||
EXPORT void SetPosition(double seconds) override;
|
||||
|
||||
double Volume() noexcept override;
|
||||
void SetVolume(double volume) override;
|
||||
EXPORT double Volume() noexcept override;
|
||||
EXPORT void SetVolume(double volume) override;
|
||||
|
||||
bool IsMuted() noexcept override;
|
||||
void SetMuted(bool muted) override;
|
||||
EXPORT bool IsMuted() noexcept override;
|
||||
EXPORT void SetMuted(bool muted) override;
|
||||
|
||||
double GetDuration() override;
|
||||
EXPORT double GetDuration() override;
|
||||
|
||||
void ReloadOutput() override;
|
||||
EXPORT void ReloadOutput() override;
|
||||
|
||||
musik::core::sdk::PlaybackState GetPlaybackState() override;
|
||||
musik::core::sdk::StreamState GetStreamState() override;
|
||||
EXPORT musik::core::sdk::PlaybackState GetPlaybackState() override;
|
||||
EXPORT musik::core::sdk::StreamState GetStreamState() override;
|
||||
|
||||
private:
|
||||
using Lock = std::unique_lock<std::recursive_mutex>;
|
||||
|
@ -58,21 +58,21 @@ namespace musik { namespace core { namespace audio {
|
||||
|
||||
sigslot::signal0<> Emptied;
|
||||
|
||||
Crossfader(ITransport& transport);
|
||||
virtual ~Crossfader();
|
||||
EXPORT Crossfader(ITransport& transport);
|
||||
EXPORT virtual ~Crossfader();
|
||||
|
||||
void Fade(
|
||||
EXPORT void Fade(
|
||||
Player* player,
|
||||
std::shared_ptr<musik::core::sdk::IOutput> output,
|
||||
Direction direction,
|
||||
long durationMs);
|
||||
|
||||
void Cancel(Player* player, Direction direction);
|
||||
bool Contains(Player* player);
|
||||
void Pause();
|
||||
void Resume();
|
||||
void Stop();
|
||||
void Drain();
|
||||
EXPORT void Cancel(Player* player, Direction direction);
|
||||
EXPORT bool Contains(Player* player);
|
||||
EXPORT void Pause();
|
||||
EXPORT void Resume();
|
||||
EXPORT void Stop();
|
||||
EXPORT void Drain();
|
||||
|
||||
private:
|
||||
void ThreadLoop();
|
||||
|
@ -50,33 +50,33 @@ namespace musik { namespace core { namespace audio {
|
||||
private Player::EventListener
|
||||
{
|
||||
public:
|
||||
GaplessTransport();
|
||||
virtual ~GaplessTransport();
|
||||
EXPORT GaplessTransport();
|
||||
EXPORT virtual ~GaplessTransport();
|
||||
|
||||
void Start(const std::string& uri, Gain gain, StartMode mode) override;
|
||||
void PrepareNextTrack(const std::string& uri, Gain gain) override;
|
||||
EXPORT void Start(const std::string& uri, Gain gain, StartMode mode) override;
|
||||
EXPORT void PrepareNextTrack(const std::string& uri, Gain gain) override;
|
||||
|
||||
std::string Uri() override;
|
||||
EXPORT std::string Uri() override;
|
||||
|
||||
void Stop() override;
|
||||
bool Pause() override;
|
||||
bool Resume() override;
|
||||
EXPORT void Stop() override;
|
||||
EXPORT bool Pause() override;
|
||||
EXPORT bool Resume() override;
|
||||
|
||||
double Position() override;
|
||||
void SetPosition(double seconds) override;
|
||||
EXPORT double Position() override;
|
||||
EXPORT void SetPosition(double seconds) override;
|
||||
|
||||
double Volume() noexcept override;
|
||||
void SetVolume(double volume) override;
|
||||
EXPORT double Volume() noexcept override;
|
||||
EXPORT void SetVolume(double volume) override;
|
||||
|
||||
bool IsMuted() noexcept override;
|
||||
void SetMuted(bool muted) override;
|
||||
EXPORT bool IsMuted() noexcept override;
|
||||
EXPORT void SetMuted(bool muted) override;
|
||||
|
||||
double GetDuration() override;
|
||||
EXPORT double GetDuration() override;
|
||||
|
||||
void ReloadOutput() override;
|
||||
EXPORT void ReloadOutput() override;
|
||||
|
||||
musik::core::sdk::PlaybackState GetPlaybackState() override;
|
||||
musik::core::sdk::StreamState GetStreamState() override;
|
||||
EXPORT musik::core::sdk::PlaybackState GetPlaybackState() override;
|
||||
EXPORT musik::core::sdk::StreamState GetStreamState() override;
|
||||
|
||||
private:
|
||||
using LockT = std::unique_lock<std::recursive_mutex>;
|
||||
|
@ -47,15 +47,15 @@ namespace musik { namespace core { namespace audio {
|
||||
|
||||
class IStream {
|
||||
public:
|
||||
virtual musik::core::sdk::IBuffer* GetNextProcessedOutputBuffer() = 0;
|
||||
virtual void OnBufferProcessedByPlayer(musik::core::sdk::IBuffer* buffer) = 0;
|
||||
virtual double SetPosition(double seconds) = 0;
|
||||
virtual double GetDuration() = 0;
|
||||
virtual bool OpenStream(std::string uri, musik::core::sdk::IOutput* output) = 0;
|
||||
virtual void Interrupt() = 0;
|
||||
virtual int GetCapabilities() = 0;
|
||||
virtual bool Eof() = 0;
|
||||
virtual void Release() = 0;
|
||||
EXPORT virtual musik::core::sdk::IBuffer* GetNextProcessedOutputBuffer() = 0;
|
||||
EXPORT virtual void OnBufferProcessedByPlayer(musik::core::sdk::IBuffer* buffer) = 0;
|
||||
EXPORT virtual double SetPosition(double seconds) = 0;
|
||||
EXPORT virtual double GetDuration() = 0;
|
||||
EXPORT virtual bool OpenStream(std::string uri, musik::core::sdk::IOutput* output) = 0;
|
||||
EXPORT virtual void Interrupt() = 0;
|
||||
EXPORT virtual int GetCapabilities() = 0;
|
||||
EXPORT virtual bool Eof() = 0;
|
||||
EXPORT virtual void Release() = 0;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<IStream> IStreamPtr;
|
||||
|
@ -54,32 +54,32 @@ namespace musik { namespace core { namespace audio {
|
||||
sigslot::signal0<> VolumeChanged;
|
||||
sigslot::signal1<double> TimeChanged;
|
||||
|
||||
virtual ~ITransport() { }
|
||||
EXPORT virtual ~ITransport() { }
|
||||
|
||||
virtual void Start(const std::string& uri, Gain gain, StartMode mode) = 0;
|
||||
virtual void PrepareNextTrack(const std::string& uri, Gain gain) = 0;
|
||||
EXPORT virtual void Start(const std::string& uri, Gain gain, StartMode mode) = 0;
|
||||
EXPORT virtual void PrepareNextTrack(const std::string& uri, Gain gain) = 0;
|
||||
|
||||
virtual std::string Uri() = 0;
|
||||
EXPORT virtual std::string Uri() = 0;
|
||||
|
||||
virtual void Stop() = 0;
|
||||
virtual bool Pause() = 0;
|
||||
virtual bool Resume() = 0;
|
||||
EXPORT virtual void Stop() = 0;
|
||||
EXPORT virtual bool Pause() = 0;
|
||||
EXPORT virtual bool Resume() = 0;
|
||||
|
||||
virtual double Position() = 0;
|
||||
virtual void SetPosition(double seconds) = 0;
|
||||
EXPORT virtual double Position() = 0;
|
||||
EXPORT virtual void SetPosition(double seconds) = 0;
|
||||
|
||||
virtual double Volume() = 0;
|
||||
virtual void SetVolume(double volume) = 0;
|
||||
EXPORT virtual double Volume() = 0;
|
||||
EXPORT virtual void SetVolume(double volume) = 0;
|
||||
|
||||
virtual double GetDuration() = 0;
|
||||
EXPORT virtual double GetDuration() = 0;
|
||||
|
||||
virtual bool IsMuted() = 0;
|
||||
virtual void SetMuted(bool muted) = 0;
|
||||
EXPORT virtual bool IsMuted() = 0;
|
||||
EXPORT virtual void SetMuted(bool muted) = 0;
|
||||
|
||||
virtual void ReloadOutput() = 0;
|
||||
EXPORT virtual void ReloadOutput() = 0;
|
||||
|
||||
virtual musik::core::sdk::PlaybackState GetPlaybackState() = 0;
|
||||
virtual musik::core::sdk::StreamState GetStreamState() = 0;
|
||||
EXPORT virtual musik::core::sdk::PlaybackState GetPlaybackState() = 0;
|
||||
EXPORT virtual musik::core::sdk::StreamState GetStreamState() = 0;
|
||||
};
|
||||
|
||||
} } }
|
||||
|
@ -46,35 +46,35 @@ namespace musik { namespace core { namespace audio {
|
||||
public:
|
||||
using Type = musik::core::sdk::TransportType;
|
||||
|
||||
MasterTransport() noexcept;
|
||||
EXPORT MasterTransport() noexcept;
|
||||
|
||||
void Start(const std::string& uri, Gain gain, StartMode mode) override;
|
||||
void PrepareNextTrack(const std::string& uri, Gain gain) override;
|
||||
EXPORT void Start(const std::string& uri, Gain gain, StartMode mode) override;
|
||||
EXPORT void PrepareNextTrack(const std::string& uri, Gain gain) override;
|
||||
|
||||
std::string Uri() override;
|
||||
EXPORT std::string Uri() override;
|
||||
|
||||
void Stop() override;
|
||||
bool Pause() override;
|
||||
bool Resume() override;
|
||||
EXPORT void Stop() override;
|
||||
EXPORT bool Pause() override;
|
||||
EXPORT bool Resume() override;
|
||||
|
||||
double Position() override;
|
||||
void SetPosition(double seconds) override;
|
||||
EXPORT double Position() override;
|
||||
EXPORT void SetPosition(double seconds) override;
|
||||
|
||||
double Volume() override;
|
||||
void SetVolume(double volume) override;
|
||||
EXPORT double Volume() override;
|
||||
EXPORT void SetVolume(double volume) override;
|
||||
|
||||
double GetDuration() override;
|
||||
EXPORT double GetDuration() override;
|
||||
|
||||
bool IsMuted() override;
|
||||
void SetMuted(bool muted) override;
|
||||
EXPORT bool IsMuted() override;
|
||||
EXPORT void SetMuted(bool muted) override;
|
||||
|
||||
void ReloadOutput() override;
|
||||
EXPORT void ReloadOutput() override;
|
||||
|
||||
musik::core::sdk::PlaybackState GetPlaybackState() override;
|
||||
musik::core::sdk::StreamState GetStreamState() override;
|
||||
EXPORT musik::core::sdk::PlaybackState GetPlaybackState() override;
|
||||
EXPORT musik::core::sdk::StreamState GetStreamState() override;
|
||||
|
||||
void SwitchTo(Type type);
|
||||
Type GetType() noexcept;
|
||||
EXPORT void SwitchTo(Type type);
|
||||
EXPORT Type GetType() noexcept;
|
||||
|
||||
private:
|
||||
void OnStreamEvent(musik::core::sdk::StreamState type, std::string url);
|
||||
|
@ -41,14 +41,13 @@ namespace musik { namespace core { namespace audio { namespace outputs {
|
||||
|
||||
using IOutput = musik::core::sdk::IOutput;
|
||||
|
||||
std::vector<std::shared_ptr<IOutput>> GetAllOutputs();
|
||||
size_t GetOutputCount();
|
||||
IOutput* GetUnmanagedOutput(size_t index);
|
||||
IOutput* GetUnmanagedOutput(const std::string& name);
|
||||
IOutput* GetUnmanagedSelectedOutput();
|
||||
std::shared_ptr<IOutput> SelectedOutput();
|
||||
|
||||
void SelectOutput(std::shared_ptr<IOutput> output);
|
||||
void SelectOutput(IOutput* output);
|
||||
EXPORT std::vector<std::shared_ptr<IOutput>> GetAllOutputs();
|
||||
EXPORT size_t GetOutputCount();
|
||||
EXPORT IOutput* GetUnmanagedOutput(size_t index);
|
||||
EXPORT IOutput* GetUnmanagedOutput(const std::string& name);
|
||||
EXPORT IOutput* GetUnmanagedSelectedOutput();
|
||||
EXPORT std::shared_ptr<IOutput> SelectedOutput();
|
||||
EXPORT void SelectOutput(std::shared_ptr<IOutput> output);
|
||||
EXPORT void SelectOutput(IOutput* output);
|
||||
|
||||
} } } }
|
||||
|
@ -68,67 +68,67 @@ namespace musik { namespace core { namespace audio {
|
||||
sigslot::signal0<> VolumeChanged;
|
||||
sigslot::signal1<double> TimeChanged;
|
||||
|
||||
PlaybackService(
|
||||
EXPORT PlaybackService(
|
||||
musik::core::runtime::IMessageQueue& messageQueue,
|
||||
musik::core::ILibraryPtr library,
|
||||
std::shared_ptr<musik::core::audio::ITransport> transport);
|
||||
|
||||
PlaybackService(
|
||||
EXPORT PlaybackService(
|
||||
musik::core::runtime::IMessageQueue& messageQueue,
|
||||
musik::core::ILibraryPtr library);
|
||||
|
||||
virtual ~PlaybackService();
|
||||
EXPORT virtual ~PlaybackService();
|
||||
|
||||
/* IMessageTarget */
|
||||
void ProcessMessage(musik::core::runtime::IMessage &message) override;
|
||||
EXPORT void ProcessMessage(musik::core::runtime::IMessage &message) override;
|
||||
|
||||
/* IPlaybackService */
|
||||
void Play(size_t index) override;
|
||||
bool Next() override;
|
||||
bool Previous() override;
|
||||
void Stop() override { transport->Stop(); }
|
||||
musik::core::sdk::RepeatMode GetRepeatMode() override { return this->repeatMode; }
|
||||
void SetRepeatMode(musik::core::sdk::RepeatMode mode) override;
|
||||
void ToggleRepeatMode() override;
|
||||
musik::core::sdk::PlaybackState GetPlaybackState() override;
|
||||
bool IsShuffled() override;
|
||||
void ToggleShuffle() override;
|
||||
size_t GetIndex() noexcept override;
|
||||
size_t Count() override;
|
||||
double GetVolume() override;
|
||||
void SetVolume(double vol) override;
|
||||
void PauseOrResume() override;
|
||||
bool IsMuted() override;
|
||||
void ToggleMute() override;
|
||||
double GetPosition() override;
|
||||
void SetPosition(double seconds) override;
|
||||
double GetDuration() override;
|
||||
musik::core::sdk::ITrack* GetTrack(size_t index) override;
|
||||
musik::core::sdk::ITrack* GetPlayingTrack() override;
|
||||
void CopyFrom(const musik::core::sdk::ITrackList* source) override;
|
||||
void Play(const musik::core::sdk::ITrackList* source, size_t index) override;
|
||||
musik::core::sdk::ITrackListEditor* EditPlaylist() override;
|
||||
musik::core::sdk::TimeChangeMode GetTimeChangeMode() noexcept override;
|
||||
void SetTimeChangeMode(musik::core::sdk::TimeChangeMode) noexcept override;
|
||||
void ReloadOutput() override;
|
||||
musik::core::sdk::ITrackList* Clone() override;
|
||||
EXPORT void Play(size_t index) override;
|
||||
EXPORT bool Next() override;
|
||||
EXPORT bool Previous() override;
|
||||
EXPORT void Stop() override { transport->Stop(); }
|
||||
EXPORT musik::core::sdk::RepeatMode GetRepeatMode() override { return this->repeatMode; }
|
||||
EXPORT void SetRepeatMode(musik::core::sdk::RepeatMode mode) override;
|
||||
EXPORT void ToggleRepeatMode() override;
|
||||
EXPORT musik::core::sdk::PlaybackState GetPlaybackState() override;
|
||||
EXPORT bool IsShuffled() override;
|
||||
EXPORT void ToggleShuffle() override;
|
||||
EXPORT size_t GetIndex() noexcept override;
|
||||
EXPORT size_t Count() override;
|
||||
EXPORT double GetVolume() override;
|
||||
EXPORT void SetVolume(double vol) override;
|
||||
EXPORT void PauseOrResume() override;
|
||||
EXPORT bool IsMuted() override;
|
||||
EXPORT void ToggleMute() override;
|
||||
EXPORT double GetPosition() override;
|
||||
EXPORT void SetPosition(double seconds) override;
|
||||
EXPORT double GetDuration() override;
|
||||
EXPORT musik::core::sdk::ITrack* GetTrack(size_t index) override;
|
||||
EXPORT musik::core::sdk::ITrack* GetPlayingTrack() override;
|
||||
EXPORT void CopyFrom(const musik::core::sdk::ITrackList* source) override;
|
||||
EXPORT void Play(const musik::core::sdk::ITrackList* source, size_t index) override;
|
||||
EXPORT musik::core::sdk::ITrackListEditor* EditPlaylist() override;
|
||||
EXPORT musik::core::sdk::TimeChangeMode GetTimeChangeMode() noexcept override;
|
||||
EXPORT void SetTimeChangeMode(musik::core::sdk::TimeChangeMode) noexcept override;
|
||||
EXPORT void ReloadOutput() override;
|
||||
EXPORT musik::core::sdk::ITrackList* Clone() override;
|
||||
|
||||
/* TODO: include in SDK? */
|
||||
virtual bool HotSwap(const TrackList& source, size_t index = 0);
|
||||
EXPORT virtual bool HotSwap(const TrackList& source, size_t index = 0);
|
||||
|
||||
/* app-specific implementation. similar to some SDK methods, but use
|
||||
concrete data types with known optimizations */
|
||||
void Play(const musik::core::TrackList& tracks, size_t index);
|
||||
void Prepare(size_t index, double position = 0.0f);
|
||||
void CopyTo(musik::core::TrackList& target);
|
||||
void CopyFrom(const musik::core::TrackList& source);
|
||||
musik::core::TrackPtr GetPlaying();
|
||||
EXPORT void Play(const musik::core::TrackList& tracks, size_t index);
|
||||
EXPORT void Prepare(size_t index, double position = 0.0f);
|
||||
EXPORT void CopyTo(musik::core::TrackList& target);
|
||||
EXPORT void CopyFrom(const musik::core::TrackList& source);
|
||||
EXPORT musik::core::TrackPtr GetPlaying();
|
||||
|
||||
musik::core::audio::ITransport& GetTransport() noexcept {
|
||||
EXPORT musik::core::audio::ITransport& GetTransport() noexcept {
|
||||
return *this->transport.get();
|
||||
}
|
||||
|
||||
std::shared_ptr<const musik::core::TrackList> GetTrackList() noexcept {
|
||||
EXPORT std::shared_ptr<const musik::core::TrackList> GetTrackList() noexcept {
|
||||
return std::shared_ptr<const musik::core::TrackList>(
|
||||
&this->playlist, [](const musik::core::TrackList*) {});
|
||||
}
|
||||
@ -140,18 +140,18 @@ namespace musik { namespace core { namespace audio {
|
||||
public:
|
||||
using IEditor = std::shared_ptr<musik::core::sdk::ITrackListEditor>;
|
||||
|
||||
Editor(Editor&& other);
|
||||
virtual ~Editor();
|
||||
EXPORT Editor(Editor&& other);
|
||||
EXPORT virtual ~Editor();
|
||||
|
||||
/* ITrackListEditor */
|
||||
bool Insert(int64_t id, size_t index) override;
|
||||
bool Swap(size_t index1, size_t index2) override;
|
||||
bool Move(size_t from, size_t to) override;
|
||||
bool Delete(size_t index) override;
|
||||
void Add(const int64_t id) override;
|
||||
void Clear() override;
|
||||
void Shuffle() override;
|
||||
void Release() noexcept override;
|
||||
EXPORT bool Insert(int64_t id, size_t index) override;
|
||||
EXPORT bool Swap(size_t index1, size_t index2) override;
|
||||
EXPORT bool Move(size_t from, size_t to) override;
|
||||
EXPORT bool Delete(size_t index) override;
|
||||
EXPORT void Add(const int64_t id) override;
|
||||
EXPORT void Clear() override;
|
||||
EXPORT void Shuffle() override;
|
||||
EXPORT void Release() noexcept override;
|
||||
|
||||
private:
|
||||
friend class PlaybackService;
|
||||
@ -174,7 +174,7 @@ namespace musik { namespace core { namespace audio {
|
||||
bool edited;
|
||||
};
|
||||
|
||||
Editor Edit();
|
||||
EXPORT Editor Edit();
|
||||
|
||||
private:
|
||||
void OnStreamEvent(musik::core::sdk::StreamState eventType, std::string uri);
|
||||
|
@ -56,7 +56,7 @@ namespace musik { namespace core { namespace audio {
|
||||
enum class DestroyMode: int { Drain = 0, NoDrain = 1 };
|
||||
|
||||
struct Gain {
|
||||
Gain() noexcept {
|
||||
EXPORT Gain() noexcept {
|
||||
this->preamp = this->gain = this->peak = 1.0f;
|
||||
this->peakValid = false;
|
||||
}
|
||||
@ -67,43 +67,43 @@ namespace musik { namespace core { namespace audio {
|
||||
};
|
||||
|
||||
struct EventListener {
|
||||
virtual ~EventListener() { }
|
||||
virtual void OnPlayerBuffered(Player* player) { }
|
||||
virtual void OnPlayerStarted(Player* player) { }
|
||||
virtual void OnPlayerAlmostEnded(Player* player) { }
|
||||
virtual void OnPlayerFinished(Player* player) { }
|
||||
virtual void OnPlayerOpenFailed(Player* player) { }
|
||||
virtual void OnPlayerDestroying(Player* player) { }
|
||||
virtual void OnPlayerMixPoint(Player* player, int id, double time) { }
|
||||
EXPORT virtual ~EventListener() { }
|
||||
EXPORT virtual void OnPlayerBuffered(Player* player) { }
|
||||
EXPORT virtual void OnPlayerStarted(Player* player) { }
|
||||
EXPORT virtual void OnPlayerAlmostEnded(Player* player) { }
|
||||
EXPORT virtual void OnPlayerFinished(Player* player) { }
|
||||
EXPORT virtual void OnPlayerOpenFailed(Player* player) { }
|
||||
EXPORT virtual void OnPlayerDestroying(Player* player) { }
|
||||
EXPORT virtual void OnPlayerMixPoint(Player* player, int id, double time) { }
|
||||
};
|
||||
|
||||
static Player* Create(
|
||||
EXPORT static Player* Create(
|
||||
const std::string &url,
|
||||
std::shared_ptr<musik::core::sdk::IOutput> output,
|
||||
DestroyMode destroyMode,
|
||||
EventListener *listener,
|
||||
Gain gain = Gain());
|
||||
|
||||
virtual void OnBufferProcessed(musik::core::sdk::IBuffer *buffer);
|
||||
EXPORT virtual void OnBufferProcessed(musik::core::sdk::IBuffer *buffer);
|
||||
|
||||
void Detach(EventListener *listener);
|
||||
void Attach(EventListener *listener);
|
||||
EXPORT void Detach(EventListener *listener);
|
||||
EXPORT void Attach(EventListener *listener);
|
||||
|
||||
void Play();
|
||||
void Destroy();
|
||||
void Destroy(DestroyMode mode);
|
||||
EXPORT void Play();
|
||||
EXPORT void Destroy();
|
||||
EXPORT void Destroy(DestroyMode mode);
|
||||
|
||||
double GetPosition();
|
||||
void SetPosition(double seconds);
|
||||
double GetDuration();
|
||||
EXPORT double GetPosition();
|
||||
EXPORT void SetPosition(double seconds);
|
||||
EXPORT double GetDuration();
|
||||
|
||||
void AddMixPoint(int id, double time);
|
||||
EXPORT void AddMixPoint(int id, double time);
|
||||
|
||||
bool HasCapability(musik::core::sdk::Capability capability);
|
||||
EXPORT bool HasCapability(musik::core::sdk::Capability capability);
|
||||
|
||||
std::string GetUrl() const { return this->url; }
|
||||
EXPORT std::string GetUrl() const { return this->url; }
|
||||
|
||||
musik::core::sdk::StreamState GetStreamState() noexcept { return this->streamState; }
|
||||
EXPORT musik::core::sdk::StreamState GetStreamState() noexcept { return this->streamState; }
|
||||
|
||||
private:
|
||||
friend void playerThreadLoop(Player* player);
|
||||
|
@ -56,12 +56,12 @@ namespace musik { namespace core { namespace audio {
|
||||
using StreamFlags = musik::core::sdk::StreamFlags;
|
||||
|
||||
public:
|
||||
static IStreamPtr Create(
|
||||
EXPORT static IStreamPtr Create(
|
||||
int samplesPerChannel = 2048,
|
||||
double bufferLengthSeconds = 5,
|
||||
StreamFlags options = StreamFlags::None);
|
||||
|
||||
static IStream* CreateUnmanaged(
|
||||
EXPORT static IStream* CreateUnmanaged(
|
||||
int samplesPerChannel = 2048,
|
||||
double bufferLengthSeconds = 5,
|
||||
StreamFlags options = StreamFlags::None);
|
||||
@ -73,17 +73,17 @@ namespace musik { namespace core { namespace audio {
|
||||
StreamFlags options);
|
||||
|
||||
public:
|
||||
virtual ~Stream();
|
||||
EXPORT virtual ~Stream();
|
||||
|
||||
IBuffer* GetNextProcessedOutputBuffer() override;
|
||||
void OnBufferProcessedByPlayer(IBuffer* buffer) override;
|
||||
double SetPosition(double seconds) override;
|
||||
double GetDuration() override;
|
||||
bool OpenStream(std::string uri, musik::core::sdk::IOutput* output) override;
|
||||
void Interrupt() override;
|
||||
int GetCapabilities() override;
|
||||
bool Eof() override { return this->done; }
|
||||
void Release() override { delete this; }
|
||||
EXPORT IBuffer* GetNextProcessedOutputBuffer() override;
|
||||
EXPORT void OnBufferProcessedByPlayer(IBuffer* buffer) override;
|
||||
EXPORT double SetPosition(double seconds) override;
|
||||
EXPORT double GetDuration() override;
|
||||
EXPORT bool OpenStream(std::string uri, musik::core::sdk::IOutput* output) override;
|
||||
EXPORT void Interrupt() override;
|
||||
EXPORT int GetCapabilities() override;
|
||||
EXPORT bool Eof() override { return this->done; }
|
||||
EXPORT void Release() override { delete this; }
|
||||
|
||||
private:
|
||||
bool GetNextBufferFromDecoder();
|
||||
|
@ -47,15 +47,15 @@
|
||||
namespace musik { namespace core { namespace audio {
|
||||
|
||||
namespace streams {
|
||||
std::shared_ptr<musik::core::sdk::IDecoder>
|
||||
EXPORT std::shared_ptr<musik::core::sdk::IDecoder>
|
||||
GetDecoderForDataStream(musik::core::io::DataStreamFactory::DataStreamPtr dataStream);
|
||||
|
||||
musik::core::sdk::IDecoder*
|
||||
EXPORT musik::core::sdk::IDecoder*
|
||||
GetDecoderForDataStream(musik::core::sdk::IDataStream* stream);
|
||||
|
||||
musik::core::sdk::IEncoder* GetEncoderForType(const char* type);
|
||||
EXPORT musik::core::sdk::IEncoder* GetEncoderForType(const char* type);
|
||||
|
||||
std::vector<std::shared_ptr<musik::core::sdk::IDSP > > GetDspPlugins();
|
||||
EXPORT std::vector<std::shared_ptr<musik::core::sdk::IDSP > > GetDspPlugins();
|
||||
};
|
||||
|
||||
} } }
|
||||
|
@ -40,14 +40,13 @@
|
||||
|
||||
namespace musik { namespace core { namespace audio { namespace vis {
|
||||
|
||||
musik::core::sdk::ISpectrumVisualizer* SpectrumVisualizer();
|
||||
musik::core::sdk::IPcmVisualizer* PcmVisualizer();
|
||||
|
||||
std::shared_ptr<musik::core::sdk::IVisualizer> GetVisualizer(size_t index);
|
||||
size_t VisualizerCount();
|
||||
void SetSelectedVisualizer(std::shared_ptr<musik::core::sdk::IVisualizer> visualizer);
|
||||
std::shared_ptr<musik::core::sdk::IVisualizer> SelectedVisualizer();
|
||||
void HideSelectedVisualizer();
|
||||
void Shutdown();
|
||||
EXPORT musik::core::sdk::ISpectrumVisualizer* SpectrumVisualizer();
|
||||
EXPORT musik::core::sdk::IPcmVisualizer* PcmVisualizer();
|
||||
EXPORT std::shared_ptr<musik::core::sdk::IVisualizer> GetVisualizer(size_t index);
|
||||
EXPORT size_t VisualizerCount();
|
||||
EXPORT void SetSelectedVisualizer(std::shared_ptr<musik::core::sdk::IVisualizer> visualizer);
|
||||
EXPORT std::shared_ptr<musik::core::sdk::IVisualizer> SelectedVisualizer();
|
||||
EXPORT void HideSelectedVisualizer();
|
||||
EXPORT void Shutdown();
|
||||
|
||||
} } } }
|
||||
|
@ -42,6 +42,14 @@
|
||||
#include <musikcore/support/NarrowCast.h>
|
||||
#include <musikcore/support/DeleteDefaults.h>
|
||||
|
||||
#ifndef mcsdk_export
|
||||
#ifdef WIN32
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define EXPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x0601
|
||||
|
@ -57,19 +57,19 @@ namespace musik { namespace core { namespace db {
|
||||
public:
|
||||
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS(Connection)
|
||||
|
||||
Connection() noexcept;
|
||||
~Connection();
|
||||
EXPORT Connection() noexcept;
|
||||
EXPORT ~Connection();
|
||||
|
||||
int Open(const std::string &database, unsigned int options = 0, unsigned int cache = 0);
|
||||
int Close() noexcept;
|
||||
int Execute(const char* sql);
|
||||
EXPORT int Open(const std::string &database, unsigned int options = 0, unsigned int cache = 0);
|
||||
EXPORT int Close() noexcept;
|
||||
EXPORT int Execute(const char* sql);
|
||||
|
||||
int64_t LastInsertedId() noexcept;
|
||||
EXPORT int64_t LastInsertedId() noexcept;
|
||||
|
||||
int LastModifiedRowCount() noexcept;
|
||||
EXPORT int LastModifiedRowCount() noexcept;
|
||||
|
||||
void Interrupt();
|
||||
void Checkpoint() noexcept;
|
||||
EXPORT void Interrupt();
|
||||
EXPORT void Checkpoint() noexcept;
|
||||
|
||||
private:
|
||||
void Initialize(unsigned int cache);
|
||||
|
@ -45,11 +45,11 @@ namespace musik { namespace core { namespace db {
|
||||
public:
|
||||
DELETE_CLASS_DEFAULTS(ScopedTransaction)
|
||||
|
||||
ScopedTransaction(Connection &connection);
|
||||
~ScopedTransaction();
|
||||
EXPORT ScopedTransaction(Connection &connection);
|
||||
EXPORT ~ScopedTransaction();
|
||||
|
||||
void Cancel() noexcept;
|
||||
void CommitAndRestart();
|
||||
EXPORT void Cancel() noexcept;
|
||||
EXPORT void CommitAndRestart();
|
||||
|
||||
private:
|
||||
inline void Begin();
|
||||
|
@ -43,7 +43,7 @@ namespace musik { namespace core { namespace db {
|
||||
|
||||
namespace SqliteExtensions {
|
||||
|
||||
int Register(sqlite3* db);
|
||||
EXPORT int Register(sqlite3* db);
|
||||
|
||||
}
|
||||
|
||||
|
@ -47,26 +47,26 @@ namespace musik { namespace core { namespace db {
|
||||
public:
|
||||
DELETE_CLASS_DEFAULTS(Statement)
|
||||
|
||||
Statement(const char* sql, Connection &connection) noexcept;
|
||||
virtual ~Statement() noexcept;
|
||||
EXPORT Statement(const char* sql, Connection &connection) noexcept;
|
||||
EXPORT virtual ~Statement() noexcept;
|
||||
|
||||
void BindInt32(int position, int bindInt) noexcept;
|
||||
void BindInt64(int position, int64_t bindInt) noexcept;
|
||||
void BindFloat(int position, float bindFloat) noexcept;
|
||||
void BindText(int position, const std::string& bindText);
|
||||
void BindNull(int position) noexcept;
|
||||
EXPORT void BindInt32(int position, int bindInt) noexcept;
|
||||
EXPORT void BindInt64(int position, int64_t bindInt) noexcept;
|
||||
EXPORT void BindFloat(int position, float bindFloat) noexcept;
|
||||
EXPORT void BindText(int position, const std::string& bindText);
|
||||
EXPORT void BindNull(int position) noexcept;
|
||||
|
||||
const int ColumnInt32(int column) noexcept;
|
||||
const int64_t ColumnInt64(int column) noexcept;
|
||||
const float ColumnFloat(int column) noexcept;
|
||||
const char* ColumnText(int column) noexcept;
|
||||
const bool IsNull(int column) noexcept;
|
||||
EXPORT const int ColumnInt32(int column) noexcept;
|
||||
EXPORT const int64_t ColumnInt64(int column) noexcept;
|
||||
EXPORT const float ColumnFloat(int column) noexcept;
|
||||
EXPORT const char* ColumnText(int column) noexcept;
|
||||
EXPORT const bool IsNull(int column) noexcept;
|
||||
|
||||
int Step();
|
||||
EXPORT int Step();
|
||||
|
||||
void Reset() noexcept;
|
||||
void Unbind() noexcept;
|
||||
void ResetAndUnbind() noexcept;
|
||||
EXPORT void Reset() noexcept;
|
||||
EXPORT void Unbind() noexcept;
|
||||
EXPORT void ResetAndUnbind() noexcept;
|
||||
|
||||
private:
|
||||
friend class Connection;
|
||||
|
@ -45,41 +45,41 @@ namespace musik {
|
||||
public:
|
||||
class IBackend {
|
||||
public:
|
||||
virtual ~IBackend() { }
|
||||
virtual void verbose(const std::string& tag, const std::string& string) = 0;
|
||||
virtual void info(const std::string& tag, const std::string& string) = 0;
|
||||
virtual void warning(const std::string& tag, const std::string& string) = 0;
|
||||
virtual void error(const std::string& tag, const std::string& string) = 0;
|
||||
EXPORT virtual ~IBackend() { }
|
||||
EXPORT virtual void verbose(const std::string& tag, const std::string& string) = 0;
|
||||
EXPORT virtual void info(const std::string& tag, const std::string& string) = 0;
|
||||
EXPORT virtual void warning(const std::string& tag, const std::string& string) = 0;
|
||||
EXPORT virtual void error(const std::string& tag, const std::string& string) = 0;
|
||||
};
|
||||
|
||||
class FileBackend : public IBackend {
|
||||
public:
|
||||
FileBackend(const std::string& fn);
|
||||
FileBackend(FileBackend&& fn);
|
||||
virtual ~FileBackend() override;
|
||||
virtual void verbose(const std::string& tag, const std::string& string) override;
|
||||
virtual void info(const std::string& tag, const std::string& string) override;
|
||||
virtual void warning(const std::string& tag, const std::string& string) override;
|
||||
virtual void error(const std::string& tag, const std::string& string) override;
|
||||
EXPORT FileBackend(const std::string& fn);
|
||||
EXPORT FileBackend(FileBackend&& fn);
|
||||
EXPORT virtual ~FileBackend() override;
|
||||
EXPORT virtual void verbose(const std::string& tag, const std::string& string) override;
|
||||
EXPORT virtual void info(const std::string& tag, const std::string& string) override;
|
||||
EXPORT virtual void warning(const std::string& tag, const std::string& string) override;
|
||||
EXPORT virtual void error(const std::string& tag, const std::string& string) override;
|
||||
private:
|
||||
std::ofstream out;
|
||||
};
|
||||
|
||||
class SimpleFileBackend: public FileBackend {
|
||||
public:
|
||||
SimpleFileBackend();
|
||||
SimpleFileBackend(const std::string& fn) = delete;
|
||||
SimpleFileBackend(FileBackend&& fn) = delete;
|
||||
EXPORT SimpleFileBackend();
|
||||
EXPORT SimpleFileBackend(const std::string& fn) = delete;
|
||||
EXPORT SimpleFileBackend(FileBackend&& fn) = delete;
|
||||
};
|
||||
|
||||
class ConsoleBackend : public IBackend {
|
||||
public:
|
||||
ConsoleBackend();
|
||||
virtual ~ConsoleBackend() override;
|
||||
virtual void verbose(const std::string& tag, const std::string& string) override;
|
||||
virtual void info(const std::string& tag, const std::string& string) override;
|
||||
virtual void warning(const std::string& tag, const std::string& string) override;
|
||||
virtual void error(const std::string& tag, const std::string& string) override;
|
||||
EXPORT ConsoleBackend();
|
||||
EXPORT virtual ~ConsoleBackend() override;
|
||||
EXPORT virtual void verbose(const std::string& tag, const std::string& string) override;
|
||||
EXPORT virtual void info(const std::string& tag, const std::string& string) override;
|
||||
EXPORT virtual void warning(const std::string& tag, const std::string& string) override;
|
||||
EXPORT virtual void error(const std::string& tag, const std::string& string) override;
|
||||
};
|
||||
|
||||
static void Start(std::vector<IBackend*> backends = { new SimpleFileBackend() });
|
||||
|
@ -49,23 +49,23 @@ namespace musik { namespace core { namespace i18n {
|
||||
public:
|
||||
sigslot::signal1<std::string> LocaleChanged;
|
||||
|
||||
~Locale();
|
||||
EXPORT ~Locale();
|
||||
|
||||
static Locale& Instance() {
|
||||
EXPORT static Locale& Instance() {
|
||||
static Locale instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void Initialize(const std::string& localePath);
|
||||
EXPORT void Initialize(const std::string& localePath);
|
||||
|
||||
std::vector<std::string> GetLocales();
|
||||
std::string GetSelectedLocale();
|
||||
bool SetSelectedLocale(const std::string& locale);
|
||||
EXPORT std::vector<std::string> GetLocales();
|
||||
EXPORT std::string GetSelectedLocale();
|
||||
EXPORT bool SetSelectedLocale(const std::string& locale);
|
||||
|
||||
std::string Translate(const std::string& key);
|
||||
std::string Translate(const char* key);
|
||||
EXPORT std::string Translate(const std::string& key);
|
||||
EXPORT std::string Translate(const char* key);
|
||||
|
||||
int Dimension(const char* key, int defaultValue);
|
||||
EXPORT int Dimension(const char* key, int defaultValue);
|
||||
|
||||
private:
|
||||
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS(Locale)
|
||||
|
@ -45,8 +45,8 @@ namespace musik { namespace core { namespace io {
|
||||
using DataStreamPtr = std::shared_ptr<musik::core::sdk::IDataStream>;
|
||||
using OpenFlags = musik::core::sdk::OpenFlags;
|
||||
|
||||
static DataStreamPtr OpenSharedDataStream(const char *uri, OpenFlags flags);
|
||||
static musik::core::sdk::IDataStream* OpenDataStream(const char* uri, OpenFlags flags);
|
||||
EXPORT static DataStreamPtr OpenSharedDataStream(const char *uri, OpenFlags flags);
|
||||
EXPORT static musik::core::sdk::IDataStream* OpenDataStream(const char* uri, OpenFlags flags);
|
||||
|
||||
private:
|
||||
typedef std::vector<std::shared_ptr<musik::core::sdk::IDataStreamFactory> > DataStreamFactoryVector;
|
||||
|
@ -47,25 +47,25 @@ namespace musik { namespace core { namespace io {
|
||||
|
||||
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS(LocalFileStream)
|
||||
|
||||
LocalFileStream() noexcept;
|
||||
virtual ~LocalFileStream() noexcept;
|
||||
EXPORT LocalFileStream() noexcept;
|
||||
EXPORT virtual ~LocalFileStream() noexcept;
|
||||
|
||||
bool Open(const char *filename, OpenFlags flags) override;
|
||||
bool Close() noexcept override;
|
||||
void Interrupt() noexcept override;
|
||||
void Release() noexcept override;
|
||||
bool Readable() noexcept override { return (flags & OpenFlags::Read) != 0; }
|
||||
bool Writable() noexcept override { return (flags & OpenFlags::Write) != 0; }
|
||||
PositionType Read(void* buffer, PositionType readBytes) noexcept override;
|
||||
PositionType Write(void* buffer, PositionType writeBytes) noexcept override;
|
||||
bool SetPosition(PositionType position) noexcept override;
|
||||
PositionType Position() noexcept override;
|
||||
bool Eof() noexcept override;
|
||||
long Length() noexcept override;
|
||||
bool Seekable() noexcept override;
|
||||
const char* Type() noexcept override;
|
||||
const char* Uri() noexcept override;
|
||||
bool CanPrefetch() noexcept override { return true; }
|
||||
EXPORT bool Open(const char *filename, OpenFlags flags) override;
|
||||
EXPORT bool Close() noexcept override;
|
||||
EXPORT void Interrupt() noexcept override;
|
||||
EXPORT void Release() noexcept override;
|
||||
EXPORT bool Readable() noexcept override { return (flags & OpenFlags::Read) != 0; }
|
||||
EXPORT bool Writable() noexcept override { return (flags & OpenFlags::Write) != 0; }
|
||||
EXPORT PositionType Read(void* buffer, PositionType readBytes) noexcept override;
|
||||
EXPORT PositionType Write(void* buffer, PositionType writeBytes) noexcept override;
|
||||
EXPORT bool SetPosition(PositionType position) noexcept override;
|
||||
EXPORT PositionType Position() noexcept override;
|
||||
EXPORT bool Eof() noexcept override;
|
||||
EXPORT long Length() noexcept override;
|
||||
EXPORT bool Seekable() noexcept override;
|
||||
EXPORT const char* Type() noexcept override;
|
||||
EXPORT const char* Uri() noexcept override;
|
||||
EXPORT bool CanPrefetch() noexcept override { return true; }
|
||||
|
||||
private:
|
||||
OpenFlags flags { OpenFlags::None };
|
||||
|
@ -59,12 +59,12 @@ namespace musik { namespace core {
|
||||
Sources = 3
|
||||
};
|
||||
|
||||
virtual ~IIndexer() { }
|
||||
virtual void AddPath(const std::string& path) = 0;
|
||||
virtual void RemovePath(const std::string& path) = 0;
|
||||
virtual void GetPaths(std::vector<std::string>& paths) = 0;
|
||||
virtual void Schedule(SyncType type) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual State GetState() = 0;
|
||||
EXPORT virtual ~IIndexer() { }
|
||||
EXPORT virtual void AddPath(const std::string& path) = 0;
|
||||
EXPORT virtual void RemovePath(const std::string& path) = 0;
|
||||
EXPORT virtual void GetPaths(std::vector<std::string>& paths) = 0;
|
||||
EXPORT virtual void Schedule(SyncType type) = 0;
|
||||
EXPORT virtual void Shutdown() = 0;
|
||||
EXPORT virtual State GetState() = 0;
|
||||
};
|
||||
} }
|
||||
|
@ -68,7 +68,7 @@ namespace musik { namespace core {
|
||||
|
||||
class IResourceLocator {
|
||||
public:
|
||||
virtual std::string GetTrackUri(
|
||||
EXPORT virtual std::string GetTrackUri(
|
||||
musik::core::sdk::ITrack* track,
|
||||
const std::string& defaultUri = "") = 0;
|
||||
};
|
||||
@ -76,20 +76,20 @@ namespace musik { namespace core {
|
||||
sigslot::signal1<musik::core::db::IQuery*> QueryCompleted;
|
||||
sigslot::signal1<ConnectionState> ConnectionStateChanged;
|
||||
|
||||
virtual ~ILibrary() { }
|
||||
EXPORT virtual ~ILibrary() { }
|
||||
|
||||
virtual int Enqueue(QueryPtr query, Callback cb = Callback()) = 0;
|
||||
virtual int EnqueueAndWait(QueryPtr query, size_t timeoutMs = kWaitIndefinite, Callback cb = Callback()) = 0;
|
||||
virtual IIndexer *Indexer() = 0;
|
||||
virtual int Id() = 0;
|
||||
virtual const std::string& Name() = 0;
|
||||
virtual void SetMessageQueue(musik::core::runtime::IMessageQueue& queue) = 0;
|
||||
virtual musik::core::runtime::IMessageQueue& GetMessageQueue() = 0;
|
||||
virtual IResourceLocator& GetResourceLocator() = 0;
|
||||
virtual bool IsConfigured() = 0;
|
||||
virtual ConnectionState GetConnectionState() const = 0;
|
||||
virtual Type GetType() const = 0;
|
||||
virtual void Close() = 0;
|
||||
EXPORT virtual int Enqueue(QueryPtr query, Callback cb = Callback()) = 0;
|
||||
EXPORT virtual int EnqueueAndWait(QueryPtr query, size_t timeoutMs = kWaitIndefinite, Callback cb = Callback()) = 0;
|
||||
EXPORT virtual IIndexer *Indexer() = 0;
|
||||
EXPORT virtual int Id() = 0;
|
||||
EXPORT virtual const std::string& Name() = 0;
|
||||
EXPORT virtual void SetMessageQueue(musik::core::runtime::IMessageQueue& queue) = 0;
|
||||
EXPORT virtual musik::core::runtime::IMessageQueue& GetMessageQueue() = 0;
|
||||
EXPORT virtual IResourceLocator& GetResourceLocator() = 0;
|
||||
EXPORT virtual bool IsConfigured() = 0;
|
||||
EXPORT virtual ConnectionState GetConnectionState() const = 0;
|
||||
EXPORT virtual Type GetType() const = 0;
|
||||
EXPORT virtual void Close() = 0;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<ILibrary> ILibraryPtr;
|
||||
|
@ -56,24 +56,24 @@ namespace musik { namespace core { namespace db {
|
||||
|
||||
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS_WITH_DEFAULT_CTOR(IQuery)
|
||||
|
||||
virtual ~IQuery() { }
|
||||
EXPORT virtual ~IQuery() { }
|
||||
|
||||
virtual int GetStatus() = 0;
|
||||
virtual int GetId() = 0;
|
||||
virtual int GetOptions() = 0;
|
||||
virtual std::string Name() = 0;
|
||||
EXPORT virtual int GetStatus() = 0;
|
||||
EXPORT virtual int GetId() = 0;
|
||||
EXPORT virtual int GetOptions() = 0;
|
||||
EXPORT virtual std::string Name() = 0;
|
||||
};
|
||||
|
||||
class ISerializableQuery: public IQuery {
|
||||
public:
|
||||
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS_WITH_DEFAULT_CTOR(ISerializableQuery)
|
||||
|
||||
virtual ~ISerializableQuery() { }
|
||||
EXPORT virtual ~ISerializableQuery() { }
|
||||
|
||||
virtual std::string SerializeQuery() = 0;
|
||||
virtual std::string SerializeResult() = 0;
|
||||
virtual void DeserializeResult(const std::string& data) = 0;
|
||||
virtual void Invalidate() = 0;
|
||||
EXPORT virtual std::string SerializeQuery() = 0;
|
||||
EXPORT virtual std::string SerializeResult() = 0;
|
||||
EXPORT virtual void DeserializeResult(const std::string& data) = 0;
|
||||
EXPORT virtual void Invalidate() = 0;
|
||||
};
|
||||
|
||||
} } }
|
||||
|
@ -65,40 +65,40 @@ namespace musik { namespace core {
|
||||
public musik::core::sdk::IIndexerNotifier
|
||||
{
|
||||
public:
|
||||
Indexer(
|
||||
EXPORT Indexer(
|
||||
const std::string& libraryPath,
|
||||
const std::string& dbFilename);
|
||||
|
||||
Indexer(const Indexer&) = delete;
|
||||
EXPORT Indexer(const Indexer&) = delete;
|
||||
|
||||
virtual ~Indexer();
|
||||
EXPORT virtual ~Indexer();
|
||||
|
||||
/* IIndexer */
|
||||
void AddPath(const std::string& path) override;
|
||||
void RemovePath(const std::string& path) override;
|
||||
void GetPaths(std::vector<std::string>& paths) override;
|
||||
void Schedule(SyncType type) override;
|
||||
void Shutdown() override;
|
||||
EXPORT void AddPath(const std::string& path) override;
|
||||
EXPORT void RemovePath(const std::string& path) override;
|
||||
EXPORT void GetPaths(std::vector<std::string>& paths) override;
|
||||
EXPORT void Schedule(SyncType type) override;
|
||||
EXPORT void Shutdown() override;
|
||||
|
||||
State GetState() noexcept override {
|
||||
EXPORT State GetState() noexcept override {
|
||||
return this->state;
|
||||
}
|
||||
|
||||
/* IIndexerWriter */
|
||||
musik::core::sdk::ITagStore* CreateWriter() override;
|
||||
bool RemoveByUri(musik::core::sdk::IIndexerSource* source, const char* uri) override;
|
||||
bool RemoveByExternalId(musik::core::sdk::IIndexerSource* source, const char* id) override;
|
||||
int RemoveAll(musik::core::sdk::IIndexerSource* source) override;
|
||||
void CommitProgress(musik::core::sdk::IIndexerSource* source, unsigned updatedTracks) override;
|
||||
int64_t GetLastModifiedTime(musik::core::sdk::IIndexerSource* source, const char* id) override;
|
||||
EXPORT musik::core::sdk::ITagStore* CreateWriter() override;
|
||||
EXPORT bool RemoveByUri(musik::core::sdk::IIndexerSource* source, const char* uri) override;
|
||||
EXPORT bool RemoveByExternalId(musik::core::sdk::IIndexerSource* source, const char* id) override;
|
||||
EXPORT int RemoveAll(musik::core::sdk::IIndexerSource* source) override;
|
||||
EXPORT void CommitProgress(musik::core::sdk::IIndexerSource* source, unsigned updatedTracks) override;
|
||||
EXPORT int64_t GetLastModifiedTime(musik::core::sdk::IIndexerSource* source, const char* id) override;
|
||||
|
||||
bool Save(
|
||||
EXPORT bool Save(
|
||||
musik::core::sdk::IIndexerSource* source,
|
||||
musik::core::sdk::ITagStore* store,
|
||||
const char* externalId = "") override;
|
||||
|
||||
/* IIndexerNotifier */
|
||||
void ScheduleRescan(musik::core::sdk::IIndexerSource* source) override;
|
||||
EXPORT void ScheduleRescan(musik::core::sdk::IIndexerSource* source) override;
|
||||
|
||||
private:
|
||||
struct AddRemoveContext {
|
||||
|
@ -53,20 +53,20 @@ namespace musik { namespace core {
|
||||
|
||||
LibrariesUpdatedEvent LibrariesUpdated;
|
||||
|
||||
~LibraryFactory();
|
||||
EXPORT ~LibraryFactory();
|
||||
|
||||
static void Initialize(IMessageQueue& messageQueue);
|
||||
static LibraryFactory& Instance();
|
||||
static void Shutdown();
|
||||
|
||||
ILibraryPtr DefaultLocalLibrary();
|
||||
ILibraryPtr DefaultRemoteLibrary();
|
||||
ILibraryPtr DefaultLibrary(ILibrary::Type type);
|
||||
EXPORT ILibraryPtr DefaultLocalLibrary();
|
||||
EXPORT ILibraryPtr DefaultRemoteLibrary();
|
||||
EXPORT ILibraryPtr DefaultLibrary(ILibrary::Type type);
|
||||
|
||||
LibraryVector Libraries();
|
||||
ILibraryPtr CreateLibrary(const std::string& name, ILibrary::Type type);
|
||||
EXPORT LibraryVector Libraries();
|
||||
EXPORT ILibraryPtr CreateLibrary(const std::string& name, ILibrary::Type type);
|
||||
|
||||
ILibraryPtr GetLibrary(int identifier);
|
||||
EXPORT ILibraryPtr GetLibrary(int identifier);
|
||||
|
||||
private:
|
||||
LibraryFactory();
|
||||
|
@ -64,31 +64,31 @@ namespace musik { namespace core { namespace library {
|
||||
|
||||
static ILibraryPtr Create(std::string name, int id, MessageQueue* messageQueue);
|
||||
|
||||
LocalLibrary(const LocalLibrary&) = delete;
|
||||
virtual ~LocalLibrary();
|
||||
EXPORT LocalLibrary(const LocalLibrary&) = delete;
|
||||
EXPORT virtual ~LocalLibrary();
|
||||
|
||||
/* ILibrary */
|
||||
int Enqueue(QueryPtr query, Callback cb = Callback()) override;
|
||||
int EnqueueAndWait(QueryPtr query, size_t timeoutMs = kWaitIndefinite, Callback cb = Callback()) override;
|
||||
IIndexer *Indexer() override;
|
||||
int Id() override;
|
||||
const std::string& Name() override;
|
||||
void SetMessageQueue(musik::core::runtime::IMessageQueue& queue) override;
|
||||
MessageQueue& GetMessageQueue() override { return *messageQueue; }
|
||||
IResourceLocator& GetResourceLocator() override;
|
||||
bool IsConfigured() override;
|
||||
ConnectionState GetConnectionState() const override { return ConnectionState::Connected; }
|
||||
Type GetType() const override { return Type::Local; }
|
||||
void Close() override;
|
||||
EXPORT int Enqueue(QueryPtr query, Callback cb = Callback()) override;
|
||||
EXPORT int EnqueueAndWait(QueryPtr query, size_t timeoutMs = kWaitIndefinite, Callback cb = Callback()) override;
|
||||
EXPORT IIndexer *Indexer() override;
|
||||
EXPORT int Id() override;
|
||||
EXPORT const std::string& Name() override;
|
||||
EXPORT void SetMessageQueue(musik::core::runtime::IMessageQueue& queue) override;
|
||||
EXPORT MessageQueue& GetMessageQueue() override { return *messageQueue; }
|
||||
EXPORT IResourceLocator& GetResourceLocator() override;
|
||||
EXPORT bool IsConfigured() override;
|
||||
EXPORT ConnectionState GetConnectionState() const override { return ConnectionState::Connected; }
|
||||
EXPORT Type GetType() const override { return Type::Local; }
|
||||
EXPORT void Close() override;
|
||||
|
||||
/* IMessageTarget */
|
||||
void ProcessMessage(musik::core::runtime::IMessage &message) override;
|
||||
EXPORT void ProcessMessage(musik::core::runtime::IMessage &message) override;
|
||||
|
||||
/* implementation specific */
|
||||
db::Connection& GetConnection() { return this->db; }
|
||||
std::string GetLibraryDirectory();
|
||||
std::string GetDatabaseFilename();
|
||||
static void CreateDatabase(db::Connection &db);
|
||||
EXPORT db::Connection& GetConnection() { return this->db; }
|
||||
EXPORT std::string GetLibraryDirectory();
|
||||
EXPORT std::string GetDatabaseFilename();
|
||||
EXPORT static void CreateDatabase(db::Connection &db);
|
||||
|
||||
/* indexes */
|
||||
static void DropIndexes(db::Connection &db);
|
||||
|
@ -43,19 +43,19 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
public:
|
||||
LocalMetadataProxy(musik::core::ILibraryPtr library);
|
||||
|
||||
musik::core::sdk::ITrackList*
|
||||
EXPORT musik::core::sdk::ITrackList*
|
||||
QueryTracks(
|
||||
const char* query = "",
|
||||
int limit = -1,
|
||||
int offset = 0) override;
|
||||
|
||||
musik::core::sdk::ITrack*
|
||||
EXPORT musik::core::sdk::ITrack*
|
||||
QueryTrackById(int64_t trackId) override;
|
||||
|
||||
musik::core::sdk::ITrack*
|
||||
EXPORT musik::core::sdk::ITrack*
|
||||
QueryTrackByExternalId(const char* externalId) override;
|
||||
|
||||
musik::core::sdk::ITrackList*
|
||||
EXPORT musik::core::sdk::ITrackList*
|
||||
QueryTracksByCategory(
|
||||
const char* categoryType,
|
||||
int64_t selectedId,
|
||||
@ -63,7 +63,7 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
int limit = -1,
|
||||
int offset = 0) override;
|
||||
|
||||
musik::core::sdk::ITrackList*
|
||||
EXPORT musik::core::sdk::ITrackList*
|
||||
QueryTracksByCategories(
|
||||
musik::core::sdk::IValue** categories,
|
||||
size_t categoryCount,
|
||||
@ -71,91 +71,91 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
int limit = -1,
|
||||
int offset = 0) override;
|
||||
|
||||
musik::core::sdk::ITrackList* QueryTracksByExternalId(
|
||||
EXPORT musik::core::sdk::ITrackList* QueryTracksByExternalId(
|
||||
const char** externalIds, size_t externalIdCount) override;
|
||||
|
||||
musik::core::sdk::IValueList* ListCategories() override;
|
||||
EXPORT musik::core::sdk::IValueList* ListCategories() override;
|
||||
|
||||
musik::core::sdk::IValueList*
|
||||
EXPORT musik::core::sdk::IValueList*
|
||||
QueryCategory(
|
||||
const char* type,
|
||||
const char* filter = "") override;
|
||||
|
||||
musik::core::sdk::IValueList*
|
||||
EXPORT musik::core::sdk::IValueList*
|
||||
QueryCategoryWithPredicate(
|
||||
const char* type,
|
||||
const char* predicateType,
|
||||
int64_t predicateId,
|
||||
const char* filter = "") override;
|
||||
|
||||
musik::core::sdk::IValueList*
|
||||
EXPORT musik::core::sdk::IValueList*
|
||||
QueryCategoryWithPredicates(
|
||||
const char* type,
|
||||
musik::core::sdk::IValue** predicates,
|
||||
size_t predicateCount,
|
||||
const char* filter = "") override;
|
||||
|
||||
musik::core::sdk::IMapList*
|
||||
EXPORT musik::core::sdk::IMapList*
|
||||
QueryAlbums(const char* filter = "") override;
|
||||
|
||||
musik::core::sdk::IMapList* QueryAlbums(
|
||||
EXPORT musik::core::sdk::IMapList* QueryAlbums(
|
||||
const char* categoryIdName,
|
||||
int64_t categoryIdValue,
|
||||
const char* filter = "") override;
|
||||
|
||||
int64_t SavePlaylistWithIds(
|
||||
EXPORT int64_t SavePlaylistWithIds(
|
||||
int64_t* trackIds,
|
||||
size_t trackIdCount,
|
||||
const char* name,
|
||||
const int64_t playlistId = 0) override;
|
||||
|
||||
int64_t SavePlaylistWithExternalIds(
|
||||
EXPORT int64_t SavePlaylistWithExternalIds(
|
||||
const char** externalIds,
|
||||
size_t externalIdCount,
|
||||
const char* playlistName,
|
||||
const int64_t playlistId = 0) override;
|
||||
|
||||
int64_t SavePlaylistWithTrackList(
|
||||
EXPORT int64_t SavePlaylistWithTrackList(
|
||||
musik::core::sdk::ITrackList* trackList,
|
||||
const char* playlistName,
|
||||
const int64_t playlistId = 0) override;
|
||||
|
||||
bool RenamePlaylist(
|
||||
EXPORT bool RenamePlaylist(
|
||||
const int64_t playlistId,
|
||||
const char* name) override;
|
||||
|
||||
bool DeletePlaylist(const int64_t playlistId) override;
|
||||
EXPORT bool DeletePlaylist(const int64_t playlistId) override;
|
||||
|
||||
bool AppendToPlaylistWithIds(
|
||||
EXPORT bool AppendToPlaylistWithIds(
|
||||
const int64_t playlistId,
|
||||
const int64_t* trackIds,
|
||||
size_t trackIdCount,
|
||||
int offset = -1) override;
|
||||
|
||||
bool AppendToPlaylistWithExternalIds(
|
||||
EXPORT bool AppendToPlaylistWithExternalIds(
|
||||
const int64_t playlistId,
|
||||
const char** externalIds,
|
||||
size_t externalIdCount,
|
||||
int offset = -1) override;
|
||||
|
||||
bool AppendToPlaylistWithTrackList(
|
||||
EXPORT bool AppendToPlaylistWithTrackList(
|
||||
const int64_t playlistId,
|
||||
musik::core::sdk::ITrackList* trackList,
|
||||
int offset = -1) override;
|
||||
|
||||
size_t RemoveTracksFromPlaylist(
|
||||
EXPORT size_t RemoveTracksFromPlaylist(
|
||||
const int64_t playlistId,
|
||||
const char** externalIds,
|
||||
const int* sortOrders,
|
||||
int count) override;
|
||||
|
||||
bool SendRawQuery(
|
||||
EXPORT bool SendRawQuery(
|
||||
const char* query,
|
||||
musik::core::sdk::IAllocator& allocator,
|
||||
char** resultData,
|
||||
int* resultSize) override;
|
||||
|
||||
void Release() noexcept override;
|
||||
EXPORT void Release() noexcept override;
|
||||
|
||||
private:
|
||||
musik::core::ILibraryPtr library;
|
||||
|
@ -52,25 +52,25 @@ namespace musik { namespace core { namespace library {
|
||||
public:
|
||||
sigslot::signal2<ILibraryPtr, ILibraryPtr> LibraryChanged;
|
||||
|
||||
MasterLibrary();
|
||||
virtual ~MasterLibrary();
|
||||
EXPORT MasterLibrary();
|
||||
EXPORT virtual ~MasterLibrary();
|
||||
|
||||
int Enqueue(QueryPtr query, Callback cb = Callback()) override;
|
||||
int EnqueueAndWait(QueryPtr query, size_t timeoutMs = kWaitIndefinite, Callback cb = Callback()) override;
|
||||
musik::core::IIndexer *Indexer() override;
|
||||
int Id() override;
|
||||
const std::string& Name() override;
|
||||
void SetMessageQueue(musik::core::runtime::IMessageQueue& queue) override;
|
||||
musik::core::runtime::IMessageQueue& GetMessageQueue() override;
|
||||
IResourceLocator& GetResourceLocator() override;
|
||||
bool IsConfigured() override;
|
||||
ConnectionState GetConnectionState() const override;
|
||||
Type GetType() const override;
|
||||
void Close() override;
|
||||
EXPORT int Enqueue(QueryPtr query, Callback cb = Callback()) override;
|
||||
EXPORT int EnqueueAndWait(QueryPtr query, size_t timeoutMs = kWaitIndefinite, Callback cb = Callback()) override;
|
||||
EXPORT musik::core::IIndexer *Indexer() override;
|
||||
EXPORT int Id() override;
|
||||
EXPORT const std::string& Name() override;
|
||||
EXPORT void SetMessageQueue(musik::core::runtime::IMessageQueue& queue) override;
|
||||
EXPORT musik::core::runtime::IMessageQueue& GetMessageQueue() override;
|
||||
EXPORT IResourceLocator& GetResourceLocator() override;
|
||||
EXPORT bool IsConfigured() override;
|
||||
EXPORT ConnectionState GetConnectionState() const override;
|
||||
EXPORT Type GetType() const override;
|
||||
EXPORT void Close() override;
|
||||
|
||||
ILibraryPtr Wrapped() const noexcept { return this->wrappedLibrary; }
|
||||
EXPORT ILibraryPtr Wrapped() const noexcept { return this->wrappedLibrary; }
|
||||
|
||||
void LoadDefaultLibrary();
|
||||
EXPORT void LoadDefaultLibrary();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -55,14 +55,14 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
Regex = 2
|
||||
};
|
||||
|
||||
QueryBase() noexcept
|
||||
EXPORT QueryBase() noexcept
|
||||
: status(IQuery::Idle)
|
||||
, options(0)
|
||||
, queryId(nextId())
|
||||
, cancel(false) {
|
||||
}
|
||||
|
||||
bool Run(musik::core::db::Connection &db) {
|
||||
EXPORT bool Run(musik::core::db::Connection &db) {
|
||||
this->SetStatus(Running);
|
||||
try {
|
||||
if (this->IsCanceled()) {
|
||||
@ -81,60 +81,60 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void Cancel() noexcept {
|
||||
EXPORT virtual void Cancel() noexcept {
|
||||
this->cancel = true;
|
||||
}
|
||||
|
||||
virtual bool IsCanceled() noexcept {
|
||||
EXPORT virtual bool IsCanceled() noexcept {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
/* IQuery */
|
||||
|
||||
int GetStatus() override {
|
||||
EXPORT int GetStatus() override {
|
||||
std::unique_lock<std::mutex> lock(this->stateMutex);
|
||||
return this->status;
|
||||
}
|
||||
|
||||
int GetId() noexcept override {
|
||||
EXPORT int GetId() noexcept override {
|
||||
return this->queryId;
|
||||
}
|
||||
|
||||
int GetOptions() override {
|
||||
EXPORT int GetOptions() override {
|
||||
std::unique_lock<std::mutex> lock(this->stateMutex);
|
||||
return this->options;
|
||||
}
|
||||
|
||||
/* ISerializableQuery */
|
||||
|
||||
std::string SerializeQuery() override {
|
||||
EXPORT std::string SerializeQuery() override {
|
||||
throw std::runtime_error("not implemented");
|
||||
}
|
||||
|
||||
std::string SerializeResult() override {
|
||||
EXPORT std::string SerializeResult() override {
|
||||
throw std::runtime_error("not implemented");
|
||||
}
|
||||
|
||||
void DeserializeResult(const std::string& data) override {
|
||||
EXPORT void DeserializeResult(const std::string& data) override {
|
||||
throw std::runtime_error("not implemented");
|
||||
}
|
||||
|
||||
void Invalidate() override {
|
||||
EXPORT void Invalidate() override {
|
||||
this->SetStatus(IQuery::Failed);
|
||||
}
|
||||
|
||||
protected:
|
||||
void SetStatus(int status) {
|
||||
EXPORT void SetStatus(int status) {
|
||||
std::unique_lock<std::mutex> lock(this->stateMutex);
|
||||
this->status = status;
|
||||
}
|
||||
|
||||
void SetOptions(int options) {
|
||||
EXPORT void SetOptions(int options) {
|
||||
std::unique_lock<std::mutex> lock(this->stateMutex);
|
||||
this->options = options;
|
||||
}
|
||||
|
||||
virtual bool OnRun(musik::core::db::Connection& db) = 0;
|
||||
EXPORT virtual bool OnRun(musik::core::db::Connection& db) = 0;
|
||||
|
||||
private:
|
||||
static int nextId() noexcept {
|
||||
|
@ -42,10 +42,10 @@
|
||||
namespace musik { namespace core { namespace library {
|
||||
|
||||
namespace QueryRegistry {
|
||||
std::shared_ptr<musik::core::db::ISerializableQuery> CreateLocalQueryFor(
|
||||
EXPORT std::shared_ptr<musik::core::db::ISerializableQuery> CreateLocalQueryFor(
|
||||
const std::string& name, const std::string& data, musik::core::ILibraryPtr library);
|
||||
|
||||
bool IsLocalOnlyQuery(const std::string& queryName);
|
||||
EXPORT bool IsLocalOnlyQuery(const std::string& queryName);
|
||||
}
|
||||
|
||||
} } }
|
||||
|
@ -64,39 +64,39 @@ namespace musik { namespace core { namespace library {
|
||||
|
||||
static ILibraryPtr Create(std::string name, int id, MessageQueue* messageQueue);
|
||||
|
||||
RemoteLibrary(std::string name, int id, MessageQueue* messageQueue);
|
||||
RemoteLibrary(const RemoteLibrary&) = delete;
|
||||
virtual ~RemoteLibrary();
|
||||
EXPORT RemoteLibrary(std::string name, int id, MessageQueue* messageQueue);
|
||||
EXPORT RemoteLibrary(const RemoteLibrary&) = delete;
|
||||
EXPORT virtual ~RemoteLibrary();
|
||||
|
||||
/* ILibrary */
|
||||
int Enqueue(QueryPtr query, Callback = Callback()) override;
|
||||
int EnqueueAndWait(QueryPtr query, size_t timeoutMs = kWaitIndefinite, Callback = Callback()) override;
|
||||
musik::core::IIndexer *Indexer() override;
|
||||
int Id() override;
|
||||
const std::string& Name() override;
|
||||
void SetMessageQueue(musik::core::runtime::IMessageQueue& queue) override;
|
||||
musik::core::runtime::IMessageQueue& GetMessageQueue() noexcept override { return *messageQueue; }
|
||||
ILibrary::IResourceLocator& GetResourceLocator() noexcept override { return *this; }
|
||||
bool IsConfigured() override;
|
||||
ConnectionState GetConnectionState() const override { return this->connectionState; }
|
||||
Type GetType() const noexcept override { return Type::Remote; }
|
||||
void Close() override;
|
||||
EXPORT int Enqueue(QueryPtr query, Callback = Callback()) override;
|
||||
EXPORT int EnqueueAndWait(QueryPtr query, size_t timeoutMs = kWaitIndefinite, Callback = Callback()) override;
|
||||
EXPORT musik::core::IIndexer *Indexer() override;
|
||||
EXPORT int Id() override;
|
||||
EXPORT const std::string& Name() override;
|
||||
EXPORT void SetMessageQueue(musik::core::runtime::IMessageQueue& queue) override;
|
||||
EXPORT musik::core::runtime::IMessageQueue& GetMessageQueue() noexcept override { return *messageQueue; }
|
||||
EXPORT ILibrary::IResourceLocator& GetResourceLocator() noexcept override { return *this; }
|
||||
EXPORT bool IsConfigured() override;
|
||||
EXPORT ConnectionState GetConnectionState() const override { return this->connectionState; }
|
||||
EXPORT Type GetType() const noexcept override { return Type::Remote; }
|
||||
EXPORT void Close() override;
|
||||
|
||||
/* IMessageTarget */
|
||||
void ProcessMessage(musik::core::runtime::IMessage &message) override;
|
||||
EXPORT void ProcessMessage(musik::core::runtime::IMessage &message) override;
|
||||
|
||||
/* WebSocketClient::Listener */
|
||||
void OnClientInvalidPassword(Client* client) override;
|
||||
void OnClientStateChanged(Client* client, State newState, State oldState) override;
|
||||
void OnClientQuerySucceeded(Client* client, const std::string& messageId, Query query) override;
|
||||
void OnClientQueryFailed(Client* client, const std::string& messageId, Query query, Client::QueryError reason) override;
|
||||
EXPORT void OnClientInvalidPassword(Client* client) override;
|
||||
EXPORT void OnClientStateChanged(Client* client, State newState, State oldState) override;
|
||||
EXPORT void OnClientQuerySucceeded(Client* client, const std::string& messageId, Query query) override;
|
||||
EXPORT void OnClientQueryFailed(Client* client, const std::string& messageId, Query query, Client::QueryError reason) override;
|
||||
|
||||
/* IResourceLocator */
|
||||
std::string GetTrackUri(musik::core::sdk::ITrack* track, const std::string& defaultUri) override;
|
||||
EXPORT std::string GetTrackUri(musik::core::sdk::ITrack* track, const std::string& defaultUri) override;
|
||||
|
||||
/* RemoteLibrary */
|
||||
void ReloadConnectionFromPreferences();
|
||||
const musik::core::net::WebSocketClient& WebSocketClient() const;
|
||||
EXPORT void ReloadConnectionFromPreferences();
|
||||
EXPORT const musik::core::net::WebSocketClient& WebSocketClient() const;
|
||||
|
||||
private:
|
||||
class QueryCompletedMessage;
|
||||
|
@ -47,34 +47,34 @@ namespace musik { namespace core {
|
||||
public std::enable_shared_from_this<MetadataMap>
|
||||
{
|
||||
public:
|
||||
MetadataMap(
|
||||
EXPORT MetadataMap(
|
||||
int64_t id,
|
||||
const std::string& value,
|
||||
const std::string& type);
|
||||
|
||||
virtual ~MetadataMap();
|
||||
EXPORT virtual ~MetadataMap();
|
||||
|
||||
/* IResource */
|
||||
virtual int64_t GetId();
|
||||
virtual musik::core::sdk::IResource::Class GetClass();
|
||||
virtual const char* GetType();
|
||||
EXPORT virtual int64_t GetId();
|
||||
EXPORT virtual musik::core::sdk::IResource::Class GetClass();
|
||||
EXPORT virtual const char* GetType();
|
||||
|
||||
/* IValue */
|
||||
virtual size_t GetValue(char* dst, size_t size);
|
||||
EXPORT virtual size_t GetValue(char* dst, size_t size);
|
||||
|
||||
/* IMap */
|
||||
virtual void Release();
|
||||
virtual int GetString(const char* key, char* dst, int size);
|
||||
virtual long long GetInt64(const char* key, long long defaultValue = 0LL);
|
||||
virtual int GetInt32(const char* key, unsigned int defaultValue = 0);
|
||||
virtual double GetDouble(const char* key, double defaultValue = 0.0f);
|
||||
EXPORT virtual void Release();
|
||||
EXPORT virtual int GetString(const char* key, char* dst, int size);
|
||||
EXPORT virtual long long GetInt64(const char* key, long long defaultValue = 0LL);
|
||||
EXPORT virtual int GetInt32(const char* key, unsigned int defaultValue = 0);
|
||||
EXPORT virtual double GetDouble(const char* key, double defaultValue = 0.0f);
|
||||
|
||||
/* implementation specific */
|
||||
void Set(const char* key, const std::string& value);
|
||||
std::string Get(const char* key);
|
||||
std::string GetTypeValue();
|
||||
musik::core::sdk::IMap* GetSdkValue();
|
||||
void Each(std::function<void(const std::string&, const std::string&)> callback);
|
||||
EXPORT void Set(const char* key, const std::string& value);
|
||||
EXPORT std::string Get(const char* key);
|
||||
EXPORT std::string GetTypeValue();
|
||||
EXPORT musik::core::sdk::IMap* GetSdkValue();
|
||||
EXPORT void Each(std::function<void(const std::string&, const std::string&)> callback);
|
||||
|
||||
private:
|
||||
int64_t id;
|
||||
|
@ -46,20 +46,20 @@ namespace musik { namespace core {
|
||||
public std::enable_shared_from_this<MetadataMapList>
|
||||
{
|
||||
public:
|
||||
MetadataMapList();
|
||||
virtual ~MetadataMapList();
|
||||
EXPORT MetadataMapList();
|
||||
EXPORT virtual ~MetadataMapList();
|
||||
|
||||
/* IMapList */
|
||||
virtual void Release();
|
||||
virtual size_t Count() const;
|
||||
virtual musik::core::sdk::IMap* GetAt(size_t index) const;
|
||||
EXPORT virtual void Release();
|
||||
EXPORT virtual size_t Count() const;
|
||||
EXPORT virtual musik::core::sdk::IMap* GetAt(size_t index) const;
|
||||
|
||||
/* implementation specific */
|
||||
void Clear();
|
||||
void Add(MetadataMapPtr entry);
|
||||
EXPORT void Clear();
|
||||
EXPORT void Add(MetadataMapPtr entry);
|
||||
|
||||
musik::core::sdk::IMapList* GetSdkValue();
|
||||
MetadataMapPtr GetSharedAt(size_t index) const;
|
||||
EXPORT musik::core::sdk::IMapList* GetSdkValue();
|
||||
EXPORT MetadataMapPtr GetSharedAt(size_t index) const;
|
||||
|
||||
private:
|
||||
std::vector<MetadataMapPtr> entries;
|
||||
|
@ -44,44 +44,44 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class AlbumListQuery : public musik::core::library::query::QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS(AlbumListQuery)
|
||||
|
||||
AlbumListQuery(
|
||||
EXPORT AlbumListQuery(
|
||||
const std::string& filter = "");
|
||||
|
||||
AlbumListQuery(
|
||||
EXPORT AlbumListQuery(
|
||||
const std::string& fieldIdName,
|
||||
int64_t fieldIdValue,
|
||||
const std::string& filter = "");
|
||||
|
||||
AlbumListQuery(
|
||||
EXPORT AlbumListQuery(
|
||||
const category::Predicate predicate,
|
||||
const std::string& filter = "");
|
||||
|
||||
AlbumListQuery(
|
||||
EXPORT AlbumListQuery(
|
||||
const category::PredicateList predicates,
|
||||
const std::string& filter = "");
|
||||
|
||||
virtual ~AlbumListQuery();
|
||||
EXPORT virtual ~AlbumListQuery();
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
musik::core::MetadataMapListPtr GetResult() noexcept;
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
EXPORT musik::core::MetadataMapListPtr GetResult() noexcept;
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<AlbumListQuery> DeserializeQuery(const std::string& data);
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<AlbumListQuery> DeserializeQuery(const std::string& data);
|
||||
|
||||
/* AlbumListQuery */
|
||||
musik::core::sdk::IMapList* GetSdkResult();
|
||||
EXPORT musik::core::sdk::IMapList* GetSdkResult();
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
std::string filter;
|
||||
category::PredicateList regular, extended;
|
||||
|
@ -43,29 +43,29 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class AllCategoriesQuery : public musik::core::library::query::QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
using Result = SdkValueList::Shared;
|
||||
|
||||
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS(AllCategoriesQuery)
|
||||
|
||||
AllCategoriesQuery();
|
||||
EXPORT AllCategoriesQuery();
|
||||
|
||||
virtual Result GetResult() noexcept;
|
||||
musik::core::sdk::IValueList* GetSdkResult();
|
||||
EXPORT virtual Result GetResult() noexcept;
|
||||
EXPORT musik::core::sdk::IValueList* GetSdkResult();
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<AllCategoriesQuery> DeserializeQuery(const std::string& data);
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<AllCategoriesQuery> DeserializeQuery(const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
private:
|
||||
Result result;
|
||||
|
@ -43,35 +43,35 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class AppendPlaylistQuery : public musik::core::library::query::QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_CLASS_DEFAULTS(AppendPlaylistQuery)
|
||||
|
||||
AppendPlaylistQuery(
|
||||
EXPORT AppendPlaylistQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
const int64_t playlistId,
|
||||
std::shared_ptr<musik::core::TrackList> tracks,
|
||||
const int offset = -1) noexcept;
|
||||
|
||||
AppendPlaylistQuery(
|
||||
EXPORT AppendPlaylistQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
const int64_t playlistId,
|
||||
musik::core::sdk::ITrackList *tracks,
|
||||
const int offset = -1) noexcept;
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<AppendPlaylistQuery> DeserializeQuery(
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<AppendPlaylistQuery> DeserializeQuery(
|
||||
musik::core::ILibraryPtr library, const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
private:
|
||||
void SendPlaylistMutationBroadcast();
|
||||
|
@ -47,45 +47,45 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class CategoryListQuery : public musik::core::library::query::QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
using Result = SdkValueList::Shared;
|
||||
|
||||
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS_WITH_DEFAULT_CTOR(CategoryListQuery)
|
||||
|
||||
CategoryListQuery(
|
||||
EXPORT CategoryListQuery(
|
||||
MatchType matchType,
|
||||
const std::string& trackField,
|
||||
const std::string& filter = "");
|
||||
|
||||
CategoryListQuery(
|
||||
EXPORT CategoryListQuery(
|
||||
MatchType matchType,
|
||||
const std::string& trackField,
|
||||
const category::Predicate predicate,
|
||||
const std::string& filter = "");
|
||||
|
||||
CategoryListQuery(
|
||||
EXPORT CategoryListQuery(
|
||||
MatchType matchType,
|
||||
const std::string& trackField,
|
||||
const category::PredicateList predicate,
|
||||
const std::string& filter = "");
|
||||
|
||||
Result GetResult() noexcept;
|
||||
int GetIndexOf(int64_t id);
|
||||
musik::core::sdk::IValueList* GetSdkResult();
|
||||
EXPORT Result GetResult() noexcept;
|
||||
EXPORT int GetIndexOf(int64_t id);
|
||||
EXPORT musik::core::sdk::IValueList* GetSdkResult();
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<CategoryListQuery> DeserializeQuery(const std::string& data);
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<CategoryListQuery> DeserializeQuery(const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
enum class OutputType: int {
|
||||
Regular = 1,
|
||||
|
@ -47,53 +47,53 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class CategoryTrackListQuery : public TrackListQueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_CLASS_DEFAULTS(CategoryTrackListQuery)
|
||||
|
||||
CategoryTrackListQuery(
|
||||
EXPORT CategoryTrackListQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& filter = "",
|
||||
TrackSortType sortType = TrackSortType::Album);
|
||||
|
||||
CategoryTrackListQuery(
|
||||
EXPORT CategoryTrackListQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& column,
|
||||
int64_t id,
|
||||
const std::string& filter = "",
|
||||
TrackSortType sortType = TrackSortType::Album);
|
||||
|
||||
CategoryTrackListQuery(
|
||||
EXPORT CategoryTrackListQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
const category::Predicate predicate,
|
||||
const std::string& filter = "",
|
||||
TrackSortType sortType = TrackSortType::Album);
|
||||
|
||||
CategoryTrackListQuery(
|
||||
EXPORT CategoryTrackListQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
const category::PredicateList predicates,
|
||||
const std::string& filter = "",
|
||||
TrackSortType sortType = TrackSortType::Album);
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* TrackListQueryBase */
|
||||
Result GetResult() noexcept override;
|
||||
Headers GetHeaders() noexcept override;
|
||||
Durations GetDurations() noexcept override;
|
||||
size_t GetQueryHash() noexcept override;
|
||||
EXPORT Result GetResult() noexcept override;
|
||||
EXPORT Headers GetHeaders() noexcept override;
|
||||
EXPORT Durations GetDurations() noexcept override;
|
||||
EXPORT size_t GetQueryHash() noexcept override;
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<CategoryTrackListQuery> DeserializeQuery(
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<CategoryTrackListQuery> DeserializeQuery(
|
||||
musik::core::ILibraryPtr library, const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
private:
|
||||
enum class Type: int { Playlist = 0, Regular = 1 };
|
||||
|
@ -43,27 +43,27 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class DeletePlaylistQuery : public musik::core::library::query::QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_CLASS_DEFAULTS(DeletePlaylistQuery)
|
||||
|
||||
DeletePlaylistQuery(
|
||||
EXPORT DeletePlaylistQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
const int64_t playlistId) noexcept;
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<DeletePlaylistQuery> DeserializeQuery(
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<DeletePlaylistQuery> DeserializeQuery(
|
||||
musik::core::ILibraryPtr library, const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
private:
|
||||
void SendPlaylistMutationBroadcast();
|
||||
|
@ -41,34 +41,34 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class DirectoryTrackListQuery : public TrackListQueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS(DirectoryTrackListQuery)
|
||||
|
||||
DirectoryTrackListQuery(
|
||||
EXPORT DirectoryTrackListQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& directory,
|
||||
const std::string& filter = "");
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* TrackListQueryBase */
|
||||
Result GetResult() noexcept override { return this->result; }
|
||||
Headers GetHeaders() noexcept override { return this->headers; }
|
||||
size_t GetQueryHash() noexcept override { return this->hash; }
|
||||
Durations GetDurations() noexcept override { return this->durations; }
|
||||
EXPORT Result GetResult() noexcept override { return this->result; }
|
||||
EXPORT Headers GetHeaders() noexcept override { return this->headers; }
|
||||
EXPORT size_t GetQueryHash() noexcept override { return this->hash; }
|
||||
EXPORT Durations GetDurations() noexcept override { return this->durations; }
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<DirectoryTrackListQuery> DeserializeQuery(
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<DirectoryTrackListQuery> DeserializeQuery(
|
||||
musik::core::ILibraryPtr library, const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
private:
|
||||
musik::core::ILibraryPtr library;
|
||||
|
@ -44,35 +44,35 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class GetPlaylistQuery : public TrackListQueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_CLASS_DEFAULTS(GetPlaylistQuery)
|
||||
|
||||
GetPlaylistQuery(
|
||||
EXPORT GetPlaylistQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
int64_t playlistId);
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* TrackListQueryBase */
|
||||
Result GetResult() noexcept override;
|
||||
Headers GetHeaders() noexcept override;
|
||||
size_t GetQueryHash() noexcept override;
|
||||
Durations GetDurations() noexcept override {
|
||||
EXPORT Result GetResult() noexcept override;
|
||||
EXPORT Headers GetHeaders() noexcept override;
|
||||
EXPORT size_t GetQueryHash() noexcept override;
|
||||
EXPORT Durations GetDurations() noexcept override {
|
||||
return std::make_shared<std::map<size_t, size_t>>();
|
||||
}
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<GetPlaylistQuery> DeserializeQuery(
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<GetPlaylistQuery> DeserializeQuery(
|
||||
musik::core::ILibraryPtr library, const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
private:
|
||||
musik::core::ILibraryPtr library;
|
||||
|
@ -40,26 +40,26 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class LyricsQuery: public musik::core::library::query::QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_CLASS_DEFAULTS(LyricsQuery)
|
||||
|
||||
LyricsQuery(const std::string& trackExternalId);
|
||||
EXPORT LyricsQuery(const std::string& trackExternalId);
|
||||
|
||||
std::string GetResult();
|
||||
EXPORT std::string GetResult();
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<LyricsQuery> DeserializeQuery(const std::string& data);
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<LyricsQuery> DeserializeQuery(const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
std::string trackExternalId;
|
||||
std::string result;
|
||||
|
@ -40,24 +40,24 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class MarkTrackPlayedQuery: public QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_CLASS_DEFAULTS(MarkTrackPlayedQuery)
|
||||
|
||||
MarkTrackPlayedQuery(const int64_t trackId) noexcept;
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return "MarkTrackPlayedQuery"; }
|
||||
EXPORT std::string Name() override { return "MarkTrackPlayedQuery"; }
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<MarkTrackPlayedQuery> DeserializeQuery(const std::string& data);
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<MarkTrackPlayedQuery> DeserializeQuery(const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
private:
|
||||
int64_t trackId;
|
||||
|
@ -43,22 +43,22 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class NowPlayingTrackListQuery : public TrackListQueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_CLASS_DEFAULTS(NowPlayingTrackListQuery)
|
||||
|
||||
NowPlayingTrackListQuery(
|
||||
EXPORT NowPlayingTrackListQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
musik::core::audio::PlaybackService& playback);
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* TrackListQueryBase */
|
||||
Result GetResult() noexcept override;
|
||||
Headers GetHeaders() noexcept override;
|
||||
size_t GetQueryHash() noexcept override;
|
||||
Durations GetDurations() noexcept override {
|
||||
EXPORT Result GetResult() noexcept override;
|
||||
EXPORT Headers GetHeaders() noexcept override;
|
||||
EXPORT size_t GetQueryHash() noexcept override;
|
||||
EXPORT Durations GetDurations() noexcept override {
|
||||
return std::make_shared<std::map<size_t, size_t>>();
|
||||
}
|
||||
|
||||
|
@ -41,16 +41,16 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class PersistedPlayQueueQuery : public musik::core::library::query::QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
static PersistedPlayQueueQuery* Save(
|
||||
EXPORT static PersistedPlayQueueQuery* Save(
|
||||
musik::core::ILibraryPtr library,
|
||||
musik::core::audio::PlaybackService& playback)
|
||||
{
|
||||
return new PersistedPlayQueueQuery(library, playback, Type::Save);
|
||||
}
|
||||
|
||||
static PersistedPlayQueueQuery* Restore(
|
||||
EXPORT static PersistedPlayQueueQuery* Restore(
|
||||
musik::core::ILibraryPtr library,
|
||||
musik::core::audio::PlaybackService& playback)
|
||||
{
|
||||
@ -60,11 +60,11 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
DELETE_CLASS_DEFAULTS(PersistedPlayQueueQuery)
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
private:
|
||||
enum class Type { Save, Restore };
|
||||
|
@ -44,45 +44,45 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class SavePlaylistQuery : public musik::core::library::query::QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
static std::shared_ptr<SavePlaylistQuery> Save(
|
||||
EXPORT static std::shared_ptr<SavePlaylistQuery> Save(
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& playlistName,
|
||||
std::shared_ptr<musik::core::TrackList> tracks);
|
||||
|
||||
static std::shared_ptr<SavePlaylistQuery> Save(
|
||||
EXPORT static std::shared_ptr<SavePlaylistQuery> Save(
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& playlistName,
|
||||
musik::core::sdk::ITrackList* tracks);
|
||||
|
||||
static std::shared_ptr<SavePlaylistQuery> Save(
|
||||
EXPORT static std::shared_ptr<SavePlaylistQuery> Save(
|
||||
musik::core::ILibraryPtr library,
|
||||
const std::string& playlistName,
|
||||
const std::string& categoryType,
|
||||
int64_t categoryId);
|
||||
|
||||
static std::shared_ptr<SavePlaylistQuery> Replace(
|
||||
EXPORT static std::shared_ptr<SavePlaylistQuery> Replace(
|
||||
musik::core::ILibraryPtr library,
|
||||
const int64_t playlistId,
|
||||
std::shared_ptr<musik::core::TrackList> tracks);
|
||||
|
||||
static std::shared_ptr<SavePlaylistQuery> Replace(
|
||||
EXPORT static std::shared_ptr<SavePlaylistQuery> Replace(
|
||||
musik::core::ILibraryPtr library,
|
||||
const int64_t playlistId,
|
||||
musik::core::sdk::ITrackList* tracks);
|
||||
|
||||
static std::shared_ptr<SavePlaylistQuery> Rename(
|
||||
EXPORT static std::shared_ptr<SavePlaylistQuery> Rename(
|
||||
musik::core::ILibraryPtr library,
|
||||
const int64_t playlistId,
|
||||
const std::string& playlistName);
|
||||
|
||||
static std::shared_ptr<SavePlaylistQuery> Append(
|
||||
EXPORT static std::shared_ptr<SavePlaylistQuery> Append(
|
||||
musik::core::ILibraryPtr library,
|
||||
const int64_t playlistId,
|
||||
std::shared_ptr<musik::core::TrackList> tracks);
|
||||
|
||||
static std::shared_ptr<SavePlaylistQuery> Append(
|
||||
EXPORT static std::shared_ptr<SavePlaylistQuery> Append(
|
||||
musik::core::ILibraryPtr library,
|
||||
const int64_t playlistId,
|
||||
const std::string& categoryType,
|
||||
@ -90,21 +90,21 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
DELETE_CLASS_DEFAULTS(SavePlaylistQuery)
|
||||
|
||||
int64_t GetPlaylistId() const noexcept;
|
||||
EXPORT int64_t GetPlaylistId() const noexcept;
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<SavePlaylistQuery> DeserializeQuery(
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<SavePlaylistQuery> DeserializeQuery(
|
||||
musik::core::ILibraryPtr library, const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
private:
|
||||
SavePlaylistQuery(
|
||||
|
@ -41,37 +41,37 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class SearchTrackListQuery : public TrackListQueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_CLASS_DEFAULTS(SearchTrackListQuery)
|
||||
|
||||
SearchTrackListQuery(
|
||||
EXPORT SearchTrackListQuery(
|
||||
musik::core::ILibraryPtr library,
|
||||
MatchType matchType,
|
||||
const std::string& filter,
|
||||
TrackSortType sort);
|
||||
|
||||
std::string GetSortDisplayString();
|
||||
EXPORT std::string GetSortDisplayString();
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* TrackListQueryBase */
|
||||
Result GetResult() noexcept override;
|
||||
Headers GetHeaders() noexcept override;
|
||||
size_t GetQueryHash() noexcept override;
|
||||
Durations GetDurations() noexcept override;
|
||||
EXPORT Result GetResult() noexcept override;
|
||||
EXPORT Headers GetHeaders() noexcept override;
|
||||
EXPORT size_t GetQueryHash() noexcept override;
|
||||
EXPORT Durations GetDurations() noexcept override;
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<SearchTrackListQuery> DeserializeQuery(
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<SearchTrackListQuery> DeserializeQuery(
|
||||
musik::core::ILibraryPtr library, const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
private:
|
||||
musik::core::ILibraryPtr library;
|
||||
|
@ -40,24 +40,24 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class SetTrackRatingQuery: public musik::core::library::query::QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
DELETE_CLASS_DEFAULTS(SetTrackRatingQuery)
|
||||
|
||||
SetTrackRatingQuery(int64_t trackId, int rating) noexcept;
|
||||
EXPORT SetTrackRatingQuery(int64_t trackId, int rating) noexcept;
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<SetTrackRatingQuery> DeserializeQuery(const std::string& data);
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<SetTrackRatingQuery> DeserializeQuery(const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection &db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection &db) override;
|
||||
|
||||
int64_t trackId;
|
||||
int rating;
|
||||
|
@ -54,23 +54,23 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS(TrackListQueryBase)
|
||||
|
||||
TrackListQueryBase() {
|
||||
EXPORT TrackListQueryBase() {
|
||||
this->limit = -1;
|
||||
this->offset = 0;
|
||||
}
|
||||
|
||||
/* virtual methods we define */
|
||||
virtual Result GetResult() = 0;
|
||||
virtual Headers GetHeaders() = 0;
|
||||
virtual Durations GetDurations() = 0;
|
||||
virtual size_t GetQueryHash() = 0;
|
||||
EXPORT virtual Result GetResult() = 0;
|
||||
EXPORT virtual Headers GetHeaders() = 0;
|
||||
EXPORT virtual Durations GetDurations() = 0;
|
||||
EXPORT virtual size_t GetQueryHash() = 0;
|
||||
|
||||
virtual void SetLimitAndOffset(int limit, int offset = 0) noexcept {
|
||||
EXPORT virtual void SetLimitAndOffset(int limit, int offset = 0) noexcept {
|
||||
this->limit = limit;
|
||||
this->offset = offset;
|
||||
}
|
||||
|
||||
virtual musik::core::sdk::ITrackList* GetSdkResult() {
|
||||
EXPORT virtual musik::core::sdk::ITrackList* GetSdkResult() {
|
||||
return new WrappedTrackList(GetResult());
|
||||
}
|
||||
|
||||
|
@ -44,33 +44,33 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class TrackMetadataBatchQuery: public QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
using IdToTrackMap = std::unordered_map<int64_t, TrackPtr>;
|
||||
|
||||
DELETE_CLASS_DEFAULTS(TrackMetadataBatchQuery)
|
||||
|
||||
TrackMetadataBatchQuery(
|
||||
EXPORT TrackMetadataBatchQuery(
|
||||
std::unordered_set<int64_t> trackIds,
|
||||
musik::core::ILibraryPtr library);
|
||||
|
||||
const IdToTrackMap& Result() noexcept {
|
||||
EXPORT const IdToTrackMap& Result() noexcept {
|
||||
return this->result;
|
||||
}
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override { return kQueryName; }
|
||||
EXPORT std::string Name() override { return kQueryName; }
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<TrackMetadataBatchQuery> DeserializeQuery(
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<TrackMetadataBatchQuery> DeserializeQuery(
|
||||
musik::core::ILibraryPtr library, const std::string& data);
|
||||
|
||||
protected:
|
||||
/* QueryBase */
|
||||
bool OnRun(musik::core::db::Connection& db) override;
|
||||
EXPORT bool OnRun(musik::core::db::Connection& db) override;
|
||||
|
||||
private:
|
||||
musik::core::ILibraryPtr library;
|
||||
|
@ -42,31 +42,31 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class TrackMetadataQuery : public QueryBase {
|
||||
public:
|
||||
static const std::string kQueryName;
|
||||
EXPORT static const std::string kQueryName;
|
||||
|
||||
enum class Type: int { Full = 0, IdsOnly = 1 };
|
||||
|
||||
DELETE_CLASS_DEFAULTS(TrackMetadataQuery)
|
||||
|
||||
TrackMetadataQuery(
|
||||
EXPORT TrackMetadataQuery(
|
||||
musik::core::TrackPtr target,
|
||||
musik::core::ILibraryPtr library,
|
||||
Type type = Type::Full) noexcept;
|
||||
|
||||
TrackPtr Result() {
|
||||
EXPORT TrackPtr Result() {
|
||||
return this->result;
|
||||
}
|
||||
|
||||
/* IQuery */
|
||||
std::string Name() override {
|
||||
EXPORT std::string Name() override {
|
||||
return kQueryName;
|
||||
}
|
||||
|
||||
/* ISerializableQuery */
|
||||
std::string SerializeQuery() override;
|
||||
std::string SerializeResult() override;
|
||||
void DeserializeResult(const std::string& data) override;
|
||||
static std::shared_ptr<TrackMetadataQuery> DeserializeQuery(
|
||||
EXPORT std::string SerializeQuery() override;
|
||||
EXPORT std::string SerializeResult() override;
|
||||
EXPORT void DeserializeResult(const std::string& data) override;
|
||||
EXPORT static std::shared_ptr<TrackMetadataQuery> DeserializeQuery(
|
||||
musik::core::ILibraryPtr library, const std::string& data);
|
||||
|
||||
protected:
|
||||
|
@ -216,40 +216,42 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
using Predicate = std::pair<std::string, int64_t>;
|
||||
using PredicateList = std::vector<Predicate>;
|
||||
struct Argument { virtual void Bind(musik::core::db::Statement& stmt, int pos) const = 0; };
|
||||
struct Argument {
|
||||
EXPORT virtual void Bind(musik::core::db::Statement& stmt, int pos) const = 0;
|
||||
};
|
||||
using ArgumentList = std::vector<std::shared_ptr<Argument>>;
|
||||
|
||||
/* functions */
|
||||
|
||||
extern PropertyType GetPropertyType(const std::string& key);
|
||||
extern EXPORT PropertyType GetPropertyType(const std::string& key);
|
||||
|
||||
extern std::shared_ptr<Argument> IdArgument(int64_t);
|
||||
extern std::shared_ptr<Argument> StringArgument(const std::string);
|
||||
extern EXPORT std::shared_ptr<Argument> IdArgument(int64_t);
|
||||
extern EXPORT std::shared_ptr<Argument> StringArgument(const std::string);
|
||||
|
||||
extern size_t Hash(const PredicateList& input);
|
||||
extern EXPORT size_t Hash(const PredicateList& input);
|
||||
|
||||
extern void ReplaceAll(
|
||||
extern EXPORT void ReplaceAll(
|
||||
std::string& input,
|
||||
const std::string& find,
|
||||
const std::string& replace);
|
||||
|
||||
extern void SplitPredicates(
|
||||
extern EXPORT void SplitPredicates(
|
||||
const PredicateList& input,
|
||||
PredicateList& regular,
|
||||
PredicateList& extended);
|
||||
|
||||
extern std::string JoinRegular(
|
||||
extern EXPORT std::string JoinRegular(
|
||||
const PredicateList& pred,
|
||||
ArgumentList& args,
|
||||
const std::string& prefix = "");
|
||||
|
||||
extern std::string InnerJoinExtended(
|
||||
extern EXPORT std::string InnerJoinExtended(
|
||||
const PredicateList& pred, ArgumentList& args);
|
||||
|
||||
extern std::string JoinExtended(
|
||||
extern EXPORT std::string JoinExtended(
|
||||
const PredicateList& pred, ArgumentList& args);
|
||||
|
||||
extern void Apply(
|
||||
extern EXPORT void Apply(
|
||||
musik::core::db::Statement& stmt,
|
||||
const ArgumentList& args);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
public:
|
||||
using Shared = std::shared_ptr<SdkValue>;
|
||||
|
||||
SdkValue(
|
||||
EXPORT SdkValue(
|
||||
const std::string& displayValue,
|
||||
int64_t id,
|
||||
const std::string& type)
|
||||
@ -57,27 +57,27 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
this->type = type;
|
||||
}
|
||||
|
||||
virtual int64_t GetId() {
|
||||
EXPORT virtual int64_t GetId() {
|
||||
return this->id;
|
||||
}
|
||||
|
||||
virtual musik::core::sdk::IResource::Class GetClass() {
|
||||
EXPORT virtual musik::core::sdk::IResource::Class GetClass() {
|
||||
return musik::core::sdk::IResource::Class::Value;
|
||||
}
|
||||
|
||||
virtual const char* GetType() {
|
||||
EXPORT virtual const char* GetType() {
|
||||
return this->type.c_str();
|
||||
}
|
||||
|
||||
virtual size_t GetValue(char* dst, size_t size) {
|
||||
EXPORT virtual size_t GetValue(char* dst, size_t size) {
|
||||
return musik::core::CopyString(this->displayValue, dst, size);
|
||||
}
|
||||
|
||||
std::string ToString() {
|
||||
EXPORT std::string ToString() {
|
||||
return this->displayValue;
|
||||
}
|
||||
|
||||
virtual void Release() {
|
||||
EXPORT virtual void Release() {
|
||||
}
|
||||
|
||||
private:
|
||||
@ -91,55 +91,55 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
using SharedValueList = std::shared_ptr<std::vector<SdkValue::Shared>>;
|
||||
using Shared = std::shared_ptr<SdkValueList>;
|
||||
|
||||
SdkValueList() {
|
||||
EXPORT SdkValueList() {
|
||||
values.reset(new std::vector<SdkValue::Shared>());
|
||||
}
|
||||
|
||||
SdkValueList(const SdkValueList& other) {
|
||||
EXPORT SdkValueList(const SdkValueList& other) {
|
||||
this->values = other.values;
|
||||
}
|
||||
|
||||
SdkValueList(std::shared_ptr<SdkValueList>& other) {
|
||||
EXPORT SdkValueList(std::shared_ptr<SdkValueList>& other) {
|
||||
this->values = other->values;
|
||||
}
|
||||
|
||||
SdkValueList(SharedValueList values) {
|
||||
EXPORT SdkValueList(SharedValueList values) {
|
||||
this->values = values;
|
||||
}
|
||||
|
||||
virtual void Release() {
|
||||
EXPORT virtual void Release() {
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual size_t Count() {
|
||||
EXPORT virtual size_t Count() {
|
||||
return this->values->size();
|
||||
}
|
||||
|
||||
virtual musik::core::sdk::IValue* GetAt(size_t index) {
|
||||
EXPORT virtual musik::core::sdk::IValue* GetAt(size_t index) {
|
||||
return this->values->at(index).get();
|
||||
}
|
||||
|
||||
SdkValue::Shared At(size_t index) {
|
||||
EXPORT SdkValue::Shared At(size_t index) {
|
||||
return this->values->at(index);
|
||||
}
|
||||
|
||||
SdkValue::Shared operator[](size_t index) {
|
||||
EXPORT SdkValue::Shared operator[](size_t index) {
|
||||
return this->values->at(index);
|
||||
}
|
||||
|
||||
void Add(std::shared_ptr<SdkValue> value) {
|
||||
EXPORT void Add(std::shared_ptr<SdkValue> value) {
|
||||
this->values->push_back(value);
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
EXPORT void Clear() {
|
||||
this->values->clear();
|
||||
}
|
||||
|
||||
void Sort(std::function<bool(const SdkValue::Shared&, const SdkValue::Shared&)> compare) {
|
||||
EXPORT void Sort(std::function<bool(const SdkValue::Shared&, const SdkValue::Shared&)> compare) {
|
||||
std::sort(values->begin(), values->end(), compare);
|
||||
}
|
||||
|
||||
Shared Filter(std::function<bool(const SdkValue::Shared&)> keep) const {
|
||||
EXPORT Shared Filter(std::function<bool(const SdkValue::Shared&)> keep) const {
|
||||
Shared result = std::make_shared<SdkValueList>();
|
||||
for (size_t i = 0; i < values->size(); i++) {
|
||||
SdkValue::Shared value = values->at(i);
|
||||
@ -151,7 +151,7 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::vector<T> Map(std::function<T(const SdkValue::Shared&)> fun) const {
|
||||
EXPORT std::vector<T> Map(std::function<T(const SdkValue::Shared&)> fun) const {
|
||||
std::vector<T> result;
|
||||
for (size_t i = 0; i < values->size(); i++) {
|
||||
result.push_back(fun(values->at(i)));
|
||||
@ -159,7 +159,7 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
return result;
|
||||
}
|
||||
|
||||
void Each(std::function<void(const SdkValue::Shared&)> fun) const {
|
||||
EXPORT void Each(std::function<void(const SdkValue::Shared&)> fun) const {
|
||||
for (size_t i = 0; i < values->size(); i++) {
|
||||
fun(values->at(i));
|
||||
}
|
||||
@ -171,30 +171,30 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
class SdkTrackList : public musik::core::sdk::ITrackList {
|
||||
public:
|
||||
SdkTrackList(std::shared_ptr<musik::core::TrackList> wrapped) {
|
||||
EXPORT SdkTrackList(std::shared_ptr<musik::core::TrackList> wrapped) {
|
||||
this->wrapped = wrapped;
|
||||
}
|
||||
|
||||
virtual ~SdkTrackList() {
|
||||
EXPORT virtual ~SdkTrackList() {
|
||||
}
|
||||
|
||||
virtual void Release() override {
|
||||
EXPORT virtual void Release() override {
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual size_t Count() const override {
|
||||
EXPORT virtual size_t Count() const override {
|
||||
return this->wrapped->Count();
|
||||
}
|
||||
|
||||
virtual int64_t GetId(size_t index) const override {
|
||||
EXPORT virtual int64_t GetId(size_t index) const override {
|
||||
return this->wrapped->GetId(index);
|
||||
}
|
||||
|
||||
virtual int IndexOf(int64_t id) const override {
|
||||
EXPORT virtual int IndexOf(int64_t id) const override {
|
||||
return this->wrapped->IndexOf(id);
|
||||
}
|
||||
|
||||
virtual musik::core::sdk::ITrack* GetTrack(size_t index) const override {
|
||||
EXPORT virtual musik::core::sdk::ITrack* GetTrack(size_t index) const override {
|
||||
return this->wrapped->GetTrack(index);
|
||||
}
|
||||
|
||||
|
@ -49,60 +49,60 @@ namespace musik { namespace core { namespace library { namespace query {
|
||||
|
||||
namespace serialization {
|
||||
|
||||
nlohmann::json PredicateListToJson(
|
||||
EXPORT nlohmann::json PredicateListToJson(
|
||||
const musik::core::library::query::category::PredicateList& input);
|
||||
|
||||
void PredicateListFromJson(
|
||||
EXPORT void PredicateListFromJson(
|
||||
const nlohmann::json& input,
|
||||
musik::core::library::query::category::PredicateList& output);
|
||||
|
||||
nlohmann::json MetadataMapListToJson(
|
||||
EXPORT nlohmann::json MetadataMapListToJson(
|
||||
const musik::core::MetadataMapList& input);
|
||||
|
||||
void MetadataMapListFromJson(
|
||||
EXPORT void MetadataMapListFromJson(
|
||||
const nlohmann::json& input,
|
||||
musik::core::MetadataMapList& output);
|
||||
|
||||
nlohmann::json ValueListToJson(
|
||||
EXPORT nlohmann::json ValueListToJson(
|
||||
const musik::core::library::query::SdkValueList& input);
|
||||
|
||||
void ValueListFromJson(
|
||||
EXPORT void ValueListFromJson(
|
||||
const nlohmann::json& input,
|
||||
musik::core::library::query::SdkValueList& output);
|
||||
|
||||
nlohmann::json TrackToJson(
|
||||
EXPORT nlohmann::json TrackToJson(
|
||||
const musik::core::TrackPtr input,
|
||||
bool onlyIds = false);
|
||||
|
||||
void TrackFromJson(
|
||||
EXPORT void TrackFromJson(
|
||||
const nlohmann::json& input,
|
||||
musik::core::TrackPtr output,
|
||||
bool onlyIds);
|
||||
|
||||
nlohmann::json TrackListToJson(
|
||||
EXPORT nlohmann::json TrackListToJson(
|
||||
const musik::core::TrackList& input,
|
||||
bool onlyIds);
|
||||
|
||||
void TrackListFromJson(
|
||||
EXPORT void TrackListFromJson(
|
||||
const nlohmann::json& input,
|
||||
musik::core::TrackList& output,
|
||||
musik::core::ILibraryPtr library,
|
||||
bool onlyIds);
|
||||
|
||||
nlohmann::json ITrackListToJsonIdList(
|
||||
EXPORT nlohmann::json ITrackListToJsonIdList(
|
||||
const musik::core::sdk::ITrackList& input);
|
||||
|
||||
template <typename SetType, typename DataType>
|
||||
void JsonArrayToSet(const nlohmann::json& input, SetType& output) {
|
||||
EXPORT void JsonArrayToSet(const nlohmann::json& input, SetType& output) {
|
||||
for (auto& value : input) {
|
||||
output.insert(value.get<DataType>());
|
||||
}
|
||||
}
|
||||
|
||||
nlohmann::json DurationMapToJsonMap(
|
||||
EXPORT nlohmann::json DurationMapToJsonMap(
|
||||
const std::map<size_t, size_t>& input);
|
||||
|
||||
void JsonMapToDuration(
|
||||
EXPORT void JsonMapToDuration(
|
||||
const nlohmann::json& input,
|
||||
std::map<size_t, size_t>& output);
|
||||
}
|
||||
|
@ -94,7 +94,7 @@
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
@ -112,7 +112,7 @@
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
@ -235,6 +235,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)/bin64/$(Configuration)/</OutDir>
|
||||
<IntDir>./obj64/$(Configuration)/</IntDir>
|
||||
<TargetName>lib$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-DLL|x64'">
|
||||
<OutDir>$(SolutionDir)/bin64/Debug/</OutDir>
|
||||
@ -244,6 +245,9 @@
|
||||
<OutDir>$(SolutionDir)/bin64/$(Configuration)/</OutDir>
|
||||
<IntDir>./obj64/$(Configuration)/</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<TargetName>lib$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@ -330,6 +334,10 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcurl.lib;libssl-1_1-x64.lib;libcrypto-1_1-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>../3rdparty/bin/win64/lib;../3rdparty/bin/win64/lib/debug;</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-DLL|x64'">
|
||||
<ClCompile>
|
||||
|
@ -40,14 +40,14 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef MCSDK_DEFINE_EXPORTS
|
||||
#ifdef WIN32
|
||||
#define mcsdk_export extern "C" __declspec(dllexport)
|
||||
#else
|
||||
#define mcsdk_export extern "C"
|
||||
#endif
|
||||
#ifndef mcsdk_export
|
||||
#ifdef WIN32
|
||||
#define mcsdk_export extern "C" __declspec(dllexport)
|
||||
#else
|
||||
#define mcsdk_export extern
|
||||
#define mcsdk_export extern "C"
|
||||
#endif
|
||||
#else
|
||||
#define mcsdk_export extern
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -77,21 +77,21 @@ namespace musik { namespace core { namespace net {
|
||||
static std::shared_ptr<PiggyWebSocketClient> Instance(MessageQueue* messageQueue);
|
||||
static void Shutdown();
|
||||
|
||||
PiggyWebSocketClient(const PiggyWebSocketClient&) = delete;
|
||||
virtual ~PiggyWebSocketClient();
|
||||
EXPORT PiggyWebSocketClient(const PiggyWebSocketClient&) = delete;
|
||||
EXPORT virtual ~PiggyWebSocketClient();
|
||||
|
||||
void Connect(const std::string& host, unsigned short port = 8347, bool useTls = false);
|
||||
void Reconnect();
|
||||
void Disconnect();
|
||||
EXPORT void Connect(const std::string& host, unsigned short port = 8347, bool useTls = false);
|
||||
EXPORT void Reconnect();
|
||||
EXPORT void Disconnect();
|
||||
|
||||
void EnqueueMessage(Message message);
|
||||
EXPORT void EnqueueMessage(Message message);
|
||||
|
||||
State ConnectionState() const;
|
||||
ConnectionError LastConnectionError() const;
|
||||
std::string Uri() const;
|
||||
EXPORT State ConnectionState() const;
|
||||
EXPORT ConnectionError LastConnectionError() const;
|
||||
EXPORT std::string Uri() const;
|
||||
|
||||
void SetMessageQueue(MessageQueue* messageQueue);
|
||||
void ProcessMessage(musik::core::runtime::IMessage& message) override;
|
||||
EXPORT void SetMessageQueue(MessageQueue* messageQueue);
|
||||
EXPORT void ProcessMessage(musik::core::runtime::IMessage& message) override;
|
||||
|
||||
protected:
|
||||
PiggyWebSocketClient(MessageQueue* messageQueue);
|
||||
|
@ -74,20 +74,20 @@ namespace musik { namespace core { namespace net {
|
||||
TLS = 1
|
||||
};
|
||||
|
||||
RawWebSocketClient(asio::io_service& io);
|
||||
RawWebSocketClient(const RawWebSocketClient&) = delete;
|
||||
~RawWebSocketClient();
|
||||
EXPORT RawWebSocketClient(asio::io_service& io);
|
||||
EXPORT RawWebSocketClient(const RawWebSocketClient&) = delete;
|
||||
EXPORT ~RawWebSocketClient();
|
||||
|
||||
void SetMode(Mode mode);
|
||||
void SetOpenHandler(OpenHandler openHandler);
|
||||
void SetFailHandler(FailHandler failHandler);
|
||||
void SetMessageHandler(MessageHandler messageHandler);
|
||||
void SetCloseHandler(CloseHandler closeHandler);
|
||||
void SetSendMessageErrorHandler(SendMessageErrorHandler errorHandler);
|
||||
void Send(Connection connection, const std::string& message);
|
||||
void SetPongTimeout(long timeoutMs);
|
||||
void Connect(const std::string& uri);
|
||||
void Run();
|
||||
EXPORT void SetMode(Mode mode);
|
||||
EXPORT void SetOpenHandler(OpenHandler openHandler);
|
||||
EXPORT void SetFailHandler(FailHandler failHandler);
|
||||
EXPORT void SetMessageHandler(MessageHandler messageHandler);
|
||||
EXPORT void SetCloseHandler(CloseHandler closeHandler);
|
||||
EXPORT void SetSendMessageErrorHandler(SendMessageErrorHandler errorHandler);
|
||||
EXPORT void Send(Connection connection, const std::string& message);
|
||||
EXPORT void SetPongTimeout(long timeoutMs);
|
||||
EXPORT void Connect(const std::string& uri);
|
||||
EXPORT void Run();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -81,39 +81,39 @@ namespace musik { namespace core { namespace net {
|
||||
using Client = WebSocketClient;
|
||||
using State = Client::State;
|
||||
using QueryError = Client::QueryError;
|
||||
virtual void OnClientInvalidPassword(Client* client) = 0;
|
||||
virtual void OnClientStateChanged(Client* client, State newState, State oldState) = 0;
|
||||
virtual void OnClientQuerySucceeded(Client* client, const std::string& messageId, Query query) = 0;
|
||||
virtual void OnClientQueryFailed(Client* client, const std::string& messageId, Query query, QueryError result) = 0;
|
||||
EXPORT virtual void OnClientInvalidPassword(Client* client) = 0;
|
||||
EXPORT virtual void OnClientStateChanged(Client* client, State newState, State oldState) = 0;
|
||||
EXPORT virtual void OnClientQuerySucceeded(Client* client, const std::string& messageId, Query query) = 0;
|
||||
EXPORT virtual void OnClientQueryFailed(Client* client, const std::string& messageId, Query query, QueryError result) = 0;
|
||||
};
|
||||
|
||||
WebSocketClient(
|
||||
EXPORT WebSocketClient(
|
||||
musik::core::runtime::IMessageQueue* messageQueue,
|
||||
Listener* listener);
|
||||
|
||||
WebSocketClient(const WebSocketClient&) = delete;
|
||||
virtual ~WebSocketClient();
|
||||
EXPORT WebSocketClient(const WebSocketClient&) = delete;
|
||||
EXPORT virtual ~WebSocketClient();
|
||||
|
||||
void Connect(
|
||||
EXPORT void Connect(
|
||||
const std::string& host,
|
||||
unsigned short port,
|
||||
const std::string& password,
|
||||
bool useTls);
|
||||
|
||||
void Reconnect();
|
||||
void Disconnect();
|
||||
EXPORT void Reconnect();
|
||||
EXPORT void Disconnect();
|
||||
|
||||
State ConnectionState() const;
|
||||
ConnectionError LastConnectionError() const;
|
||||
std::string LastServerVersion() const;
|
||||
std::string Uri() const;
|
||||
EXPORT State ConnectionState() const;
|
||||
EXPORT ConnectionError LastConnectionError() const;
|
||||
EXPORT std::string LastServerVersion() const;
|
||||
EXPORT std::string Uri() const;
|
||||
|
||||
std::string EnqueueQuery(Query query);
|
||||
EXPORT std::string EnqueueQuery(Query query);
|
||||
|
||||
void SetMessageQueue(musik::core::runtime::IMessageQueue* messageQueue);
|
||||
EXPORT void SetMessageQueue(musik::core::runtime::IMessageQueue* messageQueue);
|
||||
|
||||
/* IMessageTarget */
|
||||
void ProcessMessage(musik::core::runtime::IMessage& message) override;
|
||||
EXPORT void ProcessMessage(musik::core::runtime::IMessage& message) override;
|
||||
|
||||
private:
|
||||
void SetState(State state);
|
||||
|
@ -59,18 +59,18 @@ namespace musik { namespace core {
|
||||
|
||||
template <typename T>
|
||||
struct ReleaseDeleter {
|
||||
void operator()(T* t) {
|
||||
EXPORT void operator()(T* t) {
|
||||
t->Release();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct NullDeleter {
|
||||
void operator()(T* t) {
|
||||
EXPORT void operator()(T* t) {
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class D> void QueryInterface(
|
||||
template <class T, class D> EXPORT void QueryInterface(
|
||||
const std::string& functionName,
|
||||
std::function<void(musik::core::sdk::IPlugin*, std::shared_ptr<T>, const std::string&)> handler)
|
||||
{
|
||||
@ -97,7 +97,7 @@ namespace musik { namespace core {
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class D> std::vector<std::shared_ptr<T> > QueryInterface(const std::string& functionName) {
|
||||
template <class T, class D> std::vector<std::shared_ptr<T>> EXPORT QueryInterface(const std::string& functionName) {
|
||||
std::vector<std::shared_ptr<T> > plugins;
|
||||
|
||||
QueryInterface<T, D>(
|
||||
@ -113,7 +113,7 @@ namespace musik { namespace core {
|
||||
return plugins;
|
||||
}
|
||||
|
||||
template <class T> void QueryFunction(
|
||||
template <class T> EXPORT void QueryFunction(
|
||||
const std::string& functionName,
|
||||
std::function<void(musik::core::sdk::IPlugin*, T)> handler)
|
||||
{
|
||||
|
@ -41,15 +41,15 @@
|
||||
|
||||
namespace musik { namespace core { namespace plugin {
|
||||
|
||||
void Init();
|
||||
EXPORT void Init();
|
||||
|
||||
void Start(
|
||||
EXPORT void Start(
|
||||
musik::core::runtime::IMessageQueue* messageQueue,
|
||||
musik::core::sdk::IPlaybackService* playback,
|
||||
musik::core::ILibraryPtr library);
|
||||
|
||||
musik::core::sdk::IEnvironment& Environment();
|
||||
EXPORT musik::core::sdk::IEnvironment& Environment();
|
||||
|
||||
void Shutdown();
|
||||
EXPORT void Shutdown();
|
||||
|
||||
} } }
|
||||
|
@ -43,11 +43,11 @@ namespace musik { namespace core { namespace runtime {
|
||||
|
||||
class IMessage {
|
||||
public:
|
||||
virtual ~IMessage() { }
|
||||
virtual IMessageTarget* Target() = 0;
|
||||
virtual int Type() = 0;
|
||||
virtual int64_t UserData1() = 0;
|
||||
virtual int64_t UserData2() = 0;
|
||||
EXPORT virtual ~IMessage() { }
|
||||
EXPORT virtual IMessageTarget* Target() = 0;
|
||||
EXPORT virtual int Type() = 0;
|
||||
EXPORT virtual int64_t UserData1() = 0;
|
||||
EXPORT virtual int64_t UserData2() = 0;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<IMessage> IMessagePtr;
|
||||
|
@ -41,18 +41,18 @@ namespace musik { namespace core { namespace runtime {
|
||||
|
||||
class IMessageQueue {
|
||||
public:
|
||||
virtual ~IMessageQueue() { }
|
||||
virtual void Post(IMessagePtr message, int64_t delayMs = 0) = 0;
|
||||
virtual int Remove(IMessageTarget *target, int type = -1) = 0;
|
||||
virtual void Broadcast(IMessagePtr message, int64_t delayMs = 0) = 0;
|
||||
virtual bool Contains(IMessageTarget *target, int type = -1) = 0;
|
||||
virtual void Debounce(IMessagePtr message, int64_t delayMs = 0) = 0;
|
||||
virtual void Register(IMessageTarget* target) = 0;
|
||||
virtual void Unregister(IMessageTarget* target) = 0;
|
||||
virtual void RegisterForBroadcasts(IMessageTargetPtr target) = 0;
|
||||
virtual void UnregisterForBroadcasts(IMessageTarget *target) = 0;
|
||||
virtual void WaitAndDispatch(int64_t timeoutMillis = -1) = 0;
|
||||
virtual void Dispatch() = 0;
|
||||
EXPORT virtual ~IMessageQueue() { }
|
||||
EXPORT virtual void Post(IMessagePtr message, int64_t delayMs = 0) = 0;
|
||||
EXPORT virtual int Remove(IMessageTarget *target, int type = -1) = 0;
|
||||
EXPORT virtual void Broadcast(IMessagePtr message, int64_t delayMs = 0) = 0;
|
||||
EXPORT virtual bool Contains(IMessageTarget *target, int type = -1) = 0;
|
||||
EXPORT virtual void Debounce(IMessagePtr message, int64_t delayMs = 0) = 0;
|
||||
EXPORT virtual void Register(IMessageTarget* target) = 0;
|
||||
EXPORT virtual void Unregister(IMessageTarget* target) = 0;
|
||||
EXPORT virtual void RegisterForBroadcasts(IMessageTargetPtr target) = 0;
|
||||
EXPORT virtual void UnregisterForBroadcasts(IMessageTarget *target) = 0;
|
||||
EXPORT virtual void WaitAndDispatch(int64_t timeoutMillis = -1) = 0;
|
||||
EXPORT virtual void Dispatch() = 0;
|
||||
};
|
||||
|
||||
} } }
|
@ -40,8 +40,8 @@ namespace musik { namespace core { namespace runtime {
|
||||
|
||||
class IMessageTarget {
|
||||
public:
|
||||
virtual ~IMessageTarget() { }
|
||||
virtual void ProcessMessage(IMessage &message) = 0;
|
||||
EXPORT virtual ~IMessageTarget() { }
|
||||
EXPORT virtual void ProcessMessage(IMessage &message) = 0;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<IMessageTarget> IMessageTargetPtr;
|
||||
|
@ -40,7 +40,7 @@ namespace musik { namespace core { namespace runtime {
|
||||
|
||||
class Message : public IMessage {
|
||||
protected:
|
||||
Message(
|
||||
EXPORT Message(
|
||||
IMessageTarget* target,
|
||||
int messageType,
|
||||
int64_t data1,
|
||||
@ -53,13 +53,13 @@ namespace musik { namespace core { namespace runtime {
|
||||
int64_t data1 = 0LL,
|
||||
int64_t data2 = 0LL);
|
||||
|
||||
virtual ~Message() {
|
||||
EXPORT virtual ~Message() {
|
||||
}
|
||||
|
||||
virtual IMessageTarget* Target();
|
||||
virtual int Type();
|
||||
virtual int64_t UserData1();
|
||||
virtual int64_t UserData2();
|
||||
EXPORT virtual IMessageTarget* Target();
|
||||
EXPORT virtual int Type();
|
||||
EXPORT virtual int64_t UserData1();
|
||||
EXPORT virtual int64_t UserData2();
|
||||
|
||||
private:
|
||||
IMessageTarget* target;
|
||||
|
@ -52,22 +52,22 @@ namespace musik { namespace core { namespace runtime {
|
||||
MessageQueue& operator=(const MessageQueue&) = delete;
|
||||
MessageQueue& operator=(const MessageQueue&&) = delete;
|
||||
|
||||
MessageQueue() noexcept;
|
||||
EXPORT MessageQueue() noexcept;
|
||||
|
||||
void Post(IMessagePtr message, int64_t delayMs = 0) override;
|
||||
void Broadcast(IMessagePtr message, int64_t messageMs = 0) override;
|
||||
int Remove(IMessageTarget *target, int type = -1) override;
|
||||
bool Contains(IMessageTarget *target, int type = -1) override;
|
||||
void Debounce(IMessagePtr message, int64_t delayMs = 0) override;
|
||||
void Register(IMessageTarget* target) override;
|
||||
void Unregister(IMessageTarget* target) override;
|
||||
void RegisterForBroadcasts(IMessageTargetPtr target) override;
|
||||
void UnregisterForBroadcasts(IMessageTarget *target) override;
|
||||
void WaitAndDispatch(int64_t timeoutMillis = -1) override;
|
||||
void Dispatch() override;
|
||||
EXPORT void Post(IMessagePtr message, int64_t delayMs = 0) override;
|
||||
EXPORT void Broadcast(IMessagePtr message, int64_t messageMs = 0) override;
|
||||
EXPORT int Remove(IMessageTarget *target, int type = -1) override;
|
||||
EXPORT bool Contains(IMessageTarget *target, int type = -1) override;
|
||||
EXPORT void Debounce(IMessagePtr message, int64_t delayMs = 0) override;
|
||||
EXPORT void Register(IMessageTarget* target) override;
|
||||
EXPORT void Unregister(IMessageTarget* target) override;
|
||||
EXPORT void RegisterForBroadcasts(IMessageTargetPtr target) override;
|
||||
EXPORT void UnregisterForBroadcasts(IMessageTarget *target) override;
|
||||
EXPORT void WaitAndDispatch(int64_t timeoutMillis = -1) override;
|
||||
EXPORT void Dispatch() override;
|
||||
|
||||
protected:
|
||||
int64_t GetNextMessageTime() noexcept {
|
||||
EXPORT int64_t GetNextMessageTime() noexcept {
|
||||
return nextMessageTime.load();
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,6 @@
|
||||
|
||||
namespace musik { namespace core { namespace auddio {
|
||||
using LyricsCallback = std::function<void(musik::core::TrackPtr track, std::string)>;
|
||||
extern bool Available();
|
||||
extern void FindLyrics(musik::core::TrackPtr track, LyricsCallback callback);
|
||||
EXPORT extern bool Available();
|
||||
EXPORT extern void FindLyrics(musik::core::TrackPtr track, LyricsCallback callback);
|
||||
} } }
|
@ -40,16 +40,16 @@
|
||||
|
||||
namespace musik { namespace core {
|
||||
|
||||
std::string GetHomeDirectory();
|
||||
std::string GetApplicationDirectory();
|
||||
std::string GetDataDirectory(bool create = true);
|
||||
std::string GetPath(const std::string &sFile);
|
||||
std::string GetPluginDirectory();
|
||||
std::string NormalizeDir(std::string path);
|
||||
void OpenFile(const std::string& path);
|
||||
bool CopyFile(const std::string& from, const std::string& to);
|
||||
int64_t Checksum(char *data,unsigned int bytes);
|
||||
size_t CopyString(const std::string& src, char* dst, size_t size);
|
||||
bool FileToByteArray(const std::string& path, char** target, int& size, bool nullTerminate = false);
|
||||
EXPORT std::string GetHomeDirectory();
|
||||
EXPORT std::string GetApplicationDirectory();
|
||||
EXPORT std::string GetDataDirectory(bool create = true);
|
||||
EXPORT std::string GetPath(const std::string &sFile);
|
||||
EXPORT std::string GetPluginDirectory();
|
||||
EXPORT std::string NormalizeDir(std::string path);
|
||||
EXPORT void OpenFile(const std::string& path);
|
||||
EXPORT bool CopyFile(const std::string& from, const std::string& to);
|
||||
EXPORT int64_t Checksum(char *data,unsigned int bytes);
|
||||
EXPORT size_t CopyString(const std::string& src, char* dst, size_t size);
|
||||
EXPORT bool FileToByteArray(const std::string& path, char** target, int& size, bool nullTerminate = false);
|
||||
|
||||
} }
|
||||
|
@ -34,22 +34,24 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <musikcore/config.h>
|
||||
|
||||
#define DELETE_CLASS_DEFAULTS(ClassName) \
|
||||
ClassName() = delete; \
|
||||
ClassName(const ClassName&) = delete; \
|
||||
ClassName(const ClassName&&) = delete; \
|
||||
ClassName& operator=(const ClassName&) = delete; \
|
||||
ClassName& operator=(const ClassName&&) = delete;
|
||||
EXPORT ClassName() = delete; \
|
||||
EXPORT ClassName(const ClassName&) = delete; \
|
||||
EXPORT ClassName(const ClassName&&) = delete; \
|
||||
EXPORT ClassName& operator=(const ClassName&) = delete; \
|
||||
EXPORT ClassName& operator=(const ClassName&&) = delete;
|
||||
|
||||
#define DELETE_COPY_AND_ASSIGNMENT_DEFAULTS_WITH_DEFAULT_CTOR(ClassName) \
|
||||
ClassName() noexcept = default; \
|
||||
ClassName(const ClassName&) = delete; \
|
||||
ClassName(const ClassName&&) = delete; \
|
||||
ClassName& operator=(const ClassName&) = delete; \
|
||||
ClassName& operator=(const ClassName&&) = delete;
|
||||
EXPORT ClassName() noexcept = default; \
|
||||
EXPORT ClassName(const ClassName&) = delete; \
|
||||
EXPORT ClassName(const ClassName&&) = delete; \
|
||||
EXPORT ClassName& operator=(const ClassName&) = delete; \
|
||||
EXPORT ClassName& operator=(const ClassName&&) = delete;
|
||||
|
||||
#define DELETE_COPY_AND_ASSIGNMENT_DEFAULTS(ClassName) \
|
||||
ClassName(const ClassName&) = delete; \
|
||||
ClassName(const ClassName&&) = delete; \
|
||||
ClassName& operator=(const ClassName&) = delete; \
|
||||
ClassName& operator=(const ClassName&&) = delete;
|
||||
EXPORT ClassName(const ClassName&) = delete; \
|
||||
EXPORT ClassName(const ClassName&&) = delete; \
|
||||
EXPORT ClassName& operator=(const ClassName&) = delete; \
|
||||
EXPORT ClassName& operator=(const ClassName&&) = delete;
|
||||
|
@ -38,10 +38,10 @@
|
||||
|
||||
namespace musik { namespace core { namespace duration {
|
||||
|
||||
std::string Duration(const std::string& str);
|
||||
std::string Duration(int seconds);
|
||||
std::string Duration(size_t seconds);
|
||||
std::string Duration(double seconds);
|
||||
std::string DurationWithHours(size_t seconds);
|
||||
EXPORT std::string Duration(const std::string& str);
|
||||
EXPORT std::string Duration(int seconds);
|
||||
EXPORT std::string Duration(size_t seconds);
|
||||
EXPORT std::string Duration(double seconds);
|
||||
EXPORT std::string DurationWithHours(size_t seconds);
|
||||
|
||||
} } }
|
||||
|
@ -45,12 +45,12 @@ namespace musik { namespace core { namespace lastfm {
|
||||
using TokenCallback = std::function<void(std::string)>;
|
||||
using SessionCallback = std::function<void(Session)>;
|
||||
|
||||
void CreateAccountLinkToken(TokenCallback callback);
|
||||
const std::string CreateAccountLinkUrl(const std::string& token);
|
||||
void CreateSession(const std::string& token, SessionCallback session);
|
||||
void Scrobble(musik::core::TrackPtr track);
|
||||
EXPORT void CreateAccountLinkToken(TokenCallback callback);
|
||||
EXPORT const std::string CreateAccountLinkUrl(const std::string& token);
|
||||
EXPORT void CreateSession(const std::string& token, SessionCallback session);
|
||||
EXPORT void Scrobble(musik::core::TrackPtr track);
|
||||
|
||||
Session LoadSession();
|
||||
void SaveSession(const Session& session);
|
||||
void ClearSession();
|
||||
EXPORT Session LoadSession();
|
||||
EXPORT void SaveSession(const Session& session);
|
||||
EXPORT void ClearSession();
|
||||
} } }
|
@ -44,12 +44,12 @@ namespace musik {
|
||||
public:
|
||||
using Client = std::shared_ptr<musik::core::net::PiggyWebSocketClient>;
|
||||
|
||||
PiggyDebugBackend(Client client);
|
||||
virtual ~PiggyDebugBackend() override;
|
||||
virtual void verbose(const std::string& tag, const std::string& string) override;
|
||||
virtual void info(const std::string& tag, const std::string& string) override;
|
||||
virtual void warning(const std::string& tag, const std::string& string) override;
|
||||
virtual void error(const std::string& tag, const std::string& string) override;
|
||||
EXPORT PiggyDebugBackend(Client client);
|
||||
EXPORT virtual ~PiggyDebugBackend() override;
|
||||
EXPORT virtual void verbose(const std::string& tag, const std::string& string) override;
|
||||
EXPORT virtual void info(const std::string& tag, const std::string& string) override;
|
||||
EXPORT virtual void warning(const std::string& tag, const std::string& string) override;
|
||||
EXPORT virtual void error(const std::string& tag, const std::string& string) override;
|
||||
|
||||
private:
|
||||
Client client;
|
||||
|
@ -40,19 +40,19 @@
|
||||
namespace musik {
|
||||
namespace core {
|
||||
namespace playback {
|
||||
void VolumeUp(musik::core::audio::ITransport& transport);
|
||||
void VolumeDown(musik::core::audio::ITransport& transport);
|
||||
void SeekForward(musik::core::sdk::IPlaybackService& playback);
|
||||
void SeekBack(musik::core::sdk::IPlaybackService& playback);
|
||||
void SeekForwardProportional(musik::core::sdk::IPlaybackService& playback);
|
||||
void SeekBackProportional(musik::core::sdk::IPlaybackService& playback);
|
||||
void PauseOrResume(musik::core::audio::ITransport& transport);
|
||||
EXPORT void VolumeUp(musik::core::audio::ITransport& transport);
|
||||
EXPORT void VolumeDown(musik::core::audio::ITransport& transport);
|
||||
EXPORT void SeekForward(musik::core::sdk::IPlaybackService& playback);
|
||||
EXPORT void SeekBack(musik::core::sdk::IPlaybackService& playback);
|
||||
EXPORT void SeekForwardProportional(musik::core::sdk::IPlaybackService& playback);
|
||||
EXPORT void SeekBackProportional(musik::core::sdk::IPlaybackService& playback);
|
||||
EXPORT void PauseOrResume(musik::core::audio::ITransport& transport);
|
||||
|
||||
void LoadPlaybackContext(
|
||||
EXPORT void LoadPlaybackContext(
|
||||
musik::core::ILibraryPtr library,
|
||||
musik::core::audio::PlaybackService& playback);
|
||||
|
||||
void SavePlaybackContext(
|
||||
EXPORT void SavePlaybackContext(
|
||||
musik::core::ILibraryPtr library,
|
||||
musik::core::audio::PlaybackService& playback);
|
||||
}
|
||||
|
@ -39,55 +39,55 @@
|
||||
namespace musik { namespace core { namespace prefs {
|
||||
|
||||
namespace components {
|
||||
extern const std::string Settings;
|
||||
extern const std::string Libraries;
|
||||
extern const std::string Playback;
|
||||
extern const std::string Plugins;
|
||||
extern const std::string Session;
|
||||
EXPORT extern const std::string Settings;
|
||||
EXPORT extern const std::string Libraries;
|
||||
EXPORT extern const std::string Playback;
|
||||
EXPORT extern const std::string Plugins;
|
||||
EXPORT extern const std::string Session;
|
||||
}
|
||||
|
||||
namespace keys {
|
||||
extern const std::string AutoSyncIntervalMillis;
|
||||
extern const std::string RemoveMissingFiles;
|
||||
extern const std::string SyncOnStartup;
|
||||
extern const std::string ResumePlaybackOnStartup;
|
||||
extern const std::string Volume;
|
||||
extern const std::string RepeatMode;
|
||||
extern const std::string TimeChangeMode;
|
||||
extern const std::string OutputPlugin;
|
||||
extern const std::string Transport;
|
||||
extern const std::string Locale;
|
||||
extern const std::string IndexerLogEnabled;
|
||||
extern const std::string IndexerThreadCount;
|
||||
extern const std::string IndexerTransactionInterval;
|
||||
extern const std::string ReplayGainMode;
|
||||
extern const std::string PreampDecibels;
|
||||
extern const std::string SaveSessionOnExit;
|
||||
extern const std::string LastPlayQueueIndex;
|
||||
extern const std::string LastPlayQueueTime;
|
||||
extern const std::string LastFmToken;
|
||||
extern const std::string LastFmSessionId;
|
||||
extern const std::string LastFmUsername;
|
||||
extern const std::string DisableAlbumArtistFallback;
|
||||
extern const std::string AuddioApiToken;
|
||||
extern const std::string LibraryType;
|
||||
extern const std::string PlaybackTrackQueryTimeoutMs;
|
||||
extern const std::string RemoteLibraryHostname;
|
||||
extern const std::string RemoteLibraryWssPort;
|
||||
extern const std::string RemoteLibraryHttpPort;
|
||||
extern const std::string RemoteLibraryPassword;
|
||||
extern const std::string RemoteLibraryViewed;
|
||||
extern const std::string RemoteLibraryLatencyTimeoutMs;
|
||||
extern const std::string RemoteLibraryWssTls;
|
||||
extern const std::string RemoteLibraryHttpTls;
|
||||
extern const std::string RemoteLibraryTlsWarningSuppressed;
|
||||
extern const std::string RemoteLibraryTranscoderEnabled;
|
||||
extern const std::string RemoteLibraryTranscoderFormat;
|
||||
extern const std::string RemoteLibraryTranscoderBitrate;
|
||||
extern const std::string RemoteLibraryIgnoreVersionMismatch;
|
||||
extern const std::string AsyncTrackListQueries;
|
||||
extern const std::string PiggyEnabled;
|
||||
extern const std::string PiggyHostname;
|
||||
EXPORT extern const std::string AutoSyncIntervalMillis;
|
||||
EXPORT extern const std::string RemoveMissingFiles;
|
||||
EXPORT extern const std::string SyncOnStartup;
|
||||
EXPORT extern const std::string ResumePlaybackOnStartup;
|
||||
EXPORT extern const std::string Volume;
|
||||
EXPORT extern const std::string RepeatMode;
|
||||
EXPORT extern const std::string TimeChangeMode;
|
||||
EXPORT extern const std::string OutputPlugin;
|
||||
EXPORT extern const std::string Transport;
|
||||
EXPORT extern const std::string Locale;
|
||||
EXPORT extern const std::string IndexerLogEnabled;
|
||||
EXPORT extern const std::string IndexerThreadCount;
|
||||
EXPORT extern const std::string IndexerTransactionInterval;
|
||||
EXPORT extern const std::string ReplayGainMode;
|
||||
EXPORT extern const std::string PreampDecibels;
|
||||
EXPORT extern const std::string SaveSessionOnExit;
|
||||
EXPORT extern const std::string LastPlayQueueIndex;
|
||||
EXPORT extern const std::string LastPlayQueueTime;
|
||||
EXPORT extern const std::string LastFmToken;
|
||||
EXPORT extern const std::string LastFmSessionId;
|
||||
EXPORT extern const std::string LastFmUsername;
|
||||
EXPORT extern const std::string DisableAlbumArtistFallback;
|
||||
EXPORT extern const std::string AuddioApiToken;
|
||||
EXPORT extern const std::string LibraryType;
|
||||
EXPORT extern const std::string PlaybackTrackQueryTimeoutMs;
|
||||
EXPORT extern const std::string RemoteLibraryHostname;
|
||||
EXPORT extern const std::string RemoteLibraryWssPort;
|
||||
EXPORT extern const std::string RemoteLibraryHttpPort;
|
||||
EXPORT extern const std::string RemoteLibraryPassword;
|
||||
EXPORT extern const std::string RemoteLibraryViewed;
|
||||
EXPORT extern const std::string RemoteLibraryLatencyTimeoutMs;
|
||||
EXPORT extern const std::string RemoteLibraryWssTls;
|
||||
EXPORT extern const std::string RemoteLibraryHttpTls;
|
||||
EXPORT extern const std::string RemoteLibraryTlsWarningSuppressed;
|
||||
EXPORT extern const std::string RemoteLibraryTranscoderEnabled;
|
||||
EXPORT extern const std::string RemoteLibraryTranscoderFormat;
|
||||
EXPORT extern const std::string RemoteLibraryTranscoderBitrate;
|
||||
EXPORT extern const std::string RemoteLibraryIgnoreVersionMismatch;
|
||||
EXPORT extern const std::string AsyncTrackListQueries;
|
||||
EXPORT extern const std::string PiggyEnabled;
|
||||
EXPORT extern const std::string PiggyHostname;
|
||||
}
|
||||
|
||||
} } }
|
||||
|
@ -56,48 +56,48 @@ namespace musik { namespace core {
|
||||
ModeAutoSave
|
||||
};
|
||||
|
||||
static void LoadPluginPreferences();
|
||||
static void SavePluginPreferences();
|
||||
static EXPORT void LoadPluginPreferences();
|
||||
static EXPORT void SavePluginPreferences();
|
||||
|
||||
static musik::core::sdk::IPreferences* Unmanaged(const std::string& name);
|
||||
static EXPORT musik::core::sdk::IPreferences* Unmanaged(const std::string& name);
|
||||
|
||||
static std::shared_ptr<Preferences>
|
||||
static EXPORT std::shared_ptr<Preferences>
|
||||
ForPlugin(const std::string& pluginName);
|
||||
|
||||
static std::shared_ptr<Preferences>
|
||||
static EXPORT std::shared_ptr<Preferences>
|
||||
ForComponent(const std::string& c, Mode mode = ModeAutoSave);
|
||||
|
||||
~Preferences();
|
||||
EXPORT ~Preferences();
|
||||
|
||||
/* IPreferences (for plugin use) */
|
||||
virtual void Release() override;
|
||||
EXPORT virtual void Release() override;
|
||||
|
||||
bool GetBool(const char* key, bool defaultValue = false) override;
|
||||
int GetInt(const char* key, int defaultValue = 0) override;
|
||||
double GetDouble(const char* key, double defaultValue = 0.0f) override;
|
||||
int GetString(const char* key, char* dst, size_t size, const char* defaultValue = "") override;
|
||||
EXPORT bool GetBool(const char* key, bool defaultValue = false) override;
|
||||
EXPORT int GetInt(const char* key, int defaultValue = 0) override;
|
||||
EXPORT double GetDouble(const char* key, double defaultValue = 0.0f) override;
|
||||
EXPORT int GetString(const char* key, char* dst, size_t size, const char* defaultValue = "") override;
|
||||
|
||||
void SetBool(const char* key, bool value) override;
|
||||
void SetInt(const char* key, int value) override;
|
||||
void SetDouble(const char* key, double value) override;
|
||||
void SetString(const char* key, const char* value) override;
|
||||
EXPORT void SetBool(const char* key, bool value) override;
|
||||
EXPORT void SetInt(const char* key, int value) override;
|
||||
EXPORT void SetDouble(const char* key, double value) override;
|
||||
EXPORT void SetString(const char* key, const char* value) override;
|
||||
|
||||
void Save() override;
|
||||
EXPORT void Save() override;
|
||||
|
||||
/* easier interface for internal use */
|
||||
bool GetBool(const std::string& key, bool defaultValue = false);
|
||||
int GetInt(const std::string& key, int defaultValue = 0);
|
||||
double GetDouble(const std::string& key, double defaultValue = 0.0f);
|
||||
std::string GetString(const std::string& key, const std::string& defaultValue = "");
|
||||
EXPORT bool GetBool(const std::string& key, bool defaultValue = false);
|
||||
EXPORT int GetInt(const std::string& key, int defaultValue = 0);
|
||||
EXPORT double GetDouble(const std::string& key, double defaultValue = 0.0f);
|
||||
EXPORT std::string GetString(const std::string& key, const std::string& defaultValue = "");
|
||||
|
||||
void SetBool(const std::string& key, bool value);
|
||||
void SetInt(const std::string& key, int value);
|
||||
void SetDouble(const std::string& key, double value);
|
||||
void SetString(const std::string& key, const char* value);
|
||||
EXPORT void SetBool(const std::string& key, bool value);
|
||||
EXPORT void SetInt(const std::string& key, int value);
|
||||
EXPORT void SetDouble(const std::string& key, double value);
|
||||
EXPORT void SetString(const std::string& key, const char* value);
|
||||
|
||||
void GetKeys(std::vector<std::string>& target);
|
||||
bool HasKey(const std::string& key);
|
||||
void Remove(const std::string& key);
|
||||
EXPORT void GetKeys(std::vector<std::string>& target);
|
||||
EXPORT bool HasKey(const std::string& key);
|
||||
EXPORT void Remove(const std::string& key);
|
||||
|
||||
private:
|
||||
Preferences(const std::string& component, Mode mode);
|
||||
|
@ -50,8 +50,8 @@ namespace musik { namespace core {
|
||||
ThreadGroup(ThreadGroup const&);
|
||||
ThreadGroup& operator=(ThreadGroup const&);
|
||||
public:
|
||||
ThreadGroup() {}
|
||||
~ThreadGroup()
|
||||
EXPORT ThreadGroup() {}
|
||||
EXPORT ~ThreadGroup()
|
||||
{
|
||||
for (std::list<std::thread*>::iterator it = threads.begin(), end = threads.end();
|
||||
it != end;
|
||||
@ -61,7 +61,7 @@ namespace musik { namespace core {
|
||||
}
|
||||
}
|
||||
|
||||
bool is_this_thread_in()
|
||||
EXPORT bool is_this_thread_in()
|
||||
{
|
||||
std::thread::id id = std::this_thread::get_id();
|
||||
std::shared_lock<std::shared_mutex> guard(m);
|
||||
@ -75,7 +75,7 @@ namespace musik { namespace core {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_thread_in(std::thread* thrd)
|
||||
EXPORT bool is_thread_in(std::thread* thrd)
|
||||
{
|
||||
if (thrd)
|
||||
{
|
||||
@ -97,7 +97,7 @@ namespace musik { namespace core {
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
std::thread* create_thread(F threadfunc)
|
||||
EXPORT std::thread* create_thread(F threadfunc)
|
||||
{
|
||||
std::lock_guard<std::shared_mutex> guard(m);
|
||||
std::unique_ptr<std::thread> new_thread(new std::thread(threadfunc));
|
||||
@ -105,7 +105,7 @@ namespace musik { namespace core {
|
||||
return new_thread.release();
|
||||
}
|
||||
|
||||
void add_thread(std::thread* thrd)
|
||||
EXPORT void add_thread(std::thread* thrd)
|
||||
{
|
||||
if (thrd)
|
||||
{
|
||||
@ -114,7 +114,7 @@ namespace musik { namespace core {
|
||||
}
|
||||
}
|
||||
|
||||
void remove_thread(std::thread* thrd)
|
||||
EXPORT void remove_thread(std::thread* thrd)
|
||||
{
|
||||
std::lock_guard<std::shared_mutex> guard(m);
|
||||
std::list<std::thread*>::iterator const it = std::find(threads.begin(), threads.end(), thrd);
|
||||
@ -124,7 +124,7 @@ namespace musik { namespace core {
|
||||
}
|
||||
}
|
||||
|
||||
void join_all()
|
||||
EXPORT void join_all()
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> guard(m);
|
||||
|
||||
@ -137,7 +137,7 @@ namespace musik { namespace core {
|
||||
}
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
EXPORT size_t size() const
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> guard(m);
|
||||
return threads.size();
|
||||
|
Loading…
x
Reference in New Issue
Block a user