Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nBurnFPS is the frames per second, for 60hz it would be 6000, for 58.97 it would be 5897
- find all occurences of chip->sample_rate = in the register writes, and change to:
- chip->sample_rate = chip->master_clock / (16 * (chip->active_voices + 1));
- #define BURN_SND_CLIP(A) ((A) < -0x8000 ? -0x8000 : (A) > 0x7fff ? 0x7fff : (A))
- void ES5506Update(INT16 *pBuffer, INT32 samples)
- {
- INT32 *lsrc = chip->scratch, *rsrc = chip->scratch;
- #if MAKE_WAVS
- /* start the logging once we have a sample rate */
- if (chip->sample_rate)
- {
- if (!chip->wavraw)
- chip->wavraw = wav_open("raw.wav", chip->sample_rate, 2);
- }
- #endif
- INT32 rate = (chip->sample_rate * 100) / nBurnFPS;
- samples = rate;
- /* loop until all samples are output */
- while (samples)
- {
- INT32 length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples;
- INT32 samp;
- /* determine left/right source data */
- lsrc = chip->scratch;
- rsrc = chip->scratch + length;
- generate_samples(lsrc, rsrc, length);
- /* copy the data */
- INT32 len = (length * samples) / rate;
- for (samp = 0; samp < len; samp++)
- {
- INT32 k = (samp * rate) / samples;
- pBuffer[0] = BURN_SND_CLIP((INT32)((lsrc[k] >> 4) * chip->volume[0]));
- pBuffer[1] = BURN_SND_CLIP((INT32)((rsrc[k] >> 4) * chip->volume[1]));
- pBuffer += 2;
- }
- #if MAKE_WAVS
- /* log the raw data */
- if (chip->wavraw)
- wav_add_data_32lr(chip->wavraw, lsrc, rsrc, length, 4);
- #endif
- /* account for these samples */
- samples -= length;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement