short story: i want to play 16bit/2.0 24bit/5.0 and 24bit/5.1 flac-files all in the same playlist, without restarting my application whenever channelcount is changing.
use-case:
there are situations alsa has to be reconfigured by altering .asoundrc.
Those changes only take effect when alsa-lib has been released and reloaded.
For now it's necessary to stop the whole application(and python-interpreter) which is using audiotools to force ALSAAudio_dealloc in alsa.c being called.
I tried to implement this by myself but unfortunately without success.
my special use-case for reconfiguring alsa:
instead of writing prosa, here my different .asoundrc
Switching between them with python-code works reliable but changes only take effect after restarting my whole app.
for stereo:
pcm.!default {
type hw
card 0
device 8
}
PS: besides using audiotools.player.Player i also tried your more low-level api, to play 16bit/2.0 24bit/5.0 and 24bit/5.1 flac-files all in the same playlist
The code below did the trick, but for audiotools.player.Player i did not find any other solution than the one in the requested feature above (switching .asoundrc).
please provide a Method AudioOutput.release()
short story: i want to play 16bit/2.0 24bit/5.0 and 24bit/5.1 flac-files all in the same playlist, without restarting my application whenever channelcount is changing.
use-case: there are situations alsa has to be reconfigured by altering .asoundrc. Those changes only take effect when alsa-lib has been released and reloaded. For now it's necessary to stop the whole application(and python-interpreter) which is using audiotools to force ALSAAudio_dealloc in alsa.c being called. I tried to implement this by myself but unfortunately without success.
my special use-case for reconfiguring alsa: instead of writing prosa, here my different .asoundrc Switching between them with python-code works reliable but changes only take effect after restarting my whole app.
for stereo: pcm.!default { type hw card 0 device 8 }
for 5.0 pcm.!default = { type= route slave { pcm = "hw:0,8" channels 6 } ttable { 0.0=1 1.1=1 2.4=1 3.2=1 4.3=1 } }
for 5.1 pcm.!default = { type= route slave { pcm = "hw:0,8" channels 6 } ttable { 0.0=1 1.1=1 2.4=1 3.5=1 4.2=1 5.3=1 } }
PS: besides using audiotools.player.Player i also tried your more low-level api, to play 16bit/2.0 24bit/5.0 and 24bit/5.1 flac-files all in the same playlist The code below did the trick, but for audiotools.player.Player i did not find any other solution than the one in the requested feature above (switching .asoundrc).
MASK_20 = ChannelMask.from_fields(front_left=True,front_right=True) MASK_50 = ChannelMask.from_fields(front_left=True,front_right=True,front_center=True,side_left=True,side_right=True) MASK_51 = ChannelMask.from_fields(front_left=True,front_right=True,front_center=True,side_left=True,side_right=True,low_frequency=True)
ORDER = {2:[0,1], 5:[1,3,4,2,0,0], 6:[1,4,5,2,3,0]} MASK = {2:MASK_20, 5:MASK_51, 6:MASK_51}
nChannels = gotFromDatabase(file) mask = MASK[nChannels] order = ORDER[nChannels] flacReader = FlacAudio(uri).to_pcm() reorderedReader = at.ReorderedPCMReader(flacReader, order, mask) pcmReader = at.BufferedPCMReader(reorderedReader)