utils: play bytes, not stream
This commit is contained in:
parent
56f698f410
commit
220cdf1283
10
utils.py
10
utils.py
@ -2,12 +2,10 @@ import winsound
|
||||
import io
|
||||
|
||||
|
||||
def save_bytes_io(filename: str, bytes_stream: io.BytesIO) -> None:
|
||||
def save_bytes(filename: str, bytes_audio: bytes) -> None:
|
||||
with open(file=filename, mode='wb') as res_file:
|
||||
bytes_stream.seek(0)
|
||||
res_file.write(bytes_stream.read())
|
||||
res_file.write(bytes_audio)
|
||||
|
||||
|
||||
def play_bytes_io(bytes_stream: io.BytesIO) -> None:
|
||||
bytes_stream.seek(0)
|
||||
winsound.PlaySound(bytes_stream.read(), winsound.SND_MEMORY)
|
||||
def play_bytes(bytes_sound: bytes) -> None:
|
||||
winsound.PlaySound(bytes_sound, winsound.SND_MEMORY)
|
||||
|
Loading…
x
Reference in New Issue
Block a user