stopping midis with mciSendString()

This is a discussion on stopping midis with mciSendString() within the Game Programming forums, part of the General Programming Boards category; hey, i'm using mciSendString to play music in my game. I was wondering, how can i stop music from playing ...

  1. #1
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035

    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: trifaze_mattu@lycos.com

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

  3. #3
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    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: trifaze_mattu@lycos.com

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

  5. #5
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    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, 08:27 AM
  2. Stopping Processes Question
    By brett in forum Linux Programming
    Replies: 3
    Last Post: 06-24-2007, 11: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, 05:55 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21