<commit_before>package org.yellcorp.lib.sound
{
import flash.events.SampleDataEvent;
import flash.media.Sound;
import flash.utils.ByteArray;


public class SoundSequencer
{
    private var _outputBufferSize:uint;

    private var cues:Array;
    private var sequenceSampleLength:Number;

    // the data from individual sounds are extracted into this ByteArray
    private var extractBuffer:ByteArray;

    // mixing buffers. during the mixing loop, one stores the accumulated
    // sum of the playing waves thus far, and the other is set to that sum
    // plus the next sound wave. A and B are swapped at the end of each
    // iteration
    private var mixingBufferA:ByteArray;
    private var mixingBufferB:ByteArray;

    // acts as a source of zero bytes when the first sound in the mixing
    // loop does not coincide exactly with the start of the packet
    private var zeroBuffer:ByteArray;

    public function SoundSequencer(outputBufferSize:uint = 8192)
    {
        if (outputBufferSize < 2048 || outputBufferSize > 8192)
        {
            throw new ArgumentError("outputBufferSize must be in the range 2048 to 8192");
        }
        _outputBufferSize = outputBufferSize;
        cues = [ ];

        extractBuffer = new ByteArray();
        mixingBufferA = new ByteArray();
        mixingBufferB = new ByteArray();
        zeroBuffer = createZeroBuffer(_outputBufferSize);
        sequenceSampleLength = 0;
    }

    public function cue(sound:Sound, sample:int):void
    {
        var newCue:Cue = new Cue(sound, sample);
        cues.push(newCue);
        if (newCue.endSample > sequenceSampleLength)
        {
            sequenceSampleLength = newCue.endSample;
        }
    }

    public function getSound():Sound
    {
        var userSound:Sound = new Sound();
        userSound.addEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData, false, 0, false);<commit_msg>Added a repeatCount parameter to SoundSequencer.cue<commit_after>package org.yellcorp.lib.sound
{
import flash.events.SampleDataEvent;
import flash.media.Sound;
import flash.utils.ByteArray;


public class SoundSequencer
{
    private var _outputBufferSize:uint;

    private var cues:Array;
    private var sequenceSampleLength:Number;

    // the data from individual sounds are extracted into this ByteArray
    private var extractBuffer:ByteArray;

    // mixing buffers. during the mixing loop, one stores the accumulated
    // sum of the playing waves thus far, and the other is set to that sum
    // plus the next sound wave. A and B are swapped at the end of each
    // iteration
    private var mixingBufferA:ByteArray;
    private var mixingBufferB:ByteArray;

    // acts as a source of zero bytes when the first sound in the mixing
    // loop does not coincide exactly with the start of the packet
    private var zeroBuffer:ByteArray;

    public function SoundSequencer(outputBufferSize:uint = 8192)
    {
        if (outputBufferSize < 2048 || outputBufferSize > 8192)
        {
            throw new ArgumentError("outputBufferSize must be in the range 2048 to 8192");
        }
        _outputBufferSize = outputBufferSize;
        cues = [ ];

        extractBuffer = new ByteArray();
        mixingBufferA = new ByteArray();
        mixingBufferB = new ByteArray();
        zeroBuffer = createZeroBuffer(_outputBufferSize);
        sequenceSampleLength = 0;
    }

    public function cue(sound:Sound, sample:int, repeatCount:int = 0):void
    {
        var newCue:Cue;

        do {
            newCue = new Cue(sound, sample);
            cues.push(newCue);
            sample += newCue.length;
            repeatCount--;
        } while (repeatCount >= 0);

        if (newCue.endSample > sequenceSampleLength)
        {
            sequenceSampleLength = newCue.endSample;
        }
    }

    public function getSound():Sound
    {
        var userSound:Sound = new Sound();
        userSound.addEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData, false, 0, false);
{'fraction_non_alphanumeric': 0.07328664332166084, 'fraction_numerical': 0.01150575287643822, 'mean_word_length': 2.7408793264733395, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4816463', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1052, 'n_words': 356}