-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunction_test.py
47 lines (47 loc) · 1.45 KB
/
function_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
"""
>>> import os
>>> import sys
>>> import time
>>> import nava
>>> test_sound_path = os.path.join("others", "test.wav")
>>> nava.play(test_sound_path)
>>> sound_id_1 = nava.play(test_sound_path, async_mode=True)
>>> sound_id_1 == 1001
True
>>> sound_id_2 = nava.play(test_sound_path, async_mode=True)
>>> sound_id_2 == 1002
True
>>> sound_id_3 = nava.play(test_sound_path, async_mode=True)
>>> sound_id_3 == 1003
True
>>> sound_id_4 = nava.play(test_sound_path, async_mode=True, loop=True)
>>> sound_id_4 == 1004
True
>>> nava.stop(sound_id_1)
>>> nava.stop(sound_id_4)
>>> for i in range(40):
... sound_id = nava.play(test_sound_path, async_mode=True)
... time.sleep(0.2)
>>> time.sleep(1)
>>> nava.stop_all()
>>> len(nava.params._play_threads_map) == 44
True
>>> nava.params._play_threads_counter == 44
True
>>> sys_platform = sys.platform
>>> if sys_platform == "win32":
... sound_id = nava.play(test_sound_path, async_mode=True, engine=nava.Engine.WINSOUND)
... elif sys_platform == "darwin":
... sound_id = nava.play(test_sound_path, async_mode=True, engine=nava.Engine.AFPLAY)
... else:
... sound_id = nava.play(test_sound_path, async_mode=True, engine=nava.Engine.ALSA)
>>> nava.functions.play_cli(test_sound_path)
>>> nava.functions.nava_help()
<BLANKLINE>
A Python library for playing sound everywhere natively and securely.
<BLANKLINE>
<BLANKLINE>
Repo : https://github.com/openscilab/nava
Webpage : https://openscilab.com/
"""