Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added wav and mp3 loading #3482

Closed

Conversation

KiritoDv
Copy link
Contributor

@KiritoDv KiritoDv commented Dec 1, 2023

This PR adds WAV/MP3 loading directly into soh, its still missing a retro change but this is going to be done in a few hours, in the meantime im adding a python script for testing

Script: https://gist.github.com/KiritoDv/8b1445bc05bb7f62e814cfff33115e10

Build Artifacts

Copy link
Contributor

@briaguya-ai briaguya-ai left a comment

Choose a reason for hiding this comment

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

very cool to see how cleanly this could be adapted to the factory patterns!

soh/soh/resource/importer/AudioSampleFactory.cpp Outdated Show resolved Hide resolved
soh/soh/resource/importer/AudioSampleFactory.cpp Outdated Show resolved Hide resolved
soh/soh/resource/type/AudioSample.h Outdated Show resolved Hide resolved
}

factory->ParseFileBinary(reader, resource);

return resource;
}

void LUS::AudioCustomSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I misunderstand how these are supposed to be set up, but this doesn't seem consistent with the current patterns around supporting both binary and XML reading of resources. I would think this would be a ParseFileWav and ParseFileMP3 on the AudioSampleFactoryV0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not the case because the header differs, putting everything on that factory is going to make things harder

@KiritoDv
Copy link
Contributor Author

KiritoDv commented Dec 1, 2023

This could be revolutionary. MP3, Wav, and Flac support? Nice! Can you also add OGG support?

I like the idea but i need to find a good single-header library for it, there is one that works for miniaudio too but it need some fixes

@briaguya-ai
Copy link
Contributor

@KiritoDv is there an LUS pr for this yet? if so could you link it? if not could you make one and link it?

Copy link
Contributor

@inspectredc inspectredc left a comment

Choose a reason for hiding this comment

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

LGTM!

/* 3 */ CODEC_SMALL_ADPCM,
/* 4 */ CODEC_REVERB,
/* 5 */ CODEC_S16
} SampleCodec;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this enum needed? We already have it in z64audio.h

soh/include/z64audio.h Outdated Show resolved Hide resolved
@briaguya-ai
Copy link
Contributor

i'm going to try closing and re-opening to see if that kicks off builds

@briaguya-ai briaguya-ai closed this May 3, 2024
@briaguya-ai briaguya-ai reopened this May 3, 2024
@briaguya-ai
Copy link
Contributor

briaguya-ai commented May 3, 2024

made an otr that replaces every sample with https://freesound.org/people/HerbertBoland/sounds/33369/

freesound.otr.zip

it seems to not work for everything but since i mostly made this to be able to test a migration of this over to the reworked resource factory framework i found a way to test it

  • Open audio editor
  • Play battle music
  • Hear it as popping sounds (it's kind of silly but fun)

@briaguya-ai
Copy link
Contributor

i'm going to close this because it relies on the pre "resource refactory" resource factories. i made an attempt to migrate it to the new factories here #4106, so we can both reference this and that when moving forward with this

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.

4 participants