Cleaned up config.h usage, and moved core configuration into sdk/config.h (standard headers only!)

This commit is contained in:
casey 2016-05-04 00:11:45 -07:00
parent 7468b8d374
commit 1adb65cf37
17 changed files with 344 additions and 358 deletions

View File

@ -36,35 +36,11 @@
#pragma once
#include <string>
#include <core/sdk/config.h>
#include <utf8/utf8.h>
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <tchar.h>
typedef unsigned __int64 UINT64;
#define STDCALL(fp) (__stdcall* fp)()
#else
#include <cassert>
typedef unsigned long long UINT64;
typedef long long __int64; //TODO: Is this necessary?
#define STDCALL(fp) (* fp)() __attribute__((stdcall))
#define _ASSERT assert
#define TEXT(s) s //There's no TEXT() on linux. This makes the current uses of it compile for me... Jooles
#endif // WIN32
typedef UINT64 DBID;
typedef UINT64 VERSION;
typedef UINT64 DBTIME;

View File

@ -148,6 +148,7 @@
<ClInclude Include="playback\PlaybackQueue.h" />
<ClInclude Include="playback\Transport.h" />
<ClInclude Include="plugin\PluginFactory.h" />
<ClInclude Include="sdk\config.h" />
<ClInclude Include="sdk\IAnalyzer.h" />
<ClInclude Include="sdk\IBuffer.h" />
<ClInclude Include="sdk\IDecoder.h" />

View File

@ -312,5 +312,8 @@
<ClInclude Include="library\metadata\MetadataValue.h">
<Filter>src\library\metadata</Filter>
</ClInclude>
<ClInclude Include="sdk\config.h">
<Filter>src\sdk</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,23 +0,0 @@
// Contents of DLLDefines.h
#ifndef _musik_DLLDEFINES_H_
#define _musik_DLLDEFINES_H_
/* Cmake will define S on Windows when it
configures to build a shared library. If you are going to use
another build system on windows or create the visual studio
projects by hand you need to define S when
building a DLL on windows.
*/
// We are using the Visual Studio Compiler and building Shared libraries
#if defined (_WIN32)
#if defined(S)
#define __declspec(dllexport)
#else
#define __declspec(dllimport)
#endif /* S */
#else /* defined (_WIN32) */
#define
#endif
#endif /* _musik_DLLDEFINES_H_ */

View File

@ -33,56 +33,54 @@
#pragma once
#include <core/config.h>
#include "config.h"
#include "ITrack.h"
#include "IBuffer.h"
//////////////////////////////////////////////////////////////////////////////
namespace musik { namespace core { namespace audio {
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////
///\brief
///The main interface for a analyzer plugin
///
///A analyzer plugin will be executed from the Indexer
///after all tags has been read. The plugin will first be
///called with the Start method, and if that method returns true
///a audio::Stream will be opened and the whole track will be
///decoded and passed on to the Analyze method (or until the Analyze method
///returns false). Finally the End method will be called where the
///the plugin can make changes to the tracks metadata.
//////////////////////////////////////////
class IAnalyzer {
public:
//////////////////////////////////////////
///\brief
///Destroy the object
//////////////////////////////////////////
virtual void Destroy() = 0;
//////////////////////////////////////////
///\brief
///The main interface for a analyzer plugin
///
///A analyzer plugin will be executed from the Indexer
///after all tags has been read. The plugin will first be
///called with the Start method, and if that method returns true
///a audio::Stream will be opened and the whole track will be
///decoded and passed on to the Analyze method (or until the Analyze method
///returns false). Finally the End method will be called where the
///the plugin can make changes to the tracks metadata.
//////////////////////////////////////////
class IAnalyzer {
public:
//////////////////////////////////////////
///\brief
///Destroy the object
//////////////////////////////////////////
virtual void Destroy() = 0;
//////////////////////////////////////////
///\brief
///Start analyzing the track. Returns true if
///the analyzing should continue.
//////////////////////////////////////////
virtual bool Start(musik::core::ITrack *track) = 0;
//////////////////////////////////////////
///\brief
///Start analyzing the track. Returns true if
///the analyzing should continue.
//////////////////////////////////////////
virtual bool Start(musik::core::ITrack *track) = 0;
//////////////////////////////////////////
///\brief
///Analyze a buffer
//////////////////////////////////////////
virtual bool Analyze(musik::core::ITrack *track, IBuffer *buffer) = 0;
//////////////////////////////////////////
///\brief
///Analyze a buffer
//////////////////////////////////////////
virtual bool Analyze(musik::core::ITrack *track, IBuffer *buffer) = 0;
//////////////////////////////////////////
///\brief
///Called when the whole track has been analyzed.
///If this call makes changes to the track it should
///return true.
//////////////////////////////////////////
virtual bool End(musik::core::ITrack *track) = 0;
};
//////////////////////////////////////////
///\brief
///Called when the whole track has been analyzed.
///If this call makes changes to the track it should
///return true.
//////////////////////////////////////////
virtual bool End(musik::core::ITrack *track) = 0;
};
//////////////////////////////////////////////////////////////////////////////
} } }
//////////////////////////////////////////////////////////////////////////////

