Fix rendering issue in audio_raw_stream.c example (#2608)

This commit is contained in:
TheManTheMythTheGameDev 2022-08-02 23:36:23 -07:00 committed by GitHub
parent 1a35f73d84
commit 090e47dca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -135,6 +135,11 @@ int main(void)
{ {
data[i] = (short)(sinf(((2*PI*(float)i/waveLength)))*32000); data[i] = (short)(sinf(((2*PI*(float)i/waveLength)))*32000);
} }
// Make sure the rest of the line is flat
for (int j = waveLength*2; j < MAX_SAMPLES; j++)
{
data[j] = (short)0;
}
// Scale read cursor's position to minimize transition artifacts // Scale read cursor's position to minimize transition artifacts
//readCursor = (int)(readCursor * ((float)waveLength / (float)oldWavelength)); //readCursor = (int)(readCursor * ((float)waveLength / (float)oldWavelength));