Results 1 to 2 of 2

Thread: Sound Problems

  1. #1
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Sound Problems

    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
    Code:
      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:
    Code:
      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):
    Code:
    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;
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  2. #2

    Re: Sound Problems

    Quote Originally Posted by cairnswm
    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
    Code:
      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:
    Code:
      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 ?

    Quote Originally Posted by cairnswm

    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):
    Code:
    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
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Comodo SSL