mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 12:31:15 +00:00
Add assert for buffer
This commit is contained in:
parent
61c760d9d4
commit
9546ecbd9e
@ -96,6 +96,7 @@ class MxWavePresenter : public MxSoundPresenter {
|
|||||||
struct {
|
struct {
|
||||||
ma_audio_buffer buffer;
|
ma_audio_buffer buffer;
|
||||||
MxU8* data;
|
MxU8* data;
|
||||||
|
MxU32 length;
|
||||||
MxU32 offset;
|
MxU32 offset;
|
||||||
} m_ab;
|
} m_ab;
|
||||||
|
|
||||||
|
|||||||
@ -59,6 +59,7 @@ void MxWavePresenter::Destroy(MxBool p_fromDestructor)
|
|||||||
MxBool MxWavePresenter::WriteToSoundBuffer(void* p_audioPtr, MxU32 p_length)
|
MxBool MxWavePresenter::WriteToSoundBuffer(void* p_audioPtr, MxU32 p_length)
|
||||||
{
|
{
|
||||||
if (m_action->IsLooping()) {
|
if (m_action->IsLooping()) {
|
||||||
|
assert(m_ab.offset + p_length <= m_ab.length);
|
||||||
memcpy(m_ab.data + m_ab.offset, p_audioPtr, p_length);
|
memcpy(m_ab.data + m_ab.offset, p_audioPtr, p_length);
|
||||||
m_ab.offset += p_length;
|
m_ab.offset += p_length;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -136,7 +137,8 @@ void MxWavePresenter::StartingTickle()
|
|||||||
sampleRate
|
sampleRate
|
||||||
);
|
);
|
||||||
|
|
||||||
m_ab.data = new MxU8[ma_get_bytes_per_frame(format, channels) * sizeInFrames];
|
m_ab.length = ma_get_bytes_per_frame(format, channels) * sizeInFrames;
|
||||||
|
m_ab.data = new MxU8[m_ab.length];
|
||||||
|
|
||||||
ma_audio_buffer_config config =
|
ma_audio_buffer_config config =
|
||||||
ma_audio_buffer_config_init(format, channels, sizeInFrames, m_ab.data, NULL);
|
ma_audio_buffer_config_init(format, channels, sizeInFrames, m_ab.data, NULL);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user