View File

@ -33,70 +33,66 @@
#pragma once
#include <core/config.h>
#include "config.h"
//////////////////////////////////////////////////////////////////////////////
namespace musik { namespace core { namespace audio {
//////////////////////////////////////////////////////////////////////////////
class IBuffer {
public:
class IBuffer {
public:
//////////////////////////////////////////
///\brief
///Get the samplerate of the buffer
//////////////////////////////////////////
virtual long SampleRate() const = 0;
//////////////////////////////////////////
///\brief
///Get the samplerate of the buffer
//////////////////////////////////////////
virtual long SampleRate() const = 0;
//////////////////////////////////////////
///\brief
///Set the buffers samplerate
//////////////////////////////////////////
virtual void SetSampleRate(long sampleRate) = 0;
//////////////////////////////////////////
///\brief
///Set the buffers samplerate
//////////////////////////////////////////
virtual void SetSampleRate(long sampleRate) = 0;
//////////////////////////////////////////
///\brief
///Get the number of channels of the buffer
//////////////////////////////////////////
virtual int Channels() const = 0;
//////////////////////////////////////////
///\brief
///Get the number of channels of the buffer
//////////////////////////////////////////
virtual int Channels() const = 0;
//////////////////////////////////////////
///\brief
///Set the number of channels of the buffer
//////////////////////////////////////////
virtual void SetChannels(int channels) = 0;
//////////////////////////////////////////
///\brief
///Set the number of channels of the buffer
//////////////////////////////////////////
virtual void SetChannels(int channels) = 0;
//////////////////////////////////////////
///\brief
///Get the pointer to the real buffer.
///
///The pointer may change when you set any of the buffers
///properties like samplerate, samples and channels
//////////////////////////////////////////
virtual float* BufferPointer() const = 0;
//////////////////////////////////////////
///\brief
///Get the pointer to the real buffer.
///
///The pointer may change when you set any of the buffers
///properties like samplerate, samples and channels
//////////////////////////////////////////
virtual float* BufferPointer() const = 0;
//////////////////////////////////////////
///\brief
///Get the number of samples in the buffer
///
///To clairify, one sample = one sample for each channel
///and that means that one sample = sizeof(float)*channels bytes big
//////////////////////////////////////////
virtual long Samples() const = 0;
//////////////////////////////////////////
///\brief
///Get the number of samples in the buffer
///
///To clairify, one sample = one sample for each channel
///and that means that one sample = sizeof(float)*channels bytes big
//////////////////////////////////////////
virtual long Samples() const = 0;
//////////////////////////////////////////
///\brief
///Set the number of samples in the buffer
//////////////////////////////////////////
virtual void SetSamples(long samples) = 0;
//////////////////////////////////////////
///\brief
///Set the number of samples in the buffer
//////////////////////////////////////////
virtual void SetSamples(long samples) = 0;
//////////////////////////////////////////
///\brief
///How many bytes does this object take
//////////////////////////////////////////
virtual long Bytes() const = 0;
};
//////////////////////////////////////////
///\brief
///How many bytes does this object take
//////////////////////////////////////////
virtual long Bytes() const = 0;
};
//////////////////////////////////////////////////////////////////////////////
} } }
//////////////////////////////////////////////////////////////////////////////

View File

