Recent

Author Topic: [SOLVED] Initialize MMSystem  (Read 1141 times)

pcurtis

  • Hero Member
  • *****
  • Posts: 634
[SOLVED] Initialize MMSystem
« on: May 18, 2021, 04:33:48 pm »
When I first play a sound with  PlaySound(WavStream.Memory, 0, SND_NODEFAULT or SND_ASYNC or SND_MEMORY); there is a small delay +/- 200ms while MMSystem initializes, if I play again the delay is gone.
How can I initialize the MMSystem when I start the app?
« Last Edit: May 18, 2021, 07:37:37 pm by pcurtis »
Windows 10
Laz 2.0.10
FPC 3.2.0

lucamar

  • Hero Member
  • *****
  • Posts: 4150
Re: Initialize MMSystem
« Reply #1 on: May 18, 2021, 04:54:11 pm »
It has been a long time but IIRC there is no "global" initialization per se, but if you call any of its functions at the start of the program (say, waveOutGetDevCaps()) the delay should (mostly) dissapear.

Though note that there will always be some delay the first time you play a new sound due to the internal initializations needed.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

pcurtis

  • Hero Member
  • *****
  • Posts: 634
Re: Initialize MMSystem
« Reply #2 on: May 18, 2021, 05:14:49 pm »
OK, thanks I'll try.
Windows 10
Laz 2.0.10
FPC 3.2.0

pcurtis

  • Hero Member
  • *****
  • Posts: 634
Re: Initialize MMSystem
« Reply #3 on: May 18, 2021, 07:36:44 pm »
OK, it helps. Thanks.
Windows 10
Laz 2.0.10
FPC 3.2.0

 

TinyPortal © 2005-2018