mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-14 13:21:13 +00:00
Added plugin versioning.
This commit is contained in:
parent
6ec4418cfd
commit
cb4156dbac
@ -36,6 +36,8 @@
|
||||
|
||||
#include "CddaDecoderFactory.h"
|
||||
#include "CddaDataStreamFactory.h"
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
@ -43,10 +45,11 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
||||
}
|
||||
|
||||
class CddaDecoderPlugin : public musik::core::sdk::IPlugin {
|
||||
void Destroy() { delete this; };
|
||||
const char* Name() { return "CD Audio (CDDA) IDecoder"; };
|
||||
const char* Version() { return "0.3"; };
|
||||
const char* Author() { return "Björn Olievier, clangen"; };
|
||||
virtual void Destroy() { delete this; };
|
||||
virtual const char* Name() { return "CD Audio IDecoder, IDataStream"; }
|
||||
virtual const char* Version() { return "0.3"; }
|
||||
virtual const char* Author() { return "Björn Olievier, clangen"; }
|
||||
virtual int SdkVersion() { return musik::core::sdk::SdkVersion; }
|
||||
};
|
||||
|
||||
extern "C" __declspec(dllexport) musik::core::sdk::IPlugin* GetPlugin() {
|
||||
|
@ -57,9 +57,7 @@ class DirectSoundOut : public IOutput {
|
||||
~DirectSoundOut();
|
||||
|
||||
/* IPlugin */
|
||||
const char* Name() { return "DirectSound IOutput"; };
|
||||
const char* Version() { return "0.2"; };
|
||||
const char* Author() { return "clangen"; };
|
||||
virtual const char* Name() { return "DirectSound"; };
|
||||
virtual void Destroy();
|
||||
|
||||
/* IOutput */
|
||||
|
@ -34,15 +34,26 @@
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
|
||||
#include "DirectSoundOut.h"
|
||||
|
||||
class DirectSoundPlugin : public musik::core::sdk::IPlugin {
|
||||
public:
|
||||
virtual void Destroy() { delete this; }
|
||||
virtual const char* Name() { return "DirectSound IOutput"; };
|
||||
virtual const char* Version() { return "0.2"; };
|
||||
virtual const char* Author() { return "clangen"; };
|
||||
virtual int SdkVersion() { return musik::core::sdk::SdkVersion; }
|
||||
};
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) musik::core::sdk::IPlugin* GetPlugin() {
|
||||
return new DirectSoundOut();
|
||||
return new DirectSoundPlugin();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) musik::core::sdk::IOutput* GetAudioOutput() {
|
||||
|
@ -34,7 +34,9 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
|
||||
#include "FlacDecoderFactory.h"
|
||||
|
||||
#ifdef WIN32
|
||||
@ -50,10 +52,12 @@
|
||||
#endif
|
||||
|
||||
class FlacPlugin : public musik::core::sdk::IPlugin {
|
||||
void Destroy() { delete this; };
|
||||
const char* Name() { return "FLAC IDecoder"; }
|
||||
const char* Version() { return "0.3"; }
|
||||
const char* Author() { return "Daniel Önnerby, clangen"; }
|
||||
public:
|
||||
virtual void Destroy() { delete this; };
|
||||
virtual const char* Name() { return "FLAC IDecoder"; }
|
||||
virtual const char* Version() { return "0.3"; }
|
||||
virtual const char* Author() { return "Daniel Önnerby, clangen"; }
|
||||
virtual int SdkVersion() { return musik::core::sdk::SdkVersion; }
|
||||
};
|
||||
|
||||
extern "C" DLLEXPORT musik::core::sdk::IPlugin* GetPlugin() {
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "M4aDecoderFactory.h"
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@ -55,6 +57,7 @@ class AacDecoderPlugin : public musik::core::sdk::IPlugin {
|
||||
virtual const char* Name() { return "M4A IDecoder"; };
|
||||
virtual const char* Version() { return "0.3"; };
|
||||
virtual const char* Author() { return "Björn Olievier, clangen"; };
|
||||
virtual int SdkVersion() { return musik::core::sdk::SdkVersion; }
|
||||
};
|
||||
|
||||
extern "C" DLLEXPORT musik::core::sdk::IPlugin* GetPlugin() {
|
||||
|
@ -33,7 +33,10 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
|
||||
#include "NomadDecoderFactory.h"
|
||||
|
||||
#ifdef WIN32
|
||||
@ -53,6 +56,7 @@ class NomadPlugin : public musik::core::sdk::IPlugin {
|
||||
virtual const char* Name() { return "nomad IDecoder"; }
|
||||
virtual const char* Version() { return "0.1"; }
|
||||
virtual const char* Author() { return "clangen"; }
|
||||
virtual int SdkVersion() { return musik::core::sdk::SdkVersion; }
|
||||
};
|
||||
|
||||
extern "C" DLLEXPORT musik::core::sdk::IPlugin* GetPlugin() {
|
||||
|
@ -33,6 +33,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
#include "OggDecoderFactory.h"
|
||||
|
||||
@ -49,11 +50,12 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
||||
#endif
|
||||
|
||||
class OggDecoderPlugin : public musik::core::sdk::IPlugin {
|
||||
public:
|
||||
void Destroy() { delete this; };
|
||||
const char* Name() { return "Ogg IDecoder"; };
|
||||
const char* Version() { return "0.3"; };
|
||||
const char* Author() { return "Björn Olievier, clangen"; };
|
||||
public:
|
||||
virtual void Destroy() { delete this; };
|
||||
virtual const char* Name() { return "Ogg IDecoder"; }
|
||||
virtual const char* Version() { return "0.3"; }
|
||||
virtual const char* Author() { return "Björn Olievier, clangen"; }
|
||||
virtual int SdkVersion() { return musik::core::sdk::SdkVersion; }
|
||||
};
|
||||
|
||||
extern "C" DLLEXPORT musik::core::sdk::IPlugin* GetPlugin() {
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TaglibMetadataReader.h"
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@ -54,6 +55,7 @@ class TaglibPlugin : public musik::core::sdk::IPlugin {
|
||||
virtual const char* Name() { return "Taglib 1.11 IMetadataReader"; }
|
||||
virtual const char* Version() { return "0.3"; }
|
||||
virtual const char* Author() { return "Daniel Önnerby, clangen"; }
|
||||
int SdkVersion() { return musik::core::sdk::SdkVersion; }
|
||||
};
|
||||
|
||||
extern "C" DLLEXPORT musik::core::sdk::IMetadataReader* GetMetadataReader() {
|
||||
|
@ -53,9 +53,7 @@ class WasapiOut : public IOutput {
|
||||
~WasapiOut();
|
||||
|
||||
/* IPlugin */
|
||||
const char* Name() { return "Wasapi IOutput"; };
|
||||
const char* Version() { return "0.2"; };
|
||||
const char* Author() { return "clangen"; };
|
||||
virtual const char* Name() { return "WASAPI"; };
|
||||
virtual void Destroy();
|
||||
|
||||
/* IOutput */
|
||||
|
@ -34,15 +34,25 @@
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
#include "WasapiOut.h"
|
||||
|
||||
class WasapiPlugin : public musik::core::sdk::IPlugin {
|
||||
public:
|
||||
virtual void Destroy() { delete this; }
|
||||
virtual const char* Name() { return "Wasapi IOutput"; };
|
||||
virtual const char* Version() { return "0.2"; };
|
||||
virtual const char* Author() { return "clangen"; };
|
||||
virtual int SdkVersion() { return musik::core::sdk::SdkVersion; }
|
||||
};
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) musik::core::sdk::IPlugin* GetPlugin() {
|
||||
return new WasapiOut();
|
||||
return new WasapiPlugin();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) musik::core::sdk::IOutput* GetAudioOutput() {
|
||||
|
@ -50,9 +50,7 @@ class WaveOut : public IOutput {
|
||||
~WaveOut();
|
||||
|
||||
/* IPlugin */
|
||||
const char* Name() { return "WaveOut IOutput"; };
|
||||
const char* Version() { return "0.5"; };
|
||||
const char* Author() { return "Bj\xC3\xB6rn Olievier, clangen"; };
|
||||
virtual const char* Name() { return "WaveOut"; };
|
||||
virtual void Destroy();
|
||||
|
||||
/* IOutput */
|
||||
|
@ -33,15 +33,25 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.h"
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
#include "WaveOut.h"
|
||||
|
||||
class WaveOutPlugin : public musik::core::sdk::IPlugin {
|
||||
public:
|
||||
virtual void Destroy() { delete this; }
|
||||
virtual const char* Name() { return "WaveOut IOutput"; };
|
||||
virtual const char* Version() { return "0.5"; };
|
||||
virtual const char* Author() { return "Bj\xC3\xB6rn Olievier, clangen"; };
|
||||
virtual int SdkVersion() { return musik::core::sdk::SdkVersion; }
|
||||
};
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) musik::core::sdk::IPlugin* GetPlugin() {
|
||||
return new WaveOut();
|
||||
return new WaveOutPlugin();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) musik::core::sdk::IOutput* GetAudioOutput() {
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <shlwapi.h>
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/ISpectrumVisualizer.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
|
||||
@ -200,20 +201,21 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved) {
|
||||
return true;
|
||||
}
|
||||
|
||||
class VisualizerPlugin : public musik::core::sdk::IPlugin {
|
||||
public:
|
||||
virtual void Destroy() { delete this; }
|
||||
virtual const char* Name() { return "GdiVis"; };
|
||||
virtual const char* Version() { return "0.1.0"; };
|
||||
virtual const char* Author() { return "clangen"; };
|
||||
int SdkVersion() { return musik::core::sdk::SdkVersion; }
|
||||
};
|
||||
|
||||
class Visualizer : public musik::core::sdk::ISpectrumVisualizer {
|
||||
public:
|
||||
virtual const char* Name() {
|
||||
return "GdiVis";
|
||||
};
|
||||
|
||||
virtual const char* Version() {
|
||||
return "0.1.0";
|
||||
};
|
||||
|
||||
virtual const char* Author() {
|
||||
return "clangen";
|
||||
};
|
||||
|
||||
virtual void Destroy() {
|
||||
this->Hide();
|
||||
delete this;
|
||||
@ -259,7 +261,7 @@ class Visualizer : public musik::core::sdk::ISpectrumVisualizer {
|
||||
};
|
||||
|
||||
extern "C" DLL_EXPORT musik::core::sdk::IPlugin* GetPlugin() {
|
||||
return new Visualizer();
|
||||
return new VisualizerPlugin();
|
||||
}
|
||||
|
||||
extern "C" DLL_EXPORT musik::core::sdk::ISpectrumVisualizer* GetSpectrumVisualizer() {
|
||||
|
@ -33,3 +33,10 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#define NOMINMAX
|
||||
|
||||
#include <Windows.h>
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/sdk/IPlugin.h>
|
||||
#include <core/sdk/IPlaybackRemote.h>
|
||||
|
||||
@ -60,8 +61,8 @@ LRESULT CALLBACK ShellProc(int code, WPARAM wParam, LPARAM lParam) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ctrl = GetAsyncKeyState(VK_RCONTROL) & 0x8000;
|
||||
bool alt = GetAsyncKeyState(VK_RMENU) & 0x8000;
|
||||
bool ctrl = (bool) GetAsyncKeyState(VK_RCONTROL) & 0x8000;
|
||||
bool alt = (bool) GetAsyncKeyState(VK_RMENU) & 0x8000;
|
||||
//bool win = GetAsyncKeyState(VK_LWIN) & 0x8000;
|
||||
|
||||
if (ctrl && alt) {
|
||||
@ -134,21 +135,25 @@ class MMShellHook:
|
||||
public musik::core::sdk::IPlugin,
|
||||
public musik::core::sdk::IPlaybackRemote {
|
||||
public:
|
||||
void Destroy() {
|
||||
virtual void Destroy() {
|
||||
}
|
||||
|
||||
const char* Name() {
|
||||
virtual const char* Name() {
|
||||
return "win32globalhotkeys";
|
||||
}
|
||||
|
||||
const char* Version() {
|
||||
return "0.1";
|
||||
virtual const char* Version() {
|
||||
return "0.2.0";
|
||||
}
|
||||
|
||||
const char* Author() {
|
||||
virtual const char* Author() {
|
||||
return "clangen";
|
||||
}
|
||||
|
||||
virtual int SdkVersion() {
|
||||
return musik::core::sdk::SdkVersion;
|
||||
}
|
||||
|
||||
virtual void SetPlaybackService(musik::core::sdk::IPlaybackService* playback) {
|
||||
::playback = playback;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ bool Stream::OpenStream(std::string uri) {
|
||||
}
|
||||
|
||||
void Stream::OnBufferProcessedByPlayer(BufferPtr buffer) {
|
||||
this->RecycleBuffer(buffer);
|
||||
this->recycledBuffers.push_back(buffer);
|
||||
}
|
||||
|
||||
bool Stream::GetNextBufferFromDecoder() {
|
||||
@ -286,8 +286,3 @@ void Stream::ApplyDsp(BufferPtr buffer) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* marks a used buffer as recycled so it can be re-used later. */
|
||||
void Stream::RecycleBuffer(BufferPtr oldBuffer) {
|
||||
this->recycledBuffers.push_back(oldBuffer);
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
#include <core/plugin/PluginFactory.h>
|
||||
#include <core/config.h>
|
||||
#include <core/support/Common.h>
|
||||
@ -104,9 +105,15 @@ void PluginFactory::LoadPlugins() {
|
||||
CallGetPlugin getPluginCall = (CallGetPlugin) GetProcAddress(dll, "GetPlugin");
|
||||
|
||||
if (getPluginCall) {
|
||||
/* exists? add it! */
|
||||
this->loadedPlugins.push_back(getPluginCall());
|
||||
this->loadedDlls.push_back(dll);
|
||||
/* exists? check the version, and add it! */
|
||||
auto plugin = getPluginCall();
|
||||
if (plugin->SdkVersion() == musik::core::sdk::SdkVersion) {
|
||||
this->loadedPlugins.push_back(plugin);
|
||||
this->loadedDlls.push_back(dll);
|
||||
}
|
||||
else {
|
||||
FreeLibrary(dll);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* otherwise, free nad move on */
|
||||
@ -149,9 +156,14 @@ void PluginFactory::LoadPlugins() {
|
||||
*(void **)(&getPluginCall) = dlsym(dll, "GetPlugin");
|
||||
|
||||
if (getPluginCall) {
|
||||
musik::debug::info(TAG, "loaded: " + filename);
|
||||
this->loadedPlugins.push_back(getPluginCall());
|
||||
this->loadedDlls.push_back(dll);
|
||||
auto plugin = getPluginCall();
|
||||
if (plugin->SdkVersion() == musik::core::sdk::SdkVersion) {
|
||||
musik::debug::info(TAG, "loaded: " + filename);
|
||||
this->loadedPlugins.push_back(getPluginCall());
|
||||
this->loadedDlls.push_back(dll);
|
||||
}
|
||||
else {
|
||||
dlclose(dll);
|
||||
}
|
||||
else {
|
||||
dlclose(dll);
|
||||
|
@ -41,8 +41,9 @@
|
||||
|
||||
namespace musik { namespace core { namespace sdk {
|
||||
|
||||
class IOutput : public IPlugin {
|
||||
class IOutput {
|
||||
public:
|
||||
virtual void Destroy() = 0;
|
||||
virtual void Pause() = 0;
|
||||
virtual void Resume() = 0;
|
||||
virtual void SetVolume(double volume) = 0;
|
||||
@ -51,6 +52,7 @@ namespace musik { namespace core { namespace sdk {
|
||||
virtual int Play(IBuffer *buffer, IBufferProvider *provider) = 0;
|
||||
virtual void Drain() = 0;
|
||||
virtual double Latency() = 0;
|
||||
virtual const char* Name() = 0;
|
||||
};
|
||||
|
||||
} } }
|
||||
|
@ -42,6 +42,7 @@ namespace musik { namespace core { namespace sdk {
|
||||
virtual const char* Name() = 0;
|
||||
virtual const char* Version() = 0;
|
||||
virtual const char* Author() = 0;
|
||||
virtual int SdkVersion() = 0;
|
||||
};
|
||||
|
||||
} } }
|
||||
|
@ -38,11 +38,13 @@
|
||||
|
||||
namespace musik { namespace core { namespace sdk {
|
||||
|
||||
class IVisualizer : public IPlugin {
|
||||
class IVisualizer {
|
||||
public:
|
||||
virtual void Destroy() = 0;
|
||||
virtual void Show() = 0;
|
||||
virtual void Hide() = 0;
|
||||
virtual bool Visible() = 0;
|
||||
virtual const char* Name() = 0;
|
||||
};
|
||||
|
||||
} } }
|
||||
|
@ -77,4 +77,6 @@ namespace musik {
|
||||
ChannelSideLeft = 128,
|
||||
ChannelSideRight = 256
|
||||
};
|
||||
|
||||
static const int SdkVersion = 1;
|
||||
} } }
|
@ -297,8 +297,8 @@ void ConsoleLayout::ListPlugins() const {
|
||||
PluginList::iterator it = plugins.begin();
|
||||
for (; it != plugins.end(); it++) {
|
||||
std::string format =
|
||||
" " + std::string((*it)->Name()) + " "
|
||||
"v" + std::string((*it)->Version()) + "\n"
|
||||
" " + std::string((*it)->Name()) + "\n"
|
||||
" version: " + std::string((*it)->Version()) + "\n"
|
||||
" by " + std::string((*it)->Author()) + "\n";
|
||||
|
||||
this->output->WriteLine(format, COLOR_PAIR(CURSESPP_TEXT_DEFAULT));
|
||||
|
Loading…
x
Reference in New Issue
Block a user