소스 검색

Corrected bug sound playing twice

Samples count was not properly calculated on WAV loading
pull/210/head
Ray 8 년 전
부모
커밋
4a9b77dd70
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. +4
    -2
      src/audio.c

+ 4
- 2
src/audio.c 파일 보기

@ -1083,11 +1083,13 @@ static Wave LoadWAV(const char *fileName)
// Read in the sound data into the soundData variable // Read in the sound data into the soundData variable
fread(wave.data, waveData.subChunkSize, 1, wavFile); fread(wave.data, waveData.subChunkSize, 1, wavFile);
// Now we set the variables that we need later
wave.sampleCount = waveData.subChunkSize;
// Store wave parameters
wave.sampleRate = waveFormat.sampleRate; wave.sampleRate = waveFormat.sampleRate;
wave.sampleSize = waveFormat.bitsPerSample; wave.sampleSize = waveFormat.bitsPerSample;
wave.channels = waveFormat.numChannels; wave.channels = waveFormat.numChannels;
// NOTE: subChunkSize comes in bytes, we need to translate it to number of samples
wave.sampleCount = waveData.subChunkSize/(waveFormat.bitsPerSample/8);
TraceLog(INFO, "[%s] WAV file loaded successfully (SampleRate: %i, SampleSize: %i, Channels: %i)", fileName, wave.sampleRate, wave.sampleSize, wave.channels); TraceLog(INFO, "[%s] WAV file loaded successfully (SampleRate: %i, SampleSize: %i, Channels: %i)", fileName, wave.sampleRate, wave.sampleSize, wave.channels);
} }

불러오는 중...
취소
저장