- if (cl_videosoundrate && (samples = S_RawSamples_QueueWantsMore()))
- {
- Con_DPrintf("%i = S_RawSamples_QueueWantsMore()\n", samples);
-
- // calculate how much source data we need to fill the output...
- s = samples * cl_videosoundrate / S_RawSamples_SampleRate();
-
- // reallocate processing buffer if needed
- if (cl_videosoundresamplelength < samples)
- {
- cl_videosoundresamplelength = samples + 100;
- if (cl_videosoundresampledata)
- Mem_Free(cl_videosoundresampledata);
- cl_videosoundresampledata = Mem_Alloc(clvideomempool, cl_videosoundresamplelength * sizeof(short[2]));
- }
-
- // reallocate loading buffer if needed
- if (cl_videosoundlength < s)
- {
- cl_videosoundlength = s + 100;
- if (cl_videosounddata)
- Mem_Free(cl_videosounddata);
- cl_videosounddata = Mem_Alloc(clvideomempool, cl_videosoundlength * sizeof(short[2]));
- }
-
- dpvsimpledecode_audio(cl_videostream, cl_videosounddata, s);
- S_ResampleBuffer16Stereo(cl_videosounddata, s, cl_videosoundresampledata, samples);
- S_RawSamples_Enqueue(cl_videosoundresampledata, samples);
- }