Results 1 to 6 of 6

Thread: Little question (i hope) DXMusic.

  1. #1

    Little question (i hope) DXMusic.

    I am using DXMusic with UnDelphiX 1.07B, everything is going fine, but I would like to somehow pause and resume music, most importantly for when the game is paused and unpaused.

    Is there some way to get what the track playing is up to and then set it when I re-play it to give it a pause/unpause effect?

    Iv'e tried a few things but they don't seem to work.....

  2. #2

    Little question (i hope) DXMusic.

    No one has any idea?

  3. #3

    Little question (i hope) DXMusic.

    I have not used DirectMusic, but a quick google pulled this up - http://www.devmaster.net/forums/arch...hp/t-3175.html

    I also found this in Google Groups...

    Code:
    here is what I find, from the dev team, yes this is hard to do and isnt
    doc'ed.
    
    here's code to get the current offset into a segment that handles loops and
    offsets. mtNow is the current performance time, the rest are all obtained
    from the segment state or segment itself. It currently just returns the
    current offset into the segment, but it could be modified to also return the
    number of repeats of the segment left (so the repeat count could be set
    correctly when unpausing the segment). This code is much more accurate than
    the segment state's GetSeek() method, which just returns the next time that
    the segment track's Play method will be called (which may be as much as one
    second into the future).
    
    MUSIC_TIME GetTimeOffset( const MUSIC_TIME mtNow,
                                                      const MUSIC_TIME
    mtStartTime,
                                                      const MUSIC_TIME
    mtStartPoint,
                                                      const MUSIC_TIME
    mtLoopStart,
                                                      const MUSIC_TIME
    mtLoopEnd,
                                                      const MUSIC_TIME mtLength,
                                                      const DWORD dwLoopRepeats)
    {
        // Convert mtNow from absolute time to an offset
        // from when the segment started playing
        LONGLONG llBigNow = mtNow - (mtStartTime - mtStartPoint);
    
        // If mtLoopEnd is non zero, set lLoopEnd to mtLoopEnd,
        // otherwise use the segment length
        LONGLONG llLoopEnd = mtLoopEnd ? mtLoopEnd : mtLength;
    
        LONGLONG llLoopStart = mtLoopStart;
    
        if( (dwLoopRepeats != 0)
        && &#40;llLoopStart <llLoopEnd> mtStartPoint&#41; &#41;
        &#123;
            if&#40; &#40;dwLoopRepeats != DMUS_SEG_REPEAT_INFINITE&#41;
            && &#40;llBigNow > &#40;llLoopStart + &#40;llLoopEnd - llLoopStart&#41; *
            &#40;signed&#41;dwLoopRepeats&#41;&#41; &#41;
            &#123;
                llBigNow -= &#40;llLoopEnd - llLoopStart&#41; * dwLoopRepeats;
            &#125;
            else if&#40; llBigNow > llLoopStart &#41;
            &#123;
                llBigNow = llLoopStart + &#40;llBigNow - llLoopStart&#41; % &#40;llLoopEnd -
    llLoopStart&#41;;
            &#125;
        &#125;
        llBigNow = min&#40; llBigNow, LONG_MAX &#41;;
        return long&#40;llBigNow&#41;;
    
    &#125;
    Is this usefull?

    It might also be an idea to post what you have tried so as to avoid people suggesting things you may have already tried.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  4. #4

    Little question (i hope) DXMusic.

    Well I posted this a bit ago and I kind of can't remember lol.

    But concerning DXMusic there isn't much that you can try that look even remotely like it.

    Perhaps this is a future feature? I might email and ask Micrel, he might hopefully know if it's been implemented or could.

  5. #5

    Little question (i hope) DXMusic.

    I don't use delphix for music. I use Tactivemovie but even the crap tmediaplayer has a .position

    for instance you load the wav then>> Positionvar:=tmediaplayer1.position;

    then you have stored the position and can go back to it when unpause.

    Along those lines.

    Of course I use this when I wish to loop audio music and for a few other things. I guess .pause would be much more your thing in this case. Delphix is a bit short in the audio dept

  6. #6

    Little question (i hope) DXMusic.

    I would suggest you to have a look at FMOD library.

    You can find it at http://www.fmod.org/

    It's free for non commercial use and it plays almost every known music
    format

    Very easy also to interface within delphi, and it has exactly what you need
    because i already used it for the same purpose :!:
    <center>
    <br />Federico &quot;FNX&quot; Nisoli
    <br />Lead Programmer - FNX Games
    <br />http://www.fnxgames.com
    <br /><img src="http://www.fnxgames.com/imgs/banners/fnxban.gif">
    <br /></center>

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
  •