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