[fpc-pascal] Re: Playing sounds with standard components

Graeme Geldenhuys graemeg.lists at gmail.com
Wed Jun 13 12:08:56 CEST 2012

On 13 June 2012 04:26, silvioprog <silvioprog at gmail.com> wrote:
> I tried playing a wav file with this demo in attached, no errors, but
> no sound came out. :(

You are releasing the TSoundEngine instance to quickly, and don't give
SDL chance to initialize fully and play the sound. Simply add a
sleep(1000)  call [just for demonstration purposes] after you called
PlayingStart(), then you will hear the sound.

A better idea would be to change your code as the attached unit. Keep
the TSoundEngine instance in the form (or as a global variable), so
then playing any sounds are instant.

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unit1.pas
Type: application/octet-stream
Size: 2362 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120613/34d53bed/attachment.obj>

More information about the fpc-pascal mailing list