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

Multi-Channel Audio playback #96

Open
wants to merge 38 commits into
base: stable
Choose a base branch
from
Open

Multi-Channel Audio playback #96

wants to merge 38 commits into from

Conversation

dvijayak
Copy link
Member

This PR adds multi-channel audio support to MTY_Audio for Windows and macOS. The MTY_AudioCreate function has been enhanced with the ability to specify multi-channel audio parameters. All platforms have been changed to respect these parameters however proper surround sound audio will only work on Windows and macOS at the moment.

…mat for both multi-channel audio and PS5 haptics audio.
…Ds as a signal for choosing the default audio device.
…pecification of the audio format the device should initialize for playback.
…oid too. However, actual surround sound audio won't be rendered on those platforms.
@dvijayak dvijayak added 2. Review requested You have coded your code, and can now be reviewed. Test Matoya This runs the Matoya tests in CI labels Sep 5, 2024
@dvijayak dvijayak marked this pull request as ready for review September 9, 2024 18:01
Copy link

@Kodikuu Kodikuu left a comment

Choose a reason for hiding this comment

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

I understand on Windows and macOS are the current targets, but I've made not of what's missing and provided documentation links for Android and Linux to receive support for this too. Android may be easy, though Linux looks a little more involved.

The only required change is the issue with the description

src/matoya.h Outdated Show resolved Hide resolved
src/unix/apple/audio.c Outdated Show resolved Hide resolved
src/unix/apple/audio.c Outdated Show resolved Hide resolved
src/unix/apple/audio.c Outdated Show resolved Hide resolved
src/unix/linux/android/audio.c Outdated Show resolved Hide resolved
src/unix/linux/x11/audio.c Outdated Show resolved Hide resolved
@Kodikuu Kodikuu added 1. Coding Feature has been described inside of the parsec branch, and you are coding on it. and removed 2. Review requested You have coded your code, and can now be reviewed. labels Sep 10, 2024
@dvijayak dvijayak added 2. Review requested You have coded your code, and can now be reviewed. and removed 1. Coding Feature has been described inside of the parsec branch, and you are coding on it. labels Sep 13, 2024
@dvijayak dvijayak requested a review from Kodikuu September 13, 2024 01:03
Copy link

@bmcnett bmcnett left a comment

Choose a reason for hiding this comment

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

don't see any obvious problems

@Namaneo Namaneo added 3. 2nd review stage 2nd opinion has reviewed the code. and removed 2. Review requested You have coded your code, and can now be reviewed. labels Sep 16, 2024
@dvijayak dvijayak added 2. Review requested You have coded your code, and can now be reviewed. and removed 1. Coding Feature has been described inside of the parsec branch, and you are coding on it. labels Nov 6, 2024
@dvijayak dvijayak added 3. 2nd review stage 2nd opinion has reviewed the code. 2. Review requested You have coded your code, and can now be reviewed. and removed 2. Review requested You have coded your code, and can now be reviewed. 3. 2nd review stage 2nd opinion has reviewed the code. labels Nov 12, 2024
src/matoya.h Outdated Show resolved Hide resolved
src/matoya.h Outdated Show resolved Hide resolved
src/audio-common.h Outdated Show resolved Hide resolved
src/unix/apple/audio.c Outdated Show resolved Hide resolved
src/unix/apple/audio.c Show resolved Hide resolved
src/unix/linux/android/audio.c Outdated Show resolved Hide resolved
src/unix/linux/x11/audio.c Outdated Show resolved Hide resolved
@dvijayak dvijayak added 1. Coding Feature has been described inside of the parsec branch, and you are coding on it. 2. Review requested You have coded your code, and can now be reviewed. and removed 2. Review requested You have coded your code, and can now be reviewed. 1. Coding Feature has been described inside of the parsec branch, and you are coding on it. labels Dec 3, 2024
@dvijayak dvijayak added 3. 2nd review stage 2nd opinion has reviewed the code. and removed 2. Review requested You have coded your code, and can now be reviewed. labels Dec 13, 2024

} else {
pwfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
pwfx.Format.cbSize = 22;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know the documentation states "should be bigger than 22", I think this should be set to:

Suggested change
pwfx.Format.cbSize = 22;
pwfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE);

Copy link
Member Author

@dvijayak dvijayak Dec 19, 2024

Choose a reason for hiding this comment

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

Actually, 22 is correct but it is misleading. The more accurate way to write it is:

pwfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);

Why? Because docs say that the value is the total bytes of data appended to the WAVEFORMATEX struct. Not the total bytes of the whole struct.
image
image

I have made this change now, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. 2nd review stage 2nd opinion has reviewed the code. Test Matoya This runs the Matoya tests in CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants