Skip to content

Commit

Permalink
samples
Browse files Browse the repository at this point in the history
  • Loading branch information
spessasus committed Oct 25, 2024
1 parent 3167695 commit 2493a57
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/spessasynth_lib/soundfont/dls/read_samples.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ export function readDLSSamples(waveListChunk)
{
throw new Error("No fmt chunk in the wave file!");
}
// https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.14393.0/shared/mmreg.h#L2108
const waveFormat = readLittleEndian(fmtChunk.chunkData, 2);
if (waveFormat !== 1)
{
throw new Error("Only PCM format in WAVE is supported.");
throw new Error(`Only PCM format in WAVE is supported. Fmt reports ${waveFormat}`);
}
const channelsAmount = readLittleEndian(fmtChunk.chunkData, 2);
if (channelsAmount !== 1)
{
throw new Error("Only mono samples are supported.");
throw new Error(`Only mono samples are supported. Fmt reports ${channelsAmount} channels`);
}
const sampleRate = readLittleEndian(fmtChunk.chunkData, 4);
// skip avg bytes
Expand Down

0 comments on commit 2493a57

Please sign in to comment.