PDA

View Full Version : 10 tons of questions



erikphilips
09-11-2003, 04:13 AM
Question about the "SoundManager.Create". Every time this is called, is it loading it off disk? That would seem pretty inefficient. So I?_Tm added some cwavefile?_Ts, load all the sounds I?_Tm going to use, then tried to use SoundManager.CreateFromMemory. That didn?_Tt work out so well. The really short version looked like:



wave := tWave.Create;
wave.name := filename;
wave.WaveFile := cWaveFile.Create;
wave.WaveFile.Open(pAnsiChar(filename), nil, WAVEFILE_READ);
wave.WaveFile.Read(wave.WaveFile.m_pbData, wave.WaveFile.GetSize, pdwSizeRead);
waves.Add(wave);

SoundManager.CreateFromMemory(SoundBuffer, wave.WaveFile.m_pbData, wave.WaveFile.m_dwSize, wave.WaveFile.GetFormat, 0, GUID_NULL, 1 );
Buffers.Add(SoundBuffer);
SoundBuffer.Play(0,0,0,-1,0);


No sound is played, everything compiles ok.

Clootie
09-11-2003, 02:07 PM
Hm... Seems you've found bug in DirectSound framework (have to log it to MS).
Mail me privately and I'll send you updated DSUtil.pas file which allowed me to play sound using memory pointer. If you'll find it's working correclty I'll publish it.