Recent

Author Topic: Application is silent when others play...  (Read 669 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: 2122
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1225
  • Former Delphi 1-7, 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.
Lazarus 2.1 r64368 FPC 3.3.1 r48100 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.1 r64392 3.3.1 Jan 13 21:24 macOS 11.1 aarch64 Xcode 12.3
Lazarus 2.1 r61574 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
Lazarus 2.1 r61574 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 3.2.0 Win10 Parallels VM

winni

  • Hero Member
  • *****
  • Posts: 2122
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