SDL: Add code snipped to migrate from AudioCVT interface

From b1f365374b71d1d456394588039f30363b59d51b Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Sun, 22 Jan 2023 21:51:40 +0100
Subject: [PATCH] Add code snipped to migrate from AudioCVT interface

---
 docs/README-migration.md | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/docs/README-migration.md b/docs/README-migration.md
index f073d94b07b5..6fea417ac7a8 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -56,6 +56,30 @@ SDL_FreeWAV has been removed and calls can be replaced with SDL_free.
 
 SDL_AudioCVT interface is removed, SDL_AudioStream can be used instead.
 
+Code that used to look like this:
+```c
+    SDL_AudioCVT cvt;
+    SDL_BuildAudioCVT(&cvt, spec.format, spec.channels, spec.freq, spec.format, cvtchans, cvtfreq);
+    cvt.len = len;
+    cvt.buf = (Uint8 *) SDL_malloc(len * cvt.len_mult);
+    SDL_memcpy(cvt.buf, data, len);
+    SDL_ConvertAudio(&cvt);
+    do_something(cvt.buf, cvt.len_cvt);
+```
+should be changed to:
+```c
+    SDL_AudioStream *stream = SDL_CreateAudioStream(spec.format, spec.channels, spec.freq, spec.format, cvtchans, cvtfreq);
+    int src_samplesize = (SDL_AUDIO_BITSIZE(spec.format) / 8) * spec.channels;
+    int src_len = len & ~(src_samplesize - 1); // need to be rounded to samplesize
+    SDL_PutAudioStreamData(stream, data, src_len);
+    SDL_FlushAudioStream(stream);
+    int dst_len = expected_dst_len & ~(dst_samplesize - 1); // need to be rounded to samplesize
+    Uint8 *dst_buf = (Uint8 *)SDL_malloc(dst_len);
+    int real_dst_len = SDL_GetAudioStreamData(stream, dst_buf, dst_len);
+    do_something(dst_buf, real_dst_len);
+```
+
+
 The following functions have been renamed:
 * SDL_AudioStreamAvailable() => SDL_GetAudioStreamAvailable()
 * SDL_AudioStreamClear() => SDL_ClearAudioStream()