PDA

View Full Version : Sound Problems



cairnswm
03-05-2004, 01:47 AM
Im looking for help on a couple of problems I've experienced with the GLXTreem SoundEngine.

The first problem is that I cannot turn the sound off. If I use


FMusicState := Value;
If Not FMusicState then
MusicEngine.Sounds.Find('Music').Stop
Else
MusicEngine.Sounds.Find('Music').Play;


The Stop doesn;t turn the music off but just makes it softer, doing the Play then returns it to its normal volume.

I initialize the Music Engine and the relevant sound by:


MusicEngine.Init;
Sound := MusicEngine.Sounds.Add;
Sound.Load('Sounds/Default8bit.wav');
Sound.SoundType := st2D;
Sound.Name:='Music';


The FMod.dll I'm using is the one that came in the GLXTreem download file.

The second problem is that I cannot have two GLXSoundEngine components on the form at the same time. I dont get any errors but when I close the program (running in the IDE) I get an exception. I know its the second SoundEngine because if I remove it I no longer get the error. I want two sound engines to allow me to have music from the one and sound effects from the other, allowing me to switch off the sound effects when I want to play another at the same time allowing multiple music scripts to be playing.

The code below if for the sound effects. It turns off all sounds currently playing (or makes them softer - see above):


procedure TMainForm.PlaySound(Name: String; Only: Boolean);
Var
I : Integer;
begin
// Add turn off other sounds if Only is true
If Only then
For I := 0 to SoundEngine.Sounds.Count - 1 do
SoundEngine.Sounds[I].Stop;
If SoundState then
SoundEngine.Sounds.Find(Name).Play;
end;

Andreaz
03-05-2004, 03:31 PM
Im looking for help on a couple of problems I've experienced with the GLXTreem SoundEngine.

The first problem is that I cannot turn the sound off. If I use


FMusicState := Value;
If Not FMusicState then
MusicEngine.Sounds.Find('Music').Stop
Else
MusicEngine.Sounds.Find('Music').Play;


The Stop doesn;t turn the music off but just makes it softer, doing the Play then returns it to its normal volume.


I initialize the Music Engine and the relevant sound by:


MusicEngine.Init;
Sound := MusicEngine.Sounds.Add;
Sound.Load('Sounds/Default8bit.wav');
Sound.SoundType := st2D;
Sound.Name:='Music';


The FMod.dll I'm using is the one that came in the GLXTreem download file.



Strange exactly that works when i tested it, and it stops the sound in the right way, have a newer version of fmod in GLXTreem v2, can have to do with that or can have to do with the drivers for you sound card.

Anyone else had this problem ?




The second problem is that I cannot have two GLXSoundEngine components on the form at the same time. I dont get any errors but when I close the program (running in the IDE) I get an exception. I know its the second SoundEngine because if I remove it I no longer get the error. I want two sound engines to allow me to have music from the one and sound effects from the other, allowing me to switch off the sound effects when I want to play another at the same time allowing multiple music scripts to be playing.

The code below if for the sound effects. It turns off all sounds currently playing (or makes them softer - see above):


procedure TMainForm.PlaySound(Name: String; Only: Boolean);
Var
I : Integer;
begin
// Add turn off other sounds if Only is true
If Only then
For I := 0 to SoundEngine.Sounds.Count - 1 do
SoundEngine.Sounds[I].Stop;
If SoundState then
SoundEngine.Sounds.Find(Name).Play;
end;


That one is easier to fix, remove the

FSOUND_Close();

from the deconstructor of the TGLXSoundEngine and call it yourself in the forms deconstructor. Will fix this in the new version