<commit_before>"""SoundInterval module: contains the SoundInterval class"""

from PandaModules import *
from Interval import *

class SoundInterval(Interval):
    # Name counter
    soundNum = 1
    # create SoundInterval DirectNotify category
    notify = directNotify.newCategory('SoundInterval')
    # Class methods
    # Create a sound interval
    # If loop = 0, sound will play once, duration of the interval
    # equals the duration of the sound
    # If loop = 1, the sound will loop for the specified duration
    # If no duration is specified, sound will loop for the duration
    # of the sound, i.e. it will only play once.....usually, there
    # seems to be some timing in the audio such that the stop doesn't
    # kill the looping sound until the next time around if duration
    # of the interval equals duration of the sound
    def __init__(self, sound, loop = 0, duration = 0.0, name = None):
        """__init__(sound, loop, name)
        """
        # Generate unique name
        id = 'Sound-%d' % SoundInterval.soundNum
        SoundInterval.soundNum += 1
        # Record instance variables
        self.sound = sound
        self.loop = loop
        self.wantSound = base.wantAnySound
        # If no duration given use sound's duration as interval's duration
        if duration == 0.0:
            if self.wantSound:
                duration = self.sound.length()
            else:
                # This will screw up any intervals that base their
                # time on the duration of this sound interval
                print ('SoundInterval: Warning, want-sound #f,'+
                       ' zero sound duration assumed')
                duration = 0.0
        # Generate unique name if necessary
        if (name == None):
            name = id
        # Initialize superclass<commit_msg>*** empty log message ***<commit_after>"""SoundInterval module: contains the SoundInterval class"""

from PandaModules import *
from Interval import *

class SoundInterval(Interval):
    # Name counter
    soundNum = 1
    # create SoundInterval DirectNotify category
    notify = directNotify.newCategory('SoundInterval')
    # Class methods
    # Create a sound interval
    # If loop = 0, sound will play once, duration of the interval
    # equals the duration of the sound
    # If loop = 1, the sound will loop for the specified duration
    # If no duration is specified, sound will loop for the duration
    # of the sound, i.e. it will only play once.....usually, there
    # seems to be some timing in the audio such that the stop doesn't
    # kill the looping sound until the next time around if duration
    # of the interval equals duration of the sound
    def __init__(self, sound, loop = 0, duration = 0.0, name = None):
        """__init__(sound, loop, name)
        """
        # Generate unique name
        id = 'Sound-%d' % SoundInterval.soundNum
        SoundInterval.soundNum += 1
        # Record instance variables
        self.sound = sound
        self.loop = loop
        self.wantSound = base.wantAnySound
        # If no duration given use sound's duration as interval's duration
        if duration == 0.0:
            if self.wantSound:
                duration = self.sound.length()
		if (duration == 0):
		    self.notify.warning('zero length duration!')
            else:
                # This will screw up any intervals that base their
                # time on the duration of this sound interval
                print ('SoundInterval: Warning, want-sound #f,'+
                       ' zero sound duration assumed')
                duration = 0.0
        # Generate unique name if necessary
        if (name == None):
            name = id
        # Initialize superclass
{'fraction_non_alphanumeric': 0.07381652848355175, 'fraction_numerical': 0.006151377373629313, 'mean_word_length': 2.202054794520548, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4874724', 'n_tokens_mistral': 936, 'n_tokens_neox': 895, 'n_words': 405}