Recent

Author Topic: Application is silent when others play...  (Read 448 times)

Melissa_Dee

  • Newbie
  • Posts: 2
Application is silent when others play...
« on: March 07, 2020, 08:44:01 pm »
Hi all,
I'm somewhat baffled.
I am building an app that has to give an audio signal (a WAV file) unig the TPlaySound component.
If there are no other "audio consumers" (VLC, Youtube or such) active, the app plays the signal, otherwise it does not.
Any tips to give to make the app play the sound (signal) even while the others are playing?
Thanks
Melissa

winni

  • Hero Member
  • *****
  • Posts: 1359
Re: Application is silent when others play...
« Reply #1 on: March 07, 2020, 09:14:44 pm »
Missing Info:

Operating System,  32 or 64, version of fpc and Lazarus
audio subsystem


Melissa_Dee

  • Newbie
  • Posts: 2
Re: Application is silent when others play...
« Reply #2 on: March 08, 2020, 08:13:04 pm »
Hi Winni,
Thjanks for the reply. As this is my first call on this forum, and on a subject I yet have to grasp, I apologise for the missing info...
Let's see...
I run Manjaro Linux 64-bit,
As per info splash (About screen), this is what it gave back:
"Lazarus 2.0.6 rUnknown FPC 3.0.4 x86_64-linux-gtk2"
I use Alsa and Pulseaudio...
Thanks for meditating with me :)
Melissa

trev

  • Hero Member
  • *****
  • Posts: 670
  • Former Delphi 1-7 and 10.2 User
Re: Application is silent when others play...
« Reply #3 on: March 09, 2020, 12:54:13 am »
The TPlaySound component takes a different approach to most other "play sound" components by simply trawling through a list of possibly installed command line programs that play sound until it finds one that exists to play the sound file.

Actually, looking at the code, it uses the last one it found that exists. So it might find program A, but later overwrites that with program Z which is the last one it found that exists on the system (see Play Sound Multiplatform which is a bit of a misnomer as it only covers Windows and Linux).

Back to your issue: blacklist whichever command line program(s) will not play your "signal" while other sounds are also being played.

If all else fails: consult Multimedia Programming for other alternatives.
o Lazarus v2.1.0 r63272, FPC v3.3.1 r45525, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 (Parallels VM)
o FPC 3.0.4, FreeBSD 12-STABLE r358002
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

winni

  • Hero Member
  • *****
  • Posts: 1359
Re: Application is silent when others play...
« Reply #4 on: March 09, 2020, 01:14:34 am »
Hi!

For a Linix-only-solution there is a simple way:

All distros come with mplayer.
Start it from fpc/Lazarus as external programm - it works without problems.

Winni

 

TinyPortal © 2005-2018