Пример #1
0
static inline void synthbuf(void)
{
    int32_t *outptr;
    int i = BUF_SIZE;

#ifndef SYNC
    if (lastswap == swap)
        return;
    lastswap = swap;

    outptr = (swap ? gmbuf : gmbuf+BUF_SIZE);
#else
    outptr = gmbuf;
#endif

    /* synth samples for as many whole ticks as we can fit in the buffer */
    for (; i >= number_of_samples; i -= number_of_samples)
    {
        synthSamples((int32_t*)outptr, number_of_samples);
        outptr += number_of_samples;
#ifndef SYNC
        /* synthbuf is called in interrupt context is SYNC is defined so it cannot yield
           that bug causing the sim to crach when not using SYNC should really be fixed */
        rb->yield();
#endif
        if (tick() == 0)
            quit = true;
    }

    /* how many samples did we write to the buffer? */
    samples_in_buf = BUF_SIZE-i;
}
Пример #2
0
static inline void synthbuf(void)
{
    int32_t *outptr;
    int i = BUF_SIZE;

#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
    rb->cpu_boost(true);
#endif
#ifndef SYNC
    if (lastswap == swap)
        return;
    lastswap = swap;

    outptr = (swap ? gmbuf : gmbuf+BUF_SIZE);
#else
    outptr = gmbuf;
#endif
    if (midi_end) {
        samples_in_buf = 0;
        return;
    }

    /* synth samples for as many whole ticks as we can fit in the buffer */
    for (; i >= number_of_samples; i -= number_of_samples)
    {
        synthSamples((int32_t*)outptr, number_of_samples);
        outptr += number_of_samples;
#ifndef SYNC
        /* synthbuf is called in interrupt context is SYNC is defined so it cannot yield
           that bug causing the sim to crach when not using SYNC should really be fixed */
        rb->yield();
#endif
        if (tick() == 0)
            midi_end = true;    /* no more midi data to play */
    }

    /* how many samples did we write to the buffer? */
    samples_in_buf = BUF_SIZE-i;
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
    rb->cpu_boost(false);
#endif
}