(self, frequency, duration, fill, loop, voice, volume)
Play a sound on the tone generator.
Play a sound on the tone generator.
Play a sound on the tone generator .
def emit_tone(self, frequency, duration, fill, loop, voice, volume):
        """Play a sound on the tone generator."""
        if frequency < 0:
            frequency = 0
        if self._multivoice and self._sound_on and 0 < frequency < 110.:
            # pcjr, tandy play low frequencies as 110Hz
            frequency = 110.
        # if a synch is requested, emit it at the first tone or pause
        if self._synch:
            self.emit_synch()
        # no sound if switched off
        # see https://www.vogons.org/viewtopic.php?t=56735&p=626006
        if not (self._beep_on or self._sound_on):
            volume = 0
        tone = signals.Event(signals.AUDIO_TONE, (voice, frequency, fill*duration, loop, volume))
        self._queues.audio.put(tone)
        self._voice_queue[voice].put(tone, None if loop else fill*duration, True)
        # separate gap event, except for legato (fill==1)
        if fill != 1 and not loop:
            gap = signals.Event(signals.AUDIO_TONE, (voice, 0, (1-fill) * duration, 0, 0))
            self._queues.audio.put(gap)
            self._voice_queue[voice].put(gap, (1-fill) * duration, False)
        if voice == 2 and frequency != 0:
            # reset linked noise frequencies
            # /2 because we're using a 0x4000 rotation rather than 0x8000
            self._noise_freq[3] = frequency / 2.
            self._noise_freq[7] = frequency / 2.
def emit_tone ( self , frequency , duration , fill , loop , voice , volume ) : if frequency < 0 : frequency = 0 if self . _multivoice and self . _sound_on and 0 < frequency < 110. : # pcjr, tandy play low frequencies as 110Hz frequency = 110. # if a synch is requested, emit it at the first tone or pause if self . _synch : self . emit_synch ( ) # no sound if switched off # see https://www.vogons.org/viewtopic.php?t=56735&p=626006 if not ( self . _beep_on or self . _sound_on ) : volume = 0 tone = signals . Event ( signals . AUDIO_TONE , ( voice , frequency , fill * duration , loop , volume ) ) self . _queues . audio . put ( tone ) self . _voice_queue [ voice ] . put ( tone , None if loop else fill * duration , True ) # separate gap event, except for legato (fill==1) if fill != 1 and not loop : gap = signals . Event ( signals . AUDIO_TONE , ( voice , 0 , ( 1 - fill ) * duration , 0 , 0 ) ) self . _queues . audio . put ( gap ) self . _voice_queue [ voice ] . put ( gap , ( 1 - fill ) * duration , False ) if voice == 2 and frequency != 0 : # reset linked noise frequencies # /2 because we're using a 0x4000 rotation rather than 0x8000 self . _noise_freq [ 3 ] = frequency / 2. self . _noise_freq [ 7 ] = frequency / 2.