Recent

Author Topic: [SOLVED]playsound bis  (Read 6253 times)

MVD

  • New Member
  • *
  • Posts: 23
[SOLVED]playsound bis
« on: October 01, 2017, 11:33:02 am »
Hi,

when the application is playing a sound with playsound I can not do anything, I have to wait the sound is finished. Is it not possible to play a music in the background and have all the components from the form active?
How can I stop the sound?
« Last Edit: October 06, 2017, 02:52:01 pm by MVD »

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: playsound bis
« Reply #1 on: October 01, 2017, 02:24:00 pm »
hello,
yes it is possible but with the PlayStyle property to psAsync   %)
No control on the music  playing with this option.
to play audio files you can also try the audio libraries uos or acs.
« Last Edit: October 01, 2017, 02:34:30 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

MVD

  • New Member
  • *
  • Posts: 23
Re: playsound bis
« Reply #2 on: October 01, 2017, 09:14:07 pm »
I get an error while installing ACS

cannot find akrip32 used by acs_cdrom of package laz_acs.

Where can I find it and how can I install it.

MVD

  • New Member
  • *
  • Posts: 23
Re: playsound bis
« Reply #3 on: October 01, 2017, 09:59:45 pm »
I downloaded the missing files but now I got a compiler error in flac.pas

fatal : Syntax error, "identifier" expected but "VAR" found

this is a part of the flac.pas i downloaded

unit flac;

interface

uses
  {$IFDEF WIN32}
   Windows, ACS_Classes;
  {$ENDIF}

  {$IFDEF LINUX}
  dynlibs, ACS_Procs;
  {$ENDIF}

var

   LibFLACLoaded : Boolean = False;

type
  {$ifdef WINDOWS}
    //{$PackRecords NORMAL}
  {$else}
    {$ifdef LINUX}
      //{$PackRecords C}
      {$PackRecords 2}
    {$endif}
  {$endif}
  unsigned = LongWord;
  long = Integer; 

RAW

  • Hero Member
  • *****
  • Posts: 868
Re: playsound bis
« Reply #4 on: October 02, 2017, 01:30:04 am »
This is a very easy way to play your sounds or music:
BASS.dll (free of charge for personal use...)

If you need more take a look at NEMP MP3 PLAYER: Nice Player + full source code !!!
« Last Edit: July 12, 2019, 06:30:18 am by RAW »
Windows 7 Pro (x64 Sp1) & Windows XP Pro (x86 Sp3).

Eugene Loza

  • Hero Member
  • *****
  • Posts: 678
    • My games in Pascal
Re: playsound bis
« Reply #5 on: October 02, 2017, 06:31:20 am »
You may try SoundEngine from Castle Game Engine - easy to install, cross-platform, lightweight and easy to use.
https://github.com/castle-engine/castle-engine/blob/master/examples/audio/alplay.lpr
You can also start/stop/fade music relatively easily.
« Last Edit: October 02, 2017, 06:44:41 am by Eugene Loza »
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: playsound bis
« Reply #6 on: October 02, 2017, 07:13:20 am »
hello,
Quote from: MVD date=1506721915
I am working in windows 10.
if you are working in windows, you can use the MCI (Media Control Interface). The Media Control Interface is a high-level API developed by Microsoft and IBM for controlling multimedia peripherals connected to a Microsoft Windows.
With it, you can play mp3, wav etc.. files. You have only to add the MMSystem unit in your uses. No need thirdpart units or packages or dlls.
In attachment a small Lazarus project to discover how to use MCI in Lazarus.
With this project :
- You can play the sound files which are in a ListBox.
- You can stop playing sound.
- You can loop playing all the sounds.
- You can load sound files from an opendialog window.
In this project, i use a notify procedure. The MM_MCINOTIFY message notifies an application that an MCI device has completed an operation.
You can have a long delay time between the open command and the play command. To avoid this, open your sound file for example in the form create. Then you can play the sound of the file loaded.  If you want to play more than one time this file instead of close and reopen the file, use the command seek audio to start (to "rewind" the sound if audio is your alias)
Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

serbod

  • Full Member
  • ***
  • Posts: 142
Re: playsound bis
« Reply #7 on: October 02, 2017, 01:20:42 pm »
I get an error while installing ACS

cannot find akrip32 used by acs_cdrom of package laz_acs.

Looks like, you use 64-bit Lazarus, but ACS 32 bit only.

MVD

  • New Member
  • *
  • Posts: 23
Re: playsound bis
« Reply #8 on: October 02, 2017, 04:02:01 pm »
I get an error while installing ACS

cannot find akrip32 used by acs_cdrom of package laz_acs.

Looks like, you use 64-bit Lazarus, but ACS 32 bit only.
I installes a 32_bit Lazarus and now it works like a charm.
Thanks a lot.

 

TinyPortal © 2005-2018