X-Git-Url: https://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fengine%2Fe_soundfile_wav.pas;h=153cad427f4f1b58c94f60977644c9dedeb882ec;hp=84ea42df4c5c12068309086e75f61ff2941c2593;hb=f2b9872b69cf016222f45b3a6261116d9f23f4ff;hpb=05a8dcb37440aa1f010e418de05ecc153340956f diff --git a/src/engine/e_soundfile_wav.pas b/src/engine/e_soundfile_wav.pas index 84ea42d..153cad4 100644 --- a/src/engine/e_soundfile_wav.pas +++ b/src/engine/e_soundfile_wav.pas @@ -48,7 +48,7 @@ implementation uses {$IFDEF USE_SDL} - SDL, + SDL, cmem, {$ELSE} SDL2, {$ENDIF} @@ -89,8 +89,10 @@ begin AUDIO_U8, AUDIO_S8 : tformat := AUDIO_U8; (* yes, unsigned *) AUDIO_U16LSB, AUDIO_U16MSB: tformat := AUDIO_S16SYS; (* and yes, signed *) AUDIO_S16LSB, AUDIO_S16MSB: tformat := AUDIO_S16SYS; + {$IFDEF USE_SDL2} AUDIO_S32LSB, AUDIO_S32MSB: tformat := AUDIO_S16SYS; (* 32bit not supported in al core *) AUDIO_F32LSB, AUDIO_F32MSB: tformat := AUDIO_S16SYS; (* float not supported in al core *) + {$ENDIF} else result := false (* unsupported format *) end; if (result = true) and (format <> tformat) then @@ -98,7 +100,11 @@ begin Result := False; if SDL_BuildAudioCVT(@cvt, format, chan, rate, tformat, chan, rate) <> -1 then begin - buf := SDL_realloc(buf, len * cvt.len_mult); + {$IFDEF USE_SDL2} + buf := SDL_realloc(buf, len * cvt.len_mult); + {$ELSE} + buf := realloc(buf, len * cvt.len_mult); + {$ENDIF} cvt.len := len; cvt.buf := buf; result := SDL_ConvertAudio(@cvt) = 0;