Results 1 to 7 of 7

Thread: VERY stupid Question: SoundEngine

  1. #1

    VERY stupid Question: SoundEngine

    Very stupid question (like always.. sorry for beeing a complete newb )

    How on earth do you use the callback thingy on the TGLXSoundEngine??
    I never did understand that stuff... :/ ops: It would really make my day if someone could give me an example.

    Thanks.
    BK - we.create (tm)

  2. #2

    VERY stupid Question: SoundEngine

    No problems, questions is always welcome , none is stupid.

    First, from the FMOD Documentation, applies to TGLXStreamItem aswell:
    All you have to do is drop 'markers' into a wav editing program like SoundForge, and FMOD will automatically generate callbacks as the stream plays when the play cursor runs over the markers!.
    The strings that you label markers with are even passed into the callback.
    Note that only WAV files and MP3 with RIFF wrappers will work here. The markers are saved in a RIFF chunk.

    Remember FMOD is a real-time system and the amount of time spent in a callback has to be low, or you could cause buffer underrun or stuttering.
    Then just assign the OnCallback event, load and play the file and it should do the trick.

    It's also possible to add sync points manually, hoverver GLX hasn't that implemented so you'll have to add them your self.
    If you don't have this luxury or want to use a format that doesn't support this feature, then the next best way to synchronize a stream is by using custom synch points. This way you can add and remove your own points that wav markers would normally generate. See FSOUND_Stream_AddSynchPoint.
    Add your markers manually with this and set your synch point callback with FSOUND_Stream_SetSynchCallback
    Your callback could then look something like this but you can put what you like in the callback function.
    If you want's more info on fmod, you can download the documentation etc at www.fmod.org
    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

  3. #3

    VERY stupid Question: SoundEngine

    Thanks Andreaz I've played around with FMod earlier to create some synch stuff, and I made a program that read the markers etc. but I don't know how to write the callback, were to put my code etc. I have some code I would like to have executet everytime a synch point is reached, but I really don't know how.

    So.. yet another question... how do you assign code to the callback event? ops:
    BK - we.create (tm)

  4. #4

    VERY stupid Question: SoundEngine

    The onCallback in TGLXSound item is just an normal event, here is how it works.

    Procedure TForm1.StreamCallback(Stream: TGLXStreamItem; Name: String);
    begin
    // Do something here
    end;

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    GLXSoundEngine1.Streams[0].OnCallback:=StreamCallback;
    end;
    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

  5. #5

    VERY stupid Question: SoundEngine

    Brilliant! Thanks again! I actually tried somthing like that a while ago, but couldn't get it to work.. Hmm.. I think it's about time I advance my delphi skills a bit...
    BK - we.create (tm)

  6. #6

    VERY stupid Question: SoundEngine

    No probs, hope you'll get it working
    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

  7. #7

    VERY stupid Question: SoundEngine

    Just wanted to say that it works just fine now thanks again!
    BK - we.create (tm)

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
  •