Skip to content

Commit

Permalink
Load 8-bit waves as unsigned (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
kometbomb committed Apr 13, 2019
1 parent e868233 commit 237ced7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
*.exe
zip/data/Default.kt
zip
.vscode/ipch/*
2 changes: 1 addition & 1 deletion klystron
Submodule klystron updated 2 files
+211 −191 src/snd/cyd.c
+6 −5 src/snd/cydchr.c
5 changes: 4 additions & 1 deletion src/diskop.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,10 @@ int open_wavetable(FILE *f)

if (w)
{
cyd_wave_entry_init(&mused.mus.cyd->wavetable_entries[mused.selected_wavetable], w->data, w->length, w->bits_per_sample == 16 ? CYD_WAVE_TYPE_SINT16 : CYD_WAVE_TYPE_SINT8, w->channels, 1, 1);
// http://soundfile.sapp.org/doc/WaveFormat/ says: "8-bit samples are stored as unsigned bytes, ranging from 0 to 255.
// 16-bit samples are stored as 2's-complement signed integers, ranging from -32768 to 32767."

cyd_wave_entry_init(&mused.mus.cyd->wavetable_entries[mused.selected_wavetable], w->data, w->length, w->bits_per_sample == 16 ? CYD_WAVE_TYPE_SINT16 : CYD_WAVE_TYPE_UINT8, w->channels, 1, 1);

mused.mus.cyd->wavetable_entries[mused.selected_wavetable].flags = 0;
mused.mus.cyd->wavetable_entries[mused.selected_wavetable].sample_rate = w->sample_rate;
Expand Down

0 comments on commit 237ced7

Please sign in to comment.