- uint32 jerry_i2s_int_freq = (26591000 / 64) / (jerry_i2s_interrupt_divide + 1);
- jerry_i2s_interrupt_cycles_per_scanline = 13300000 / jerry_i2s_int_freq;
- jerry_i2s_interrupt_timer = jerry_i2s_interrupt_cycles_per_scanline;
- //WriteLog("jerry: i2s interrupt rate set to %i hz (every %i cpu clock cycles) jerry_i2s_interrupt_divide=%i\n",jerry_i2s_int_freq,jerry_i2s_interrupt_cycles_per_scanline,jerry_i2s_interrupt_divide);
- pcm_set_sample_rate(jerry_i2s_int_freq);
+ // We don't have to divide the RISC clock rate by this--the reason is a bit
+ // convoluted. Will put explanation here later...
+// What's needed here is to find the ratio of the frequency to the number of clock cycles
+// in one second. For example, if the sample rate is 44100, we divide the clock rate by
+// this: 26590906 / 44100 = 602 cycles.
+// Which means, every 602 cycles that go by we have to generate an interrupt.
+ jerryI2SCycles = 32 * (2 * (jerry_i2s_interrupt_divide + 1));