How do i add music to my game?
I have written a small game in 'c' that has 15 Levels. I am done with that work. But the thing I want is开发者_如何学运维 to add music to it. I am playing a song when the game starts using the
system("cmd /c start /min level1.mp3")
That is with the help of dos command.
It's working fine, but it's playing the file in its default player example like WMplayer or VLC player.But i want a separate player something like that plays music, something like that is hidden from user view but he should hear the sounds I wonder how the big games like EA sports and some Prince of Persia play the sounds . I believe they have their own sound drivers installed. Because their sounds wont be started in WMplayer or some other player.
I am satisfied to 90%. Now I'm more confident about me because writing a game in c and running music in the background. with some techniques i made it.But the drawback is, its played in the default player.So guys can anyone tell me how do i make it through? How do i play some music without the media player of computer? I mean how the sounds are added to games like some PS2 games.Thank you.I Just want to know the thing they do.
I'd suggest building the music player into the C program itself. SDL_mixer is a good and fairly simple library for doing this.
精彩评论