@ -33,41 +33,37 @@
#pragma once
#include <core/config.h>
#include "config.h"
#include "IBuffer.h"
//////////////////////////////////////////////////////////////////////////////
namespace musik { namespace core { namespace audio {
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////
///\brief
///Main interface for dsp plugins.
///Each instance equals a track.
//////////////////////////////////////////
class IDSP {
public:
//////////////////////////////////////////
///\brief
///Destroy this object
//////////////////////////////////////////
virtual void Destroy() = 0;
//////////////////////////////////////////
///\brief
///Main interface for dsp plugins.
///Each instance equals a track.
//////////////////////////////////////////
class IDSP {
public:
//////////////////////////////////////////
///\brief
///Destroy this object
//////////////////////////////////////////
virtual void Destroy() = 0;
//////////////////////////////////////////
///\brief
///Process the buffer through the dsp plugin
///
///\param inputBuffer
///Buffer to process
///
///\param outputBuffer
///Empty buffer that you can write the processed inputBuffer to
///
///\return true if the buffer has been processed to the new outputBuffer.
//////////////////////////////////////////
virtual bool ProcessBuffers(const IBuffer *inputBuffer, IBuffer *outputBuffer) = 0;
};
//////////////////////////////////////////
///\brief
///Process the buffer through the dsp plugin
///
///\param inputBuffer
///Buffer to process
///
///\param outputBuffer
///Empty buffer that you can write the processed inputBuffer to
///
///\return true if the buffer has been processed to the new outputBuffer.
//////////////////////////////////////////
virtual bool ProcessBuffers(const IBuffer *inputBuffer, IBuffer *outputBuffer) = 0;
};
//////////////////////////////////////////////////////////////////////////////
} } }
//////////////////////////////////////////////////////////////////////////////

View File

