public static void mixer_play_streamed_sample_16(int ch, ShortPtr data, int len, int freq) {

        int/*UINT32*/ step_size, input_pos, output_pos, samples_mixed;
        int mixing_volume;

        /* skip if sound is off */
        if (Machine.sample_rate == 0) {
            return;
        }
        mixer_channel[ch].is_stream = true;

        /* compute the overall mixing volume */
        if (mixer_sound_enabled != 0) {
            mixing_volume = ((mixer_channel[ch].volume * mixer_channel[ch].mixing_level * 256) << mixer_channel[ch].gain) / (100 * 100);
        } else {
            mixing_volume = 0;
        }
        /* compute the step size for sample rate conversion */
        if (freq != mixer_channel[ch].frequency) {
            /*RECHECK*/ mixer_channel[ch].frequency = /*uint32)*/ (int) freq;
            /*RECHECK*/ mixer_channel[ch].step_size = (/*UINT32*/int) ((double) freq * (double) (1 << FRACTION_BITS) / (double) Machine.sample_rate);
        }
        step_size = mixer_channel[ch].step_size;

        /* now determine where to mix it */
        input_pos = mixer_channel[ch].input_frac;
        output_pos = (accum_base + mixer_channel[ch].samples_available) & ACCUMULATOR_MASK;

        /* compute the length in fractional form */
        len = (len / 2) << FRACTION_BITS;
        samples_mixed = 0;

        /* if we're mono or left panning, just mix to the left channel */
        if (!is_stereo || mixer_channel[ch].pan == MIXER_PAN_LEFT) {
            while (input_pos < len) {
                left_accum[output_pos] += ((short) data.read((int) (input_pos >> FRACTION_BITS)) * mixing_volume) >> 8;
                input_pos += step_size;
                output_pos = (output_pos + 1) & ACCUMULATOR_MASK;
                samples_mixed++;
            }
        } /* if we're right panning, just mix to the right channel */ else if (mixer_channel[ch].pan == MIXER_PAN_RIGHT) {
            while (input_pos < len) {
                right_accum[output_pos] += ((short) data.read((int) (input_pos >> FRACTION_BITS)) * mixing_volume) >> 8;
                input_pos += step_size;
                output_pos = (output_pos + 1) & ACCUMULATOR_MASK;
                samples_mixed++;
            }
        } /* if we're stereo center, mix to both channels */ else {
            while (input_pos < len) {
                int mixing_value = ((short) data.read((int) (input_pos >> FRACTION_BITS)) * mixing_volume) >> 8;
                left_accum[output_pos] += mixing_value;
                right_accum[output_pos] += mixing_value;
                input_pos += step_size;
                output_pos = (output_pos + 1) & ACCUMULATOR_MASK;
                samples_mixed++;
            }
        }
        /* update the final positions */
        mixer_channel[ch].input_frac = input_pos & FRACTION_MASK;
        mixer_channel[ch].samples_available += samples_mixed;
    }