Results 1 to 11 of 11

Thread: winmm.dll mciSendString - How to loop from specific song point?

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2021
    Posts
    2

    winmm.dll mciSendString - How to loop from specific song point?

    Hi,

    I'm using a background program and playing MP3 with mciSendString with commands like "play Mediafile Repeat".

    However, my songs usually have an Introduction and then the looping part (as videogames). So I want that the song start playing normally, but the looping point been at some point.

    Thanks!!

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,951

    Re: winmm.dll mciSendString - How to loop from specific song point?

    Hi.
    Although there might be newer approaches on playing media, like adding the media player control, I don't anything that will work with just coding and not adding the pre made MP control.
    So I have written this app in Codebank a long time ago and it's still remains my most popular in user views, so you can take a look there:

    https://www.vbforums.com/showthread....p-media-player

    The functions you are mostly interested in are: mp3player.CurrentPosition and mp3player.Seek
    .

  3. #3
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,294

    Re: winmm.dll mciSendString - How to loop from specific song point?

    I don't know that you can automate it, but if you know at what point you want to loop back to, you can use "seek media" and "play media" to start at a particular point. If you monitor where you are, you can perhaps seek back at the appropriate point to manually loop.

    Perhaps this thread, although it is VB6, will give you some ideas, as the MCI commands are the same regardless of the language.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,951

    Re: winmm.dll mciSendString - How to loop from specific song point?

    No disrespect to passel's answer but, I've provided a full example of a media player that include seek, play , position changing and other functions in VB.NET , the link passel provided is VB6 but the question was on the VB.NET forum.
    Anyhow the example on my codebank is a complete media player so you might get a benefit for any other functionality, if however you use VB6 you can have a look there as i don't suppose DLLImport is declared the same in VB6.

    P.S. I think the OP have left the building anyhow.
    Last edited by sapator; Feb 11th, 2021 at 10:34 PM.
    .

  5. #5
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,294

    Re: winmm.dll mciSendString - How to loop from specific song point?

    You provided a full working example of a media player, but the original poster already said he was using mciSendString to play an mp3 file repeatedly, so I assume he already has the declaration and can use the API, so that doesn't need to be provided.

    The question was
    ...mciSendString - How to loop from specific song point?
    .
    The question wasn't how to use mciSendString, but how to loop from a specific song point using mciSendString.
    Since he was already using mciSendString and asked a question about mciSendString, pointing to a solution using Windows Media Player isn't really on topic, or answering the question asked.

    It is an alternative though, and I don't have an issue with using media player, but since using media player instead of mcisendstring wasn't answering the question asked, so I just took a shot at answering the question asked.

    Since the command parameter to mciSendString is a string, it will be the same string regardless of the language used, and if you are only interested in the command string to use to accomplish what you are trying to do, then the command string used should be pretty clear, even if you are not familiar with the programming language itself, unless the string is being built with arcane methods.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  6. #6
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,951

    Re: winmm.dll mciSendString - How to loop from specific song point?

    Nope, you're wrong.

    My example is not a media player, it's a full example of an implementation of a self created media player using mcisend that does what the OP asks. You can first take a look and then dispute me.

    Again the OP has left the building.
    Last edited by sapator; Feb 11th, 2021 at 10:35 PM.
    .

  7. #7
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,163

    Re: winmm.dll mciSendString - How to loop from specific song point?

    Quote Originally Posted by sapator View Post
    Again the OP has left the building.
    Or maybe getting some sleep. Not everyone lives in the Sapila time zone.
    BB

  8. #8

    Thread Starter
    New Member
    Join Date
    Feb 2021
    Posts
    2

    Re: winmm.dll mciSendString - How to loop from specific song point?

    Lol!! Yes, different timezone. Also that I have very limited free time

    This is, let's say, for a videogame. So the song would be for example 1:30, but once finished for first time it has to loop from 0:27 to 1:30 as first 27 seconds are the song intro.

    So the player is not what I need (IMO), but thanks anyway.
    I think it is more related with the other entry, about "status Media position" and "seek Media to", but I don't really know how to use it, so I need to study it a bit.
    I think I can maybe check the position every "x" millisecs and if it reaches some point, I can make a "play from" or similar.

    I will check on weekend and comeback to tell you (if you have ideas, they are very welcome).

  9. #9
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,951

    Re: winmm.dll mciSendString - How to loop from specific song point?

    What? People sleep?

    In my example(again, NOT media player Microsoft control), if you play a song and click the left arrow button, it will rewind you back to 5 seconds, if you click the right arrow button it will forward you 5 seconds, in accordance of the position of the media at that time.
    Using this, you can make your own "rewind" "ff" - "loop".
    You can study the code or ignore it, up to you.
    Good Luck.
    .

  10. #10
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,294

    Re: winmm.dll mciSendString - How to loop from specific song point?

    Quote Originally Posted by sapator View Post
    Nope, you're wrong.

    My example is not a media player, it's a full example of an implementation of a self created media player using mcisend that does what the OP asks. You can first take a look and then dispute me.

    Again the OP has left the building.
    My mistake. I misread your second post. Rereading, the last part of the first sentence still is a little confusing to me.
    Also, I didn't follow the link and look at the project, so my bad. I think that the fact that the thread link had "media-player" in the link probably mislead me a bit as well.

    I apologize.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  11. #11
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,951

    Re: winmm.dll mciSendString - How to loop from specific song point?

    There is nothing to apologize for.
    I just wanted to clear it up for the OP that I think he still thinks that I provide the media player control rather than my solution.I probably did not explain it that good myself at first, after all I'm not a native English speaker.
    Have a nice weekend.
    .

Posting Permissions

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



Click Here to Expand Forum to Full Width