Skip to content

Conversation

@Wilyicaro
Copy link
Contributor

No description provided.

#include <stdexcept>
#include <vector>

#ifdef _MSC_VER
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this, we don't need it.

#include "client/sound/SoundSystem.hpp"
#include "client/sound/SoundData.hpp"

#define SOUND_SYSTEM SoundSystemDS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this back on top


class SoundSystemDS : public SoundSystem
{
private:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this back to the top

@@ -0,0 +1,312 @@
#define WIN32_LEAN_AND_MEAN
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here, it should be right before the windows header

#define WIN32_LEAN_AND_MEAN
#include "SoundStreamDS.hpp"
#include "client/app/AppPlatform.hpp"
#include <cassert>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard stuff should go above our local headers


void SoundStreamDS::_deleteBuffers()
{
for (auto buffer : m_buffers)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't use foreach loops in C++98

// Verify buffers were created
if (m_buffers.size() != 2 || !m_source)
{
LOG_I("Failed to create DirectSound buffers or source");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use LOG_E

@@ -0,0 +1,52 @@
#pragma once
#include <windows.h>
#pragma comment(lib, "dsound.lib")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need these

SPDX-License-Identifier: BSD-1-Clause
********************************************************************/

#define WIN32_LEAN_AND_MEAN
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need this here

m_directsound->Release();
}

WAVEFORMATEX SoundSystemDS::_getWaveFormat(const PCMSoundHeader& header, float pitch) const
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go up here, since it's private.

Copy link
Collaborator

@BrentDaMage BrentDaMage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple minor things, but overall great.

// Re-fill buffers after restoration
for (size_t i = 0; i < m_buffers.size(); ++i)
{
if (!_stream(i))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleanup this deep if statement. ex: have it call continue if _stream is true

(lastWritePos >= m_bufferSize && writeCursor < m_bufferSize))
{
int bufferId = (currentSegment + 1) % 2;
if (!_stream(bufferId))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably cleanup this if as well

}

result = m_directsound->SetCooperativeLevel(m_hWnd, DSSCL_NORMAL);
result = m_directsound->SetCooperativeLevel(m_hWnd, DSSCL_PRIORITY);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? What does this do? Please put it in a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The normal cooperative level doesn't have enough control over the buffer, basically causing the sound streaming to not work at all

@BrentDaMage BrentDaMage merged commit f00596b into ReMinecraftPE:master Jan 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants