Skip to content

Commit

Permalink
Determine PcmFormat from the stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Hangman committed Apr 25, 2024
1 parent 262b958 commit 93a61c2
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ public class PcmSoundSourceTest extends ApplicationAdapter {

@Override
public void create() {
final AudioConfig config = new AudioConfig();
config.setLogger(new ConsoleLogger(LogLevel.DEBUG_INFO_WARN_ERROR));
final AudioConfig config = new AudioConfig().setLogger(new ConsoleLogger(LogLevel.DEBUG_INFO_WARN_ERROR));
this.audio = Audio.init(config);
this.stream = new WavInputStream(Gdx.files.internal("numbers.wav"));
this.pcmSource = new PcmSoundSource(this.stream.getSampleRate(), PcmFormat.MONO_16_BIT);
PcmFormat format = PcmFormat.determineFormat(this.stream.getChannels(), this.stream.getBitsPerSample(),
this.stream.getPcmDataType());
assert format != null;
this.pcmSource = new PcmSoundSource(this.stream.getSampleRate(), format);
}


Expand Down

0 comments on commit 93a61c2

Please sign in to comment.