예제 #1
0
 def rec_device(self, text):
     registry_writer.write(r"SOFTWARE\\virtual audio player\\rec device",
                           text)
     registry_writer.write(r"SOFTWARE\\virtual audio player\\rec device id",
                           str(self.recdevices[text]))
     global rec_device, rec_device_id, selflisten
     rec_device = text
     rec_device_id = self.recdevices[text]
     selflisten.running = False
     selflisten = listner.listen(rec_device_id, actual_playback_device_id)
     selflisten.start()
예제 #2
0
 def on_release(self, key):
     global selflisten, actualmiclisten, pushtotalkpressed
     if playerthread.is_alive() == False:
         if hasattr(key, 'char'):
             if key.char == pushtotalkkey[0]:
                 while pushtotalkpressed == True:
                     if selflisten.is_alive() == False:
                         if actualmiclisten.is_alive():
                             actualmiclisten.running = False
                             while actualmiclisten.is_alive():
                                 sleep(0.01)
                             selflisten = listner.listen(
                                 rec_device_id, actual_playback_device_id)
                             selflisten.start()
                             pushtotalkpressed = False
예제 #3
0
 def on_press(self, key):
     global playerthread, actualmiclisten
     if playerthread.is_alive() == False:
         if actualmiclisten.is_alive() == False:
             if hasattr(key, 'char'):
                 if key.char == pushtotalkkey[0]:
                     playerthread.stop()
                     selflisten.running = False
                     actualmiclisten = listner.listen(
                         actual_rec_device_id, playback_device_id)
                     actualmiclisten.start()
                     global pushtotalkpressed
                     pushtotalkpressed = True
     if hasattr(key, 'vk') and 96 <= key.vk <= 105:
         global firstplay, secondplay
         if key.vk - 97 < len(buttons) and key.vk - 97 != -1:
             secondplay = int(time() * 1000.0)
             if secondplay - firstplay >= 100:
                 firstplay = secondplay
                 if pushtotalkpressed == False:
                     if playerthread.is_alive():
                         playerthread.stop()
                     if playervar == "pygame":
                         playerthread = player.player_pygame(
                             buttons[key.vk - 97], playback_device,
                             pushtotalkkey, pushtotalk)
                     else:
                         playerthread = player.player_pyaudio(
                             buttons[key.vk - 97], int(playback_device_id),
                             pushtotalkkey, pushtotalk)
                     playerthread.start()
         if key.vk - 96 == 0:
             playerthread.stop()
     if type(key) == Key:
         if key == key.f1:
             if functionkeys["f1"] != "None":
                 foldername.set(functionkeys["f1"])
         elif key == key.f2:
             if functionkeys["f2"] != "None":
                 foldername.set(functionkeys["f2"])
         elif key == key.f3:
             if functionkeys["f3"] != "None":
                 foldername.set(functionkeys["f3"])
         elif key == key.f4:
             if functionkeys["f4"] != "None":
                 foldername.set(functionkeys["f4"])
         elif key == key.f5:
             if functionkeys["f5"] != "None":
                 foldername.set(functionkeys["f5"])
         elif key == key.f6:
             if functionkeys["f6"] != "None":
                 foldername.set(functionkeys["f6"])
         elif key == key.f7:
             if functionkeys["f7"] != "None":
                 foldername.set(functionkeys["f7"])
         elif key == key.f8:
             if functionkeys["f8"] != "None":
                 foldername.set(functionkeys["f8"])
         elif key == key.f9:
             if functionkeys["f9"] != "None":
                 foldername.set(functionkeys["f9"])
         elif key == key.f10:
             if functionkeys["f10"] != "None":
                 foldername.set(functionkeys["f10"])
         elif key == key.f11:
             if functionkeys["f11"] != "None":
                 foldername.set(functionkeys["f11"])
         elif key == key.f12:
             if functionkeys["f12"] != "None":
                 foldername.set(functionkeys["f12"])
예제 #4
0
    pushtotalkkey = registry_writer.read(
        r"SOFTWARE\\virtual audio player\\push to talk key")
    useovarlay = registry_writer.read(
        r"SOFTWARE\\virtual audio player\\overlay")
    systrayvar = registry_writer.read(
        r"SOFTWARE\\virtual audio player\\use systray")
playervar = registry_writer.read(r"SOFTWARE\\virtual audio player\\player")
if playervar == "pygame":
    playerthread = player.player_pygame("none", "none")
else:
    playerthread = player.player_pyaudio("none", 20)
if len(pushtotalkkey) > 1 or len(pushtotalkkey) < 1:
    pushtotalk = False
else:
    pushtotalk = True
selflisten = listner.listen(rec_device_id, actual_playback_device_id)
actualmiclisten = listner.listen(actual_rec_device_id, playback_device_id)


class gui(threading.Thread):
    def __init__(self):
        super().__init__()
        self.mainwindow = Tk()
        global rootwindow
        rootwindow = self.mainwindow
        self.mainwindow.geometry("0x0")
        self.mainwindow.overrideredirect(1)
        try:
            p1 = PhotoImage(file='requirements\\play.png')
        except:
            tkinter.messagebox.showinfo("Error",