Skip to content

Commit 09e037b

Browse files
committed
BugFix: MIX_CreateSineWaveAudio().
1 parent a4b9c63 commit 09e037b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/SDL_mixer.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,12 @@ MIX_Audio *MIX_CreateSineWaveAudio(MIX_Mixer *mixer, int hz, float amplitude)
12621262
if (!props) {
12631263
return NULL;
12641264
}
1265-
1265+
static uint8_t dummy[4] = {0, 0, 0, 0};
1266+
SDL_IOStream* io = SDL_IOFromConstMem(dummy, sizeof(dummy));
1267+
if (!io) {
1268+
return NULL;
1269+
}
1270+
SDL_SetPointerProperty(props, MIX_PROP_AUDIO_LOAD_IOSTREAM_POINTER, io); // required!
12661271
SDL_SetPointerProperty(props, MIX_PROP_AUDIO_LOAD_PREFERRED_MIXER_POINTER, mixer);
12671272
SDL_SetStringProperty(props, MIX_PROP_AUDIO_DECODER_STRING, "SINEWAVE");
12681273
SDL_SetNumberProperty(props, MIX_PROP_DECODER_SINEWAVE_HZ_NUMBER, hz);

0 commit comments

Comments
 (0)