# Changes 0.2.4-2
- Document the rest of th elibs - remove sound.hpp header
This commit is contained in:
@ -27,17 +27,27 @@ SOFTWARE.
|
||||
|
||||
namespace PD {
|
||||
namespace Music {
|
||||
/**
|
||||
* Decoder Template class
|
||||
*/
|
||||
class Decoder : public SmartCtor<Decoder> {
|
||||
public:
|
||||
Decoder() {}
|
||||
virtual ~Decoder() {}
|
||||
Decoder() = default;
|
||||
virtual ~Decoder() = default;
|
||||
|
||||
/** Template Init function */
|
||||
virtual int Init(const std::string& path) = 0;
|
||||
/** Template deinit function */
|
||||
virtual void Deinit() = 0;
|
||||
/** Template function to get sample rate */
|
||||
virtual u32 GetSampleRate() = 0;
|
||||
/** template function to get number of channels */
|
||||
virtual u8 GetChannels() = 0;
|
||||
/** template function to get buffer size */
|
||||
virtual size_t GetBufSize() = 0;
|
||||
/** template decode function */
|
||||
virtual u64 Decode(u16* buf_address) = 0;
|
||||
/** template function to get file sanples if exist */
|
||||
virtual size_t GetFileSamples() = 0;
|
||||
};
|
||||
} // namespace Music
|
||||
|
@ -27,25 +27,42 @@ SOFTWARE.
|
||||
|
||||
namespace PD {
|
||||
namespace Music {
|
||||
/**
|
||||
* Music Metadata Data Holder
|
||||
*/
|
||||
class MetaData {
|
||||
public:
|
||||
MetaData() {}
|
||||
~MetaData() {}
|
||||
MetaData() = default;
|
||||
~MetaData() = default;
|
||||
|
||||
/** Getter for name */
|
||||
std::string Name() const { return name; }
|
||||
/** Getter for album */
|
||||
std::string Album() const { return album; }
|
||||
/** Getter for year */
|
||||
std::string Year() const { return year; }
|
||||
/** Getter for Title */
|
||||
std::string Title() const { return title; }
|
||||
/** Getter for Artist */
|
||||
std::string Artist() const { return artist; }
|
||||
/** Getter for [what is this] */
|
||||
std::string Mdt() const { return mdt; }
|
||||
/** Gettr for file path */
|
||||
std::string Path() const { return path; }
|
||||
|
||||
/** Setter for Name */
|
||||
void Name(const std::string &v) { name = v; }
|
||||
/** Setter for Album */
|
||||
void Album(const std::string &v) { album = v; }
|
||||
/** Settr for Year */
|
||||
void Year(const std::string &v) { year = v; }
|
||||
/** Settr for Title */
|
||||
void Title(const std::string &v) { title = v; }
|
||||
/** Settr for Artist */
|
||||
void Artist(const std::string &v) { artist = v; }
|
||||
/** Settr for [what is this] */
|
||||
void Mdt(const std::string &v) { mdt = v; }
|
||||
/** Settr for Path */
|
||||
void Path(const std::string &v) { path = v; }
|
||||
|
||||
private:
|
||||
|
@ -29,17 +29,27 @@ SOFTWARE.
|
||||
|
||||
namespace PD {
|
||||
namespace Music {
|
||||
/**
|
||||
* MP3 Decoder
|
||||
*/
|
||||
class Mp3Decoder : public Decoder {
|
||||
public:
|
||||
Mp3Decoder() {}
|
||||
~Mp3Decoder() {}
|
||||
Mp3Decoder() = default;
|
||||
~Mp3Decoder() = default;
|
||||
|
||||
/** Init Funciton to load file and Init decoder */
|
||||
int Init(const std::string& path) override;
|
||||
/** Unload Decoder */
|
||||
void Deinit() override;
|
||||
/** Get Sample Rate */
|
||||
u32 GetSampleRate() override;
|
||||
/** Get Channels */
|
||||
u8 GetChannels() override;
|
||||
/** Get Buffer Size */
|
||||
size_t GetBufSize() override;
|
||||
/** Decode next data */
|
||||
u64 Decode(u16* buf_address) override;
|
||||
/** Get File Samples if exist */
|
||||
size_t GetFileSamples() override;
|
||||
|
||||
private:
|
||||
|
@ -29,6 +29,9 @@ SOFTWARE.
|
||||
|
||||
namespace PD {
|
||||
namespace Music {
|
||||
/**
|
||||
* Music Player
|
||||
*/
|
||||
class Player : public SmartCtor<Player> {
|
||||
public:
|
||||
Player() {}
|
||||
|
@ -1,46 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
MIT License
|
||||
Copyright (c) 2024 - 2025 René Amthor (tobid7)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
#include <pd/common/common.hpp>
|
||||
#include <pd/common/memory.hpp>
|
||||
|
||||
namespace PD {
|
||||
class Sound : public SmartCtor<Sound> {
|
||||
public:
|
||||
Sound();
|
||||
~Sound();
|
||||
|
||||
void Play();
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
u32 dataSize;
|
||||
ndspWaveBuf wavBuf;
|
||||
std::vector<u8, LinearAllocator<u8>> dat;
|
||||
int channel;
|
||||
};
|
||||
} // namespace PD
|
Reference in New Issue
Block a user