mirror of
https://github.com/jorio/Pomme.git
synced 2024-09-27 12:55:59 +00:00
Compare commits
3 Commits
ad9cc177d2
...
fd1cd2cf81
Author | SHA1 | Date | |
---|---|---|---|
|
fd1cd2cf81 | ||
|
d83a70ea70 | ||
|
8152ef04c9 |
@ -32,6 +32,7 @@
|
|||||||
#define GetEOF Pomme_GetEOF
|
#define GetEOF Pomme_GetEOF
|
||||||
#define GetFPos Pomme_GetFPos
|
#define GetFPos Pomme_GetFPos
|
||||||
#define GetHandleSize Pomme_GetHandleSize
|
#define GetHandleSize Pomme_GetHandleSize
|
||||||
|
#define GetPtrSize Pomme_GetPtrSize
|
||||||
#define GetResInfo Pomme_GetResInfo
|
#define GetResInfo Pomme_GetResInfo
|
||||||
#define GetResource Pomme_GetResource
|
#define GetResource Pomme_GetResource
|
||||||
#define GetResourceSizeOnDisk Pomme_GetResourceSizeOnDisk
|
#define GetResourceSizeOnDisk Pomme_GetResourceSizeOnDisk
|
||||||
|
@ -655,6 +655,9 @@ void DrawChar(char c)
|
|||||||
dstRect.right = dstRect.left + SysFont::widthBits;
|
dstRect.right = dstRect.left + SysFont::widthBits;
|
||||||
dstRect.bottom = dstRect.top + SysFont::rows;
|
dstRect.bottom = dstRect.top + SysFont::rows;
|
||||||
|
|
||||||
|
// Advance pen position
|
||||||
|
penX += glyph.width;
|
||||||
|
|
||||||
Rect clippedDstRect = dstRect;
|
Rect clippedDstRect = dstRect;
|
||||||
if (!IntersectRects(&curPort->port.portRect, &clippedDstRect))
|
if (!IntersectRects(&curPort->port.portRect, &clippedDstRect))
|
||||||
{
|
{
|
||||||
@ -688,6 +691,4 @@ void DrawChar(char c)
|
|||||||
|
|
||||||
dst2 += curPort->pixels.width;
|
dst2 += curPort->pixels.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
penX += glyph.width;
|
|
||||||
}
|
}
|
||||||
|
@ -61,56 +61,35 @@ namespace cmixer
|
|||||||
double pan; // Pan set by `cm_set_pan()`
|
double pan; // Pan set by `cm_set_pan()`
|
||||||
std::function<void()> onComplete; // Callback
|
std::function<void()> onComplete; // Callback
|
||||||
|
|
||||||
|
private:
|
||||||
void ClearPrivate();
|
void ClearPrivate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Source();
|
Source();
|
||||||
|
|
||||||
void Init(int samplerate, int length);
|
void Init(int samplerate, int length);
|
||||||
|
|
||||||
virtual void RewindImplementation() = 0;
|
virtual void RewindImplementation() = 0;
|
||||||
|
|
||||||
virtual void ClearImplementation() = 0;
|
virtual void ClearImplementation() = 0;
|
||||||
|
|
||||||
virtual void FillBuffer(int16_t* buffer, int length) = 0;
|
virtual void FillBuffer(int16_t* buffer, int length) = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~Source();
|
virtual ~Source();
|
||||||
|
|
||||||
void RemoveFromMixer();
|
void RemoveFromMixer();
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
void Rewind();
|
void Rewind();
|
||||||
|
|
||||||
void RecalcGains();
|
void RecalcGains();
|
||||||
|
|
||||||
void FillBuffer(int offset, int length);
|
void FillBuffer(int offset, int length);
|
||||||
|
|
||||||
void Process(int len);
|
void Process(int len);
|
||||||
|
|
||||||
double GetLength() const;
|
double GetLength() const;
|
||||||
|
|
||||||
double GetPosition() const;
|
double GetPosition() const;
|
||||||
|
|
||||||
int GetState() const;
|
int GetState() const;
|
||||||
|
|
||||||
void SetGain(double gain);
|
void SetGain(double gain);
|
||||||
|
|
||||||
void SetPan(double pan);
|
void SetPan(double pan);
|
||||||
|
|
||||||
void SetPitch(double pitch);
|
void SetPitch(double pitch);
|
||||||
|
|
||||||
void SetLoop(bool loop);
|
void SetLoop(bool loop);
|
||||||
|
|
||||||
void SetInterpolation(bool interpolation);
|
void SetInterpolation(bool interpolation);
|
||||||
|
|
||||||
void Play();
|
void Play();
|
||||||
|
|
||||||
void Pause();
|
void Pause();
|
||||||
|
|
||||||
void TogglePause();
|
void TogglePause();
|
||||||
|
|
||||||
void Stop();
|
void Stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -124,42 +103,31 @@ namespace cmixer
|
|||||||
std::vector<char> userBuffer;
|
std::vector<char> userBuffer;
|
||||||
|
|
||||||
void ClearImplementation() override;
|
void ClearImplementation() override;
|
||||||
|
|
||||||
void RewindImplementation() override;
|
void RewindImplementation() override;
|
||||||
|
|
||||||
void FillBuffer(int16_t* buffer, int length) override;
|
void FillBuffer(int16_t* buffer, int length) override;
|
||||||
|
|
||||||
inline uint8_t* data8() const
|
inline uint8_t* data8() const { return reinterpret_cast<uint8_t*>(span.data()); }
|
||||||
{ return reinterpret_cast<uint8_t*>(span.data()); }
|
inline int16_t* data16() const { return reinterpret_cast<int16_t*>(span.data()); }
|
||||||
|
|
||||||
inline int16_t* data16() const
|
|
||||||
{ return reinterpret_cast<int16_t*>(span.data()); }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WavStream();
|
WavStream();
|
||||||
|
void Init(int theSampleRate, int theBitDepth, int nChannels, bool bigEndian, std::span<char> data);
|
||||||
void Init(
|
|
||||||
int theSampleRate,
|
|
||||||
int theBitDepth,
|
|
||||||
int nChannels,
|
|
||||||
bool bigEndian,
|
|
||||||
std::span<char> data
|
|
||||||
);
|
|
||||||
|
|
||||||
std::span<char> GetBuffer(int nBytesOut);
|
std::span<char> GetBuffer(int nBytesOut);
|
||||||
|
|
||||||
std::span<char> SetBuffer(std::vector<char>&& data);
|
std::span<char> SetBuffer(std::vector<char>&& data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Guard class that safely removes the source from the mixer when the guard object is destroyed.
|
||||||
|
class SourceMixGuard
|
||||||
|
{
|
||||||
|
Source& source;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SourceMixGuard(Source& theSource) : source(theSource) {}
|
||||||
|
~SourceMixGuard() { source.RemoveFromMixer(); }
|
||||||
|
};
|
||||||
|
|
||||||
void InitWithSDL();
|
void InitWithSDL();
|
||||||
|
|
||||||
void ShutdownWithSDL();
|
void ShutdownWithSDL();
|
||||||
|
|
||||||
double GetMasterGain();
|
double GetMasterGain();
|
||||||
|
|
||||||
void SetMasterGain(double);
|
void SetMasterGain(double);
|
||||||
|
|
||||||
WavStream LoadWAVFromFile(const char* path);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user