Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Loop .mp3 playback

Loop .mp3 playback

Scheduled Pinned Locked Moved C / C++ / MFC
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fordfanboi
    wrote on last edited by
    #1

    I'm very new to audio. I stumbled across the following code and I'm using the it to play audio .mp3s in my DX9.0 app. ( Nov 08 SDK )

    ::CoInitialize(NULL);
    CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **)&g_pGraphBuilder);
    g_pGraphBuilder->QueryInterface(IID_IMediaControl, (void **)&g_pMediaControl);
    g_pGraphBuilder->AddSourceFilter(L"../Media/Audio/Music/Artifact_CharMain.mp3", L"../Media/Audio/Music/Artifact_CharMain.mp3", &pSource);
    pSource->FindPin(L"Output", &pPin);
    g_pGraphBuilder->Render(pPin);
    pPin->Release();
    g_pMediaControl->Run();

    How can I make the .mp3 loop? Thanks!

    L D 2 Replies Last reply
    0
    • F Fordfanboi

      I'm very new to audio. I stumbled across the following code and I'm using the it to play audio .mp3s in my DX9.0 app. ( Nov 08 SDK )

      ::CoInitialize(NULL);
      CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **)&g_pGraphBuilder);
      g_pGraphBuilder->QueryInterface(IID_IMediaControl, (void **)&g_pMediaControl);
      g_pGraphBuilder->AddSourceFilter(L"../Media/Audio/Music/Artifact_CharMain.mp3", L"../Media/Audio/Music/Artifact_CharMain.mp3", &pSource);
      pSource->FindPin(L"Output", &pPin);
      g_pGraphBuilder->Render(pPin);
      pPin->Release();
      g_pMediaControl->Run();

      How can I make the .mp3 loop? Thanks!

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Fordfanboi wrote:

      How can I make the .mp3 loop?

      I've never worked with the media control. That said, if the COM interfaces provide a feature that you can use to have the control loop the resource that would be the best approach. If it does not, then you will have to code a loop yourself, I guess.

      1 Reply Last reply
      0
      • F Fordfanboi

        I'm very new to audio. I stumbled across the following code and I'm using the it to play audio .mp3s in my DX9.0 app. ( Nov 08 SDK )

        ::CoInitialize(NULL);
        CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **)&g_pGraphBuilder);
        g_pGraphBuilder->QueryInterface(IID_IMediaControl, (void **)&g_pMediaControl);
        g_pGraphBuilder->AddSourceFilter(L"../Media/Audio/Music/Artifact_CharMain.mp3", L"../Media/Audio/Music/Artifact_CharMain.mp3", &pSource);
        pSource->FindPin(L"Output", &pPin);
        g_pGraphBuilder->Render(pPin);
        pPin->Release();
        g_pMediaControl->Run();

        How can I make the .mp3 loop? Thanks!

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Fordfanboi wrote:

        How can I make the .mp3 loop?

        See here, about 3/4 of the way down.

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups