これと同じことが画像を読み込む際にも起きています。どうしてでしょうか、ご教授お願いします。
また。関数外で読み込みたい理由は、作った関数をwhile文で回すからです。
音楽がならないコード
int bgm=LoadSoundMem( "souds/bgm.mp3" ) ;
/////////////////////// gameのスタートの関数定義 ///////////////////////////////////////////////////////
void gamestart()
{
gamestate=Gs; //ゲームモード スタート
int title=LoadGraph("images/title.png");
DrawGraph( 0 , 130 , title, TRUE ) ;
DeleteGraph( title ) ;
// 描画する文字列のサイズを設定
int Cr=GetColor(255,255,255);
SetFontSize(30) ;
DrawString( 50 , 500 , "ゲームスタートするにはSPACEキーを押してください" , Cr ) ;
SetFontSize( 28) ;
DrawString( 2 , 550 , "キャラクターを操作するには↑↓→←キーを押してください" , Cr ) ;
int key =GetJoypadInputState(DX_INPUT_KEY_PAD1);
if(IsAKeyTrigger(key)==TRUE) gamestate=Gm, PlaySoundMem( bgm , DX_PLAYTYPE_LOOP ),start=GetNowCount(); ;
// 上を押していたら上に進む
}
/////////////////////// gameのスタートの関数定義 ///////////////////////////////////////////////////////
void gamestart()
{
gamestate=Gs; //ゲームモード スタート
int title=LoadGraph("images/title.png");
DrawGraph( 0 , 130 , title, TRUE ) ;
DeleteGraph( title ) ;
// 描画する文字列のサイズを設定
int Cr=GetColor(255,255,255);
SetFontSize(30) ;
DrawString( 50 , 500 , "ゲームスタートするにはSPACEキーを押してください" , Cr ) ;
SetFontSize( 28) ;
DrawString( 2 , 550 , "キャラクターを操作するには↑↓→←キーを押してください" , Cr ) ;
int bgm=LoadSoundMem( "souds/bgm.mp3" ) ;
int key =GetJoypadInputState(DX_INPUT_KEY_PAD1);
if(IsAKeyTrigger(key)==TRUE) gamestate=Gm, PlaySoundMem( bgm , DX_PLAYTYPE_LOOP ),start=GetNowCount(); ;
// 上を押していたら上に進む
}