Archived

This topic is now archived and is closed to further replies.

SimonB

DelphiX Wavelist

Recommended Posts

Having antother problem here (nothin Powerdraw related this time , I wanted to use a DXWavelist component to play sounds inside the game, but loading the .wav files in delphi does not seem to be a good idea (.exe would be something like 30 megs when the game is finished) but I wanted to dynamically load files into it at the start, so to say preload the sounds and then play them in the game, I do not want to have to load the sounds every time I play them but to stay in the memory (in the DXWavelist that is) but I have absolutely no idea how I could do this, thanks in advance for any help

Share this post


Link to post
Share on other sites
Load them manually. Here''s some code from my old Black Magic project:


  
procedure TMainForm.LoadSamples();
const
SampleNames: array[0..12] of string =(''beam1.wav'', ''beam2.wav'', ''beam3.wav'', ''beam4.wav'', ''beam5.wav'', ''beam6.wav'', ''beam7.wav'', ''crash0.wav'', ''crash1.wav'', ''crash2.wav'', ''crash3.wav'', ''crash4.wav'', ''launch.wav'');

var
i: Integer;
Item: TWaveCollectionItem;
begin
for i:=0 to 12 do
begin
Item:= TWaveCollectionItem.Create(DXWaveList.Items);
Item.Wave.LoadFromFile(''sounds\'' + SampleNames[i]);
Item.Frequency:= 22050;
Item.Name:= SampleNames[i];
Item.MaxPlayingCount:= 3;
end;
end;

Share this post


Link to post
Share on other sites