Moved the base Decoder implementation out of the lullaby subfolder.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-10-23 21:32:20 -03:00
parent 0341fc1189
commit ddc4b06eba
12 changed files with 41 additions and 106 deletions
+1 -1
View File
@@ -27,7 +27,7 @@
// LOVE
#include "common/Data.h"
#include "Decoder.h"
#include "sound/Decoder.h"
// Core Audio
#include <AudioToolbox/AudioFormat.h>
-72
View File
@@ -1,72 +0,0 @@
/**
* Copyright (c) 2006-2016 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "Decoder.h"
#include "common/Exception.h"
namespace love
{
namespace sound
{
namespace lullaby
{
Decoder::Decoder(Data *data, const std::string &ext, int bufferSize)
: data(data)
, ext(ext)
, bufferSize(bufferSize)
, sampleRate(DEFAULT_SAMPLE_RATE)
, buffer(0)
, eof(false)
{
buffer = new char[bufferSize];
}
Decoder::~Decoder()
{
if (buffer != 0)
delete [](char *) buffer;
}
void *Decoder::getBuffer() const
{
return buffer;
}
int Decoder::getSize() const
{
return bufferSize;
}
int Decoder::getSampleRate() const
{
return sampleRate;
}
bool Decoder::isFinished()
{
return eof;
}
} // lullaby
} // sound
} // love
-79
View File
@@ -1,79 +0,0 @@
/**
* Copyright (c) 2006-2016 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_SOUND_LULLABY_DECODER_H
#define LOVE_SOUND_LULLABY_DECODER_H
// LOVE
#include "sound/Decoder.h"
#include "filesystem/File.h"
#include <string>
namespace love
{
namespace sound
{
namespace lullaby
{
class Decoder : public love::sound::Decoder
{
public:
Decoder(Data *data, const std::string &ext, int bufferSize);
virtual ~Decoder();
// Implement some of love::sound::Decoder, but allow subclasses
// to override them.
virtual void *getBuffer() const;
virtual int getSize() const;
virtual int getSampleRate() const;
virtual bool isFinished();
protected:
// The encoded data. This should be replaced with buffered file
// reads in the future.
StrongRef<Data> data;
// File extension.
std::string ext;
// When the decoder decodes data incrementally, it writes
// this many bytes at a time (at most).
int bufferSize;
// The desired frequency of the samples. 44100, 22050, or 11025.
int sampleRate;
// Holds internal memory.
void *buffer;
// Set this to true when eof has been reached.
bool eof;
}; // Decoder
} // lullaby
} // sound
} // love
#endif // LOVE_SOUND_LULLABY_DECODER_H
+1 -1
View File
@@ -25,7 +25,7 @@
// LOVE
#include "common/Data.h"
#include "Decoder.h"
#include "sound/Decoder.h"
#include <FLAC++/decoder.h>
#include <string.h>
+1 -1
View File
@@ -25,7 +25,7 @@
// LOVE
#include "common/Data.h"
#include "Decoder.h"
#include "sound/Decoder.h"
#ifdef LOVE_APPLE_USE_FRAMEWORKS
#include <Game_Music_Emu/gme.h>
+1 -1
View File
@@ -27,7 +27,7 @@
// LOVE
#include "common/Data.h"
#include "Decoder.h"
#include "sound/Decoder.h"
// libmodplug
#if defined(LOVE_ANDROID) || defined(LOVE_IOS)
+1 -1
View File
@@ -23,7 +23,7 @@
// LOVE
#include "common/Data.h"
#include "Decoder.h"
#include "sound/Decoder.h"
#ifndef LOVE_NOMPG123
+1 -1
View File
@@ -24,7 +24,7 @@
// LOVE
#include "common/Data.h"
#include "common/int.h"
#include "Decoder.h"
#include "sound/Decoder.h"
// vorbis
#define OV_EXCLUDE_STATIC_CALLBACKS
+1 -1
View File
@@ -23,7 +23,7 @@
// LOVE
#include "common/Data.h"
#include "Decoder.h"
#include "sound/Decoder.h"
#include "libraries/Wuff/wuff.h"