Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Anyone?

  1. #11

    Anyone?

    I see. Yea, I needed to be able to load textures, WAVs and other game assets from my resource file (not a windows resource thats compiled into the exe, but a standard zip archive file). GV has a class called TGVRezFile that does this. I had to use my own code to load the wavs in order for it to be able to come in from the rez file. If you open FreeStrike.rez with winzip you will notice its just a zip file.

    Send me an email to: jdsgames@jdsgames.com and I will send you GVAudio.pas.
    Best Regards
    <br />
    <br />Jarrod Davis,
    <br />Jarrod Davis Software
    <br />http://www.jarroddavis.com

  2. #12

    Anyone?

    Hi, the volume works now, but it seems to only work on one of my buffers. When I have more than one sound playing, it seems to skip the first one, and works on the next one.. its wierd. I was adjusting the volume right before I play it, so it should affect every single buffer that tries to play a sound but for some reason it skips some. Any ideas? Thanks.
    Bobby Baker
    <br />Delphi Sanctuary
    <br />www.delphisanctuary.com

  3. #13

    Anyone?

    This is the code that I am currently using. I just call SetChannelVol aftwards. Email me the code in question and I will take a look at it if you like.

    [pascal]
    function TGVAudio.PlaySample(Num, Chan: Integer; Vol: Single; Loop: Boolean): Integer;
    var
    I : Integer;
    Flags: Cardinal;
    begin
    // check if init
    if not FEnabled then
    begin
    Result := -1;
    Exit;
    end;

    //FSampleBuffer[Id].Play(0, 0, 0)
    if (Chan < 0) or (Chan > GV_MAX_CHANNELS-1) then
    begin
    I := FindFreeMixBuffer;
    if I < 0 then
    begin
    Result := I;
    Exit;
    end;
    end
    else
    begin
    I := Chan;
    StopChannel(I);
    end;

    // copy to mix buffer
    FDS.DuplicateSoundBuffer(FSampleBuffer[Num], FMixBuffer[I]);

    // play buffer
    SetChannelVolume(I, Vol);

    Flags := 0;
    if Loop then
    Flags := Flags or DSBPLAY_LOOPING;
    FMixBuffer[I].Play(0, 0, Flags);

    // return mix buffer id
    Result := I;
    end;

    procedure TGVAudio.SetChannelVolume(Chan: Integer; Vol: Single);
    begin
    // check if init
    if not FEnabled then
    begin
    Exit;
    end;

    if (Chan < 0) or (Chan > GV_MAX_CHANNELS-1) then Exit;
    if Assigned(FMixBuffer[Chan]) then
    begin
    FMixBufferVol[Chan] := Vol;
    FMixBuffer[Chan].SetVolume(CalcVolume(Vol, True));
    end;
    end;
    [/pascal]
    Best Regards
    <br />
    <br />Jarrod Davis,
    <br />Jarrod Davis Software
    <br />http://www.jarroddavis.com

Page 2 of 2 FirstFirst 12

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
  •