Je me permets de rajouter un petit détail qui nous a mis sur la voie, en regardant le code source de Theodore (emulateur Core RetroArch), c'est que ce dernier se fonde exclusivement sur un taux d'échantillage à 22 Khz (et non pas 25 Khz comme DCMoto) et que, de fait, il y a environ 45 cycles par échantillon, qui se divise parfaitement pour 15 cycles, en 3.
Code : Tout sélectionner
#define AUDIO_SAMPLE_RATE 22050
void retro_run(void)
{
bool updated;
int i;
int mcycles; // nb of thousandths of cycles between 2 samples
int icycles; // integer number of cycles between 2 samples
int16_t audio_sample;
// 45 cycles of the 6809 at 992250 Hz = one sample at 22050 Hz
for(i = 0; i < AUDIO_SAMPLE_PER_FRAME; i++)
{
// Computes the nb of cycles between 2 samples and runs the emulation for this nb of cycles
// Nb of theoretical cycles for this period of time =
// theoretical number + previous remaining - cycles in excess during the previous period
mcycles = 1000 * CPU_FREQUENCY / AUDIO_SAMPLE_RATE; // theoretical thousandths of cycles
mcycles += excess; // corrected thousandths of cycles
icycles = mcycles / 1000; // integer number of cycles to run
excess = mcycles - 1000 * icycles; // remaining to do the next time
excess -= 1000 * Run(icycles); // remove thousandths in excess
audio_sample = GetAudioSample();
audio_stereo_buffer[(i << 1) + 0] = audio_stereo_buffer[(i << 1) + 1] = audio_sample;
}
...
...
Bon courage Daniel pour la résolution du petit problème.