@ -36,7 +36,7 @@
#pragma once
#include <core/config.h>
#include "config.h"
namespace musik { namespace core { namespace io {

View File

@ -36,49 +36,43 @@
#pragma once
#include <core/config.h>
#include "config.h"
#include "IDataStream.h"
//////////////////////////////////////////////////////////////////////////////
namespace musik{ namespace core{ namespace io {
//////////////////////////////////////////////////////////////////////////////
namespace musik { namespace core { namespace io {
class IDataStreamFactory{
public:
class IDataStreamFactory{
public:
//////////////////////////////////////////
///\brief
///Can the factory read the specified filename
///
///\param filename
///Filename to check
///
///\returns
///True if able
//////////////////////////////////////////
virtual bool CanReadFile(const char *filename)=0;
//////////////////////////////////////////
///\brief
///Can the factory read the specified filename
///
///\param filename
///Filename to check
///
///\returns
///True if able
//////////////////////////////////////////
virtual bool CanReadFile(const char *filename)=0;
//////////////////////////////////////////
///\brief
///Open the file for reading
///
///\param filename
///Filename to open
///
///\returns
///IDataStream object or NULL on fail
//////////////////////////////////////////
virtual IDataStream* OpenFile(const char *filename,unsigned int options=0)=0;
//////////////////////////////////////////
///\brief
///Open the file for reading
///
///\param filename
///Filename to open
///
///\returns
///IDataStream object or NULL on fail
//////////////////////////////////////////
virtual IDataStream* OpenFile(const char *filename,unsigned int options=0)=0;
//////////////////////////////////////////
///\brief
///Destroy the object (not the file)
//////////////////////////////////////////
virtual void Destroy()=0;
};
//////////////////////////////////////////
///\brief
///Destroy the object (not the file)
//////////////////////////////////////////
virtual void Destroy()=0;
};
//////////////////////////////////////////////////////////////////////////////
} } }
//////////////////////////////////////////////////////////////////////////////

View File

@ -33,58 +33,52 @@
#pragma once
#include <core/config.h>
#include "config.h"
#include "IDataStream.h"
#include "IBuffer.h"
//////////////////////////////////////////////////////////////////////////////
namespace musik { namespace core { namespace audio {
//////////////////////////////////////////////////////////////////////////////
class IDecoder{
class IDecoder {
public:
//////////////////////////////////////////
///\brief
///Destroy the object
///
///The Destroy method is used so that it's guaranteed that the object is
///destroyed inside the right DLL/exe
//////////////////////////////////////////
virtual void Destroy() = 0;
public:
//////////////////////////////////////////
///\brief
///Set the position in the source (in seconds)
///
///\returns
///The actual position set
//////////////////////////////////////////
virtual double SetPosition(double seconds, double totalLength) = 0;
//////////////////////////////////////////
///\brief
///Destroy the object
///
///The Destroy method is used so that it's guaranteed that the object is
///destroyed inside the right DLL/exe
//////////////////////////////////////////
virtual void Destroy() = 0;
//////////////////////////////////////////
///\brief
///Fill the next buffer
///
///\returns
///false is there is nothing left
//////////////////////////////////////////
virtual bool GetBuffer(IBuffer *buffer) = 0;
//////////////////////////////////////////
///\brief
///Set the position in the source (in seconds)
///
///\returns
///The actual position set
//////////////////////////////////////////
virtual double SetPosition(double seconds, double totalLength) = 0;
//////////////////////////////////////////
///\brief
///Open the stream
///
///\param fileStream
///pointer to the filestream object.
///
///\returns
///True if successfully opened
//////////////////////////////////////////
virtual bool Open(musik::core::io::IDataStream *fileStream) = 0;
};
//////////////////////////////////////////
///\brief
///Fill the next buffer
///
///\returns
///false is there is nothing left
//////////////////////////////////////////
virtual bool GetBuffer(IBuffer *buffer) = 0;
//////////////////////////////////////////
///\brief
///Open the stream
///
///\param fileStream
///pointer to the filestream object.
///
///\returns
///True if successfully opened
//////////////////////////////////////////
virtual bool Open(musik::core::io::IDataStream *fileStream) = 0;
};
//////////////////////////////////////////////////////////////////////////////
}}} // NS
//////////////////////////////////////////////////////////////////////////////
} } }

View File

@ -33,40 +33,36 @@
#pragma once
#include <core/config.h>
#include "config.h"
#include "IDecoder.h"
//////////////////////////////////////////////////////////////////////////////
namespace musik { namespace core { namespace audio {
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////
///\brief
///Interface for decoder plugins to be able to create
///instances of IDecoder
//////////////////////////////////////////
class IDecoderFactory{
public:
//////////////////////////////////////////
///\brief
///Create a instance of the decoder
//////////////////////////////////////////
virtual IDecoder* CreateDecoder() = 0;
//////////////////////////////////////////
///\brief
///Interface for decoder plugins to be able to create
///instances of IDecoder
//////////////////////////////////////////
class IDecoderFactory{
public:
//////////////////////////////////////////
///\brief
///Create a instance of the decoder
//////////////////////////////////////////
virtual IDecoder* CreateDecoder() = 0;
//////////////////////////////////////////
///\brief
///Destroy the object
//////////////////////////////////////////
virtual void Destroy() = 0;
//////////////////////////////////////////
///\brief
///Destroy the object
//////////////////////////////////////////
virtual void Destroy() = 0;
//////////////////////////////////////////
///\brief
///Can this plugin handle this kind of filetype?
///The "type" can either be a file extension or a mimetype
//////////////////////////////////////////
virtual bool CanHandle(const char* type) const = 0;
};
//////////////////////////////////////////
///\brief
///Can this plugin handle this kind of filetype?
///The "type" can either be a file extension or a mimetype
//////////////////////////////////////////
virtual bool CanHandle(const char* type) const = 0;
};
//////////////////////////////////////////////////////////////////////////////
}}} // NS
//////////////////////////////////////////////////////////////////////////////
} } }

View File

