Ejemplo n.º 1
0
def onTouched():
    if not isPhoneOnHook and not ba.busy(
            ba.CHAN_VOICE
    ) and phoneState == PHONE_STATE_DIAL and FEEL_PHRASE_CHANCE_PERCENT > random.randint(
            0, 100):
        phrase = random.choice(feelPhrases)
        ba.play(ba.CHAN_VOICE, phrase)
Ejemplo n.º 2
0
 def pickupRespond():
     delay = random.uniform(MIN_PICKUP_PHRASE_DELAY,
                            MAX_PICKUP_PHRASE_DELAY)
     time.sleep(delay)
     if not isPhoneOnHook and not ba.busy(ba.CHAN_VOICE):
         phrase = random.choice(pickupPhrases)
         ba.play(ba.CHAN_VOICE, phrase)
Ejemplo n.º 3
0
def doIdleSpeech():
    while True:
        if DARK_SCHEDULE.is_now() and phoneState == PHONE_STATE_IDLE:
            ba.channels[ba.CHAN_SPKR_A].unmute()
            if not ba.busy(ba.CHAN_SPKR_A):
                ba.play_loop(ba.CHAN_SPKR_A,
                             ambStatic,
                             fade_ms=DARK_STATIC_FADE_MS,
                             token=DARK_SFX_TOKEN)

        # Calculate delay before next cluster and wait
        delay = random.randint(MIN_PHRASE_DELAY, MAX_PHRASE_DELAY + 1)
        time.sleep(delay)

        # Check if it's the right time to talk
        dt = datetime.now()

        if DARK_SCHEDULE.is_now() and phoneState == PHONE_STATE_IDLE:
            # Determine phrase cluster size
            clusterSize = random.choice(CLUSTER_SIZES)
            for x in range(clusterSize):
                # Wait for playing to finish
                ba.wait(ba.CHAN_SPKR_B)
                # Choose random phrase and play it
                phrase = random.choice(phrases)
                ba.play(ba.CHAN_SPKR_B,
                        phrase,
                        volume=DARK_VOICE_VOLUME,
                        token=DARK_SFX_TOKEN)
                # Calculate delay before next phrase in cluster and wait
                clusterDelay = random.uniform(PHRASE_CLUSTER_DELAY_MIN,
                                              PHRASE_CLUSTER_DELAY_MAX)
                time.sleep(clusterDelay)
        elif phoneState == PHONE_STATE_IDLE:
            ba.stop(ba.CHAN_SPKR_A, fade_ms=DARK_STATIC_FADE_MS)