jeudi 6 mars 2014

Playing sound on a console application :c topic




Since i'am going to make a rpg game for practicing what i've learned so far,before i move on...
I'm trying to put a BGM on my "game",searched everywhere,and nothing seems to work,so yea...i think someone here can help me

this is the presentation menu, it is inside "main()" just for now....
this is what i found to put a BGM


Code:


#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <cstdlib>
#include <ctime>
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")

using namespace std;

int main()
{
    PlaySound(TEXT("mm.wav"), NULL, SND_FILENAME | SND_ASYNC);

    system("COLOR 01");
    cout << "              ###################################################" << endl;
    cout << "              ##                                              ##" << endl;
    cout << "              ##                                              ##" << endl;
    cout << "              ##                                              ##" << endl;
    cout << "              ##                                              ##" << endl;
    cout << "              ##            Pequena Adventures V1.0          ##" << endl;
    cout << "              ##                  Coder: Tyrr64.              ##" << endl;
    cout << "              ##                                              ##" << endl;
    cout << "              ##                                              ##" << endl;
    cout << "              ##                                              ##" << endl;
    cout << "              ##                                              ##" << endl;
    cout << "              ##                                              ##" << endl;
    cout << "              ##                                              ##" << endl;
    cout << "              ###################################################" << endl;
   
    cin.get();
    return 0;
}


I've installed the WDK since i did not found winmm.lib on my computer

everything compiles fine,but the musics does not get played,so... where is my error?
//i'am using VC2013 ultimate....
Thanks!





Aucun commentaire:

Enregistrer un commentaire