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

[1.7.10] Mono is played in a single speaker #68

Open
xunto opened this issue Jul 16, 2018 · 0 comments
Open

[1.7.10] Mono is played in a single speaker #68

xunto opened this issue Jul 16, 2018 · 0 comments

Comments

@xunto
Copy link

xunto commented Jul 16, 2018

It looks like this mod (at least 1.7.10) is not mantained anymore but maybe somebody can help me with this problem.

I found out that mono sounds are played in single speaker.

In the code it's hardcoded not to use amount of channels defined by given file but always assume there is 2 channels. Here:

private AudioFormat getOutFormat(AudioFormat inFormat) {
final int ch = inFormat.getChannels();
final float rate = inFormat.getSampleRate();
return new AudioFormat(Encoding.PCM_SIGNED, 44100, 16, 2, 4, 44100, false);
}

That's obviously the reason. That's why (format.getChannels() > 1) ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16 will always return AL10.AL_FORMAT_STEREO16

AL10.alBufferData(this.buffer.get(0), (format.getChannels() > 1) ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16, data, (int)format.getSampleRate());

But I also found out that with AL10.AL_FORMAT_MONO16 sound doesn't appear at all. I'm not really good in OpenAL can sombody help me to fx this?

I used these files while testing:
mono: http://music.konungstvo.ru/fall_of_the_magister.mp3
stereo: http://music.konungstvo.ru/fall_of_the_magister_stereo.mp3

@xunto xunto changed the title [1.7.10] Mono is played in single speaker [1.7.10] Mono is played in single a speaker Jul 16, 2018
@xunto xunto changed the title [1.7.10] Mono is played in single a speaker [1.7.10] Mono is played in a single speaker Jul 16, 2018
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

No branches or pull requests

1 participant