Skip to content

Commit

Permalink
fix : minor bug in linux/mac sync mode fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sepandhaghighi committed Jan 17, 2024
1 parent 9355cdd commit b9abdd7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions nava/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,21 @@ def __play_linux(sound_path, async_mode=False):
:return: None or sound id
"""
if async_mode:
sound_thread = NavaThread(target=__play_sync_linux,
sound_thread = NavaThread(target=__play_proc_linux,
args=(sound_path,),
daemon=True)
sound_thread.start()
sound_id = sound_id_gen()
params._play_threads_map[sound_id] = sound_thread
return sound_id
else:
__play_sync_linux(sound_path)
proc = __play_proc_linux(sound_path)
proc.wait()


def __play_sync_linux(sound_path):
def __play_proc_linux(sound_path):
"""
Play sound synchronously in Linux.
Create sound playing process in Linux.
:param sound_path: sound path to be played
:type sound_path: str
Expand All @@ -171,20 +172,21 @@ def __play_mac(sound_path, async_mode=False):
:return: None or sound id
"""
if async_mode:
sound_thread = NavaThread(target=__play_sync_mac,
sound_thread = NavaThread(target=__play_proc_mac,
args=(sound_path,),
daemon=True)
sound_thread.start()
sound_id = sound_id_gen()
params._play_threads_map[sound_id] = sound_thread
return sound_id
else:
__play_sync_mac(sound_path)
proc = __play_proc_mac(sound_path)
proc.wait()


def __play_sync_mac(sound_path):
def __play_proc_mac(sound_path):
"""
Play sound synchronously in macOS.
Create sound playing process in macOS.
:param sound_path: sound path to be played
:type sound_path: str
Expand Down

0 comments on commit b9abdd7

Please sign in to comment.