Thread: stopping midis with mciSendString()

  1. #1
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039

    stopping midis with mciSendString()

    hey, i'm using mciSendString to play music in my game. I was wondering, how can i stop music from playing once i've started it?

    Code:
    //...
    mciSendString("play song.mid", NULL, 0, NULL);
    //...
    mciSendString("stop song.mid", NULL, 0, NULL); // this wont work
    help?
    thanks

  2. #2
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Post Maybe...

    I think I have done this once before. Store it in a char:

    char* mid = "mymid.mid";
    char* str = new char[256];

    sprintf(str, "play %s", mid);

    // ... SendString ...

    // ... Stop ...

    sprintf(str, "stop %s", mid);

    // ... SendString ...
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  3. #3
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    so would i say
    Code:
    mciSendString(str);
    ?
    and wouldn't it just do the same thing?

  4. #4
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Post Basically...

    mciSendString(
    str,
    NULL, NULL, NULL
    );
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  5. #5
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    yeah well i got it...i made a DWORD variable pointing to the functions and set the variable to 2, 1, and 0.(2 being stop)
    so all is well...thanks syntax

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multithreading (flag stopping a thread, ring buffer) volatile
    By ShwangShwing in forum C Programming
    Replies: 3
    Last Post: 05-19-2009, 07:27 AM
  2. Stopping Processes Question
    By brett in forum Linux Programming
    Replies: 3
    Last Post: 06-24-2007, 10:15 PM
  3. stopping in else block
    By linuxman in forum C Programming
    Replies: 3
    Last Post: 03-24-2004, 08:35 PM
  4. mciSendString
    By GaPe in forum Windows Programming
    Replies: 9
    Last Post: 12-28-2002, 09:52 AM
  5. Outputting MIDI's in DOS
    By Xterria in forum Game Programming
    Replies: 5
    Last Post: 10-08-2001, 04:55 PM