Slider that does not stop the playback function when at 0

RaivisR
Posts: 9
Joined: Fri Oct 28, 2016 1:04 pm
Location: Latvia
Real Name: Raivis Rengelis
Contact:

Slider that does not stop the playback function when at 0

Post by RaivisR » Wed Apr 05, 2017 2:38 pm

Hi,

I am using QLC+ in a project where it not only controls the lights, but also plays back different sound effects and background music (game show environment) and according to sound designer wishes there should be a background track that is never restarted but just plays in loop and is muted when necessary.
I already implemented looping, so that is sorted, but now the problem is muting without stopping the function. My idea is to modify Slider widget and add configuration checkbox on playback page that would let user choose if function should be stopped on level 0 or not, if this would be enabled, function could still be stopped using some other VC widget if necessary. A few questions to great minds behind the codebase - would that be useful for other uses, like having continuous lights show flow that is dimmed/undimmed at some point? Would that interfere with other functionality of the system?

With best regards,
RR

User avatar
mcallegari
Posts: 1895
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Re: Slider that does not stop the playback function when at 0

Post by mcallegari » Thu Apr 06, 2017 8:15 am

Hi Raivis, thanks for the audio looping patch. Will be merged shortly.

Question: have you tried to see if a submaster does what you need ? Basically place a button/slider attached to the looping audio function in a frame and place also a slider in submaster mode. When you move the submaster, it should control the Intensity attribute of the widgets inside the frame, which in the Audio case is the volume.

RaivisR
Posts: 9
Joined: Fri Oct 28, 2016 1:04 pm
Location: Latvia
Real Name: Raivis Rengelis
Contact:

Re: Slider that does not stop the playback function when at 0

Post by RaivisR » Thu Apr 06, 2017 10:09 am

Thanks for the idea, that seems to work, although there is noticeable delay between change of slider and actual volume change. If that delay appears to be too much, I will have to revert to the original plan to change the code, but for now, putting it on hold.

User avatar
mcallegari
Posts: 1895
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Re: Slider that does not stop the playback function when at 0

Post by mcallegari » Thu Apr 06, 2017 10:25 am

The delay is caused by the internal audio buffers.
The volume is applied to sample being pushed to the "render" buffer, while the audio you hear relates to the samples currently being "rendered".

I think we can try the Qt setVolume method and see if it's better.
I need to check the code though

RaivisR
Posts: 9
Joined: Fri Oct 28, 2016 1:04 pm
Location: Latvia
Real Name: Raivis Rengelis
Contact:

Re: Slider that does not stop the playback function when at 0

Post by RaivisR » Thu Apr 06, 2017 11:07 am

Wouldn't that work only for Qt renderer? I am using version with Qt 4 and alsa renderer in prod as that lets me play multiple audio samples at once, which did not work on RasPi and if I am not mistaken Qt 5 version.

User avatar
mcallegari
Posts: 1895
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Re: Slider that does not stop the playback function when at 0

Post by mcallegari » Thu Apr 06, 2017 11:53 am

Yes, setVolume is a Qt5 method.
To summarize:
- windows builds bundle Qt5
- macOS builds bundle Qt5
- official Linux builds (32/64bit) still depends on Qt4 :sob:
- OBS Linux builds have both Qt4/Qt5 version
- Raspberry Pi bundles Qt 5.6.2

Both ALSA and Qt support multiple audio rendering

RaivisR
Posts: 9
Joined: Fri Oct 28, 2016 1:04 pm
Location: Latvia
Real Name: Raivis Rengelis
Contact:

Re: Slider that does not stop the playback function when at 0

Post by RaivisR » Thu Apr 06, 2017 12:15 pm

Interesting, why on RasPi with latest image I was limited to 1 simultaneous audio playback then? Although, I was not using built in codec, but rather this https://www.element14.com/community/com ... audio_card as it has SPDIF output.

User avatar
mcallegari
Posts: 1895
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Re: Slider that does not stop the playback function when at 0

Post by mcallegari » Thu Apr 06, 2017 12:40 pm

Well, on the RPi the Qt backend is actually ALSA (I think they support pulseaudio as well though) so you can easily test if your soundcard supports multiple playback by opening two shells and doing:

Code: Select all

shell1# aplay file1.mp3
shell2# aplay file2.mp3

RaivisR
Posts: 9
Joined: Fri Oct 28, 2016 1:04 pm
Location: Latvia
Real Name: Raivis Rengelis
Contact:

Re: Slider that does not stop the playback function when at 0

Post by RaivisR » Thu Apr 06, 2017 2:55 pm

will try that when I get a chance, I am suspicious now that it is limitation of driver for that specific codec chip and not limitation of Qt 5 or RasPi itself.

Returning to the original issue, it does not quite work in relatively complex setup the way it works in simple test, so I am still at square one with my problem, only I am not sure my initial solution is the right one.

RaivisR
Posts: 9
Joined: Fri Oct 28, 2016 1:04 pm
Location: Latvia
Real Name: Raivis Rengelis
Contact:

Re: Slider that does not stop the playback function when at 0

Post by RaivisR » Thu Apr 06, 2017 6:37 pm

Massimo, is there any way I can chat with you privately?

Post Reply