mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
[Bug Fix] MusicManager
Bug Fixed in MusicManager. Now the sample code can play the music.
This commit is contained in:
parent
9c1feddb49
commit
18735d4aea
11
App.cpp
11
App.cpp
|
@ -20,9 +20,14 @@ namespace App
|
||||||
rnd.update();
|
rnd.update();
|
||||||
|
|
||||||
MusicPlayer player;
|
MusicPlayer player;
|
||||||
Music m("res/music.mp3");
|
Music m;
|
||||||
player.add(m,-1);
|
int ret=m.load("res/music.mp3");
|
||||||
player.play();
|
printf("ret=%d\n",ret);
|
||||||
|
ret=player.add(m,-1);
|
||||||
|
printf("ret=%d\n",ret);
|
||||||
|
ret=player.play();
|
||||||
|
printf("ret=%d\n",ret);
|
||||||
|
printf("%s\n",Mix_GetError());
|
||||||
|
|
||||||
while(1) SDL_PollEvent(0);
|
while(1) SDL_PollEvent(0);
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,10 @@ int Music::load(const char* MusicFileName)
|
||||||
}
|
}
|
||||||
int Music::unload()
|
int Music::unload()
|
||||||
{
|
{
|
||||||
|
printf("Unloaded.\n");
|
||||||
if(pimpl->sMusic.get())
|
if(pimpl->sMusic.get())
|
||||||
{
|
{
|
||||||
|
printf("Reset to NULL\n");
|
||||||
pimpl->sMusic.reset();
|
pimpl->sMusic.reset();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +40,7 @@ bool Music::ready()
|
||||||
}
|
}
|
||||||
Music::~Music()
|
Music::~Music()
|
||||||
{
|
{
|
||||||
unload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user