Skip to content

Load Sound Data From Files#150

Merged
BrentDaMage merged 33 commits intonbcraft-org:masterfrom
TheBrokenRail:sound-v2
Jun 5, 2025
Merged

Load Sound Data From Files#150
BrentDaMage merged 33 commits intonbcraft-org:masterfrom
TheBrokenRail:sound-v2

Conversation

@TheBrokenRail
Copy link
Copy Markdown
Contributor

Fixes #119

This PR:

  • Modifies ReMCPE to load sound data from either .pcm or .ogg files instead of embedding it in the binary
  • Modifies the Python sound extractor to generate .pcm files
    • Also adds a Python scripts that extracts an APK, including both textures and sounds

TheBrokenRail and others added 15 commits April 20, 2025 23:57
* Fixed building on Windows + issues that could occur on non-Macs from stb_vorbis defining the "R" macro
* Fixed SoundSystemDS
* Fixed unmerged SoundEngine::playUI calls
* Added support for streaming sounds via SoundStream
* Added SoundStream base class and SoundStreamAL
* SoundEngine listener position
 * Fixed SoundStreamAL buffer re-use
 * Abstracted private SoundStreamAL functions
 * Added music to music_list.h
 * Moved AL_ERROR_CHECK to /thirdparty/OpenAL.h
 * Added AL_ERROR_SILENCE
Comment thread platforms/windows/projects/Client/Client.vcxproj Outdated
Comment thread platforms/windows/projects/Client/Client.vcxproj.filters Outdated
Comment thread platforms/windows/projects/Client/Client.vcxproj.filters Outdated

void Mob::baseTick()
{
m_oAttackAnim = m_attackAnim;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A good chunk of changes to this file seem to solely be indentation changes. These should probably be changed back to tabs, unless the project's code-style is being changed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is no code-styling dictated for spaces vs tabs. There are actually tons of places where they are inconsistently used. I would change this back, but it would take extra effort, and I am lazy.


while (size < _tempPcmBufferSize)
{
result = stb_vorbis_get_samples_short_interleaved(_decoder, _info.channels, _tempPcmBuffer + size, _tempPcmBufferSize - size);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shouldn't OGG decoding be in platform-agnostic code?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How would you suggest we abstract it out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe make an API where the core code can ask for a platform-agnostic buffer object, then upload the decoded data to that?

But putting decoding code in every sound backend (and we have three!) seems like a bad idea.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How does it look now?

@BrentDaMage
Copy link
Copy Markdown
Member

Damn, forgot to push. This should be all good to go imo, I'd just like someone to review it before it's merged upstream.

@BrentDaMage BrentDaMage added the enhancement New feature or request label Jun 4, 2025
@BrentDaMage
Copy link
Copy Markdown
Member

@TheBrokenRail could you please update the README.md file to reflect the new script you added?

@TheBrokenRail
Copy link
Copy Markdown
Contributor Author

Done!

@BrentDaMage BrentDaMage merged commit 1f85c64 into nbcraft-org:master Jun 5, 2025
7 checks passed
@BrentDaMage BrentDaMage mentioned this pull request Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Load Sounds From Filesystem

2 participants