feature/precode #2
@@ -368,7 +368,9 @@ class Streamer():
|
||||
"""
|
||||
Streamer class that supports multiple input formats. See bumble for streaming from wav or device
|
||||
Added functionallity on top of bumble:
|
||||
- precode wav files,
|
||||
- loop parameter
|
||||
- if True the audio_source will be looped for ever
|
||||
- precode wav files
|
||||
- lc3 coded files
|
||||
- just use a .lc3 file as audio_source
|
||||
- lc3 coded from ram
|
||||
@@ -516,10 +518,9 @@ class Streamer():
|
||||
for i, big in enumerate(bigs.values()):
|
||||
|
||||
if big['precoded']:# everything was already lc3 coded beforehand
|
||||
lc3_frame = b""
|
||||
# list(itertools.islice(iterator, 3))
|
||||
for _ in range(big['lc3_bytes_per_frame']): # have a look at itertools.islice
|
||||
lc3_frame += next(big['lc3_frames']).to_bytes() # TODO: use async ?
|
||||
lc3_frame = bytes(
|
||||
itertools.islice(big['lc3_frames'], big['lc3_bytes_per_frame'])
|
||||
)
|
||||
else:
|
||||
pcm_frame = await anext(big['audio_input'].frames(big['lc3_frame_samples']), None)
|
||||
if pcm_frame is None: # Not all streams may stop at the same time
|
||||
|
||||
Reference in New Issue
Block a user