@ -36,7 +36,7 @@
#pragma once
#include <core/config.h>
#include "config.h"
#include "ITrack.h"
namespace musik { namespace core { namespace Plugin {

View File

@ -30,61 +30,57 @@
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <core/config.h>
#include "config.h"
#include "IDataStream.h"
#include "IBuffer.h"
#include "IPlayer.h"
//////////////////////////////////////////////////////////////////////////////
namespace musik { namespace core { namespace audio {
//////////////////////////////////////////////////////////////////////////////
class IOutput{
class IOutput {
public:
public:
//////////////////////////////////////////
///\brief
///Destroy the object
///
///The Destroy method is used so that it's guaranteed that the object is
///destroyed inside the right DLL/exe
//////////////////////////////////////////
virtual void Destroy() = 0;
//////////////////////////////////////////
///\brief
///Destroy the object
///
///The Destroy method is used so that it's guaranteed that the object is
///destroyed inside the right DLL/exe
//////////////////////////////////////////
virtual void Destroy() = 0;
//////////////////////////////////////////
///\brief
///Pause the current output
//////////////////////////////////////////
virtual void Pause() = 0;
//////////////////////////////////////////
///\brief
///Pause the current output
//////////////////////////////////////////
virtual void Pause() = 0;
//////////////////////////////////////////
///\brief
///resume a paused output
//////////////////////////////////////////
virtual void Resume() = 0;
//////////////////////////////////////////
///\brief
///resume a paused output
//////////////////////////////////////////
virtual void Resume() = 0;
//////////////////////////////////////////
///\brief
///Set the volume on this output
//////////////////////////////////////////
virtual void SetVolume(double volume) = 0;
//////////////////////////////////////////
///\brief
///Set the volume on this output
//////////////////////////////////////////
virtual void SetVolume(double volume) = 0;
//////////////////////////////////////////
///\brief
///Clear internal buffers. Used when setting new position in a stream
//////////////////////////////////////////
virtual void Stop() = 0;
//////////////////////////////////////////
///\brief
///Clear internal buffers. Used when setting new position in a stream
//////////////////////////////////////////
virtual void Stop() = 0;
//////////////////////////////////////////
///\brief
///Play this buffer
//////////////////////////////////////////
virtual bool Play(IBuffer *buffer, IPlayer *player) = 0;
};
//////////////////////////////////////////
///\brief
///Play this buffer
//////////////////////////////////////////
virtual bool Play(IBuffer *buffer, IPlayer *player) = 0;
};
//////////////////////////////////////////////////////////////////////////////
}}} // NS
//////////////////////////////////////////////////////////////////////////////
} } }

View File

@ -30,29 +30,26 @@
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <core/config.h>
#include "config.h"
#include "IBuffer.h"
//////////////////////////////////////////////////////////////////////////////
namespace musik { namespace core { namespace audio {
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////
///\brief
///Interface for the audio::Player to make IOuput plugins be able to make callbacks
//////////////////////////////////////////
class IPlayer {
public:
//////////////////////////////////////////
///\brief
///Release used by the output to notify the player a buffer has finished
///processing.
//////////////////////////////////////////
virtual void OnBufferProcessedByOutput(IBuffer *buffer) = 0;
};
//////////////////////////////////////////
///\brief
///Interface for the audio::Player to make IOuput plugins be able to make callbacks
//////////////////////////////////////////
class IPlayer {
public:
//////////////////////////////////////////
///\brief
///Release used by the output to notify the player a buffer has finished
///processing.
//////////////////////////////////////////
virtual void OnBufferProcessedByOutput(IBuffer *buffer) = 0;
};
//////////////////////////////////////////////////////////////////////////////
} } }
//////////////////////////////////////////////////////////////////////////////

View File

@ -36,13 +36,17 @@
#pragma once
#include "config.h"
namespace musik { namespace core {
class IPlugin{
class IPlugin {
public:
virtual void Destroy() = 0;
virtual const char* Name() = 0;
virtual const char* Version() = 0;
virtual const char* Author() = 0;
};
} }

View File

@ -36,20 +36,19 @@
#pragma once
#include <core/config.h>
#include "config.h"
namespace musik{ namespace core{
namespace musik { namespace core {
//////////////////////////////////////////
///\brief
///The virtual base for all tracks
//////////////////////////////////////////
class ITrack {
class ITrack {
public:
virtual void SetValue(const char* metakey, const char* value) = 0;
virtual void ClearValue(const char* metakey) = 0;
virtual void SetThumbnail(const char *data, long size) = 0;
};
} }

59
src/core/sdk/config.h Executable file
View File

@ -0,0 +1,59 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, Daniel Önnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <string>
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <tchar.h>
typedef unsigned __int64 UINT64;
#define STDCALL(fp) (__stdcall* fp)()
#else
#include <cassert>
typedef unsigned long long UINT64;
typedef long long __int64;
#define STDCALL(fp) (* fp)() __attribute__((stdcall))
#define _ASSERT assert
#endif