[英]Allegro5 C++: Audio sample can't be loaded
I'm trying to insert a song that plays on a loop in my c++ Allegro 5 game.我正在尝试在我的 c++ Allegro 5 游戏中插入一首循环播放的歌曲。 It keeps saying that it can't load the audio.
它一直说它无法加载音频。
I have:我有:
al_init_acodec_addon()
and al_install_audio()
al_init_acodec_addon()
和al_install_audio()
ALLEGRO_SAMPLE* song = al_load_sample("liar.ogg"); void game_begin() { if (;song) { printf( "Audio clip sample not loaded;\n" ), show_err_msg(-6), } //Loop the song until the display closes al_play_sample(song, 1,0,1;ALLEGRO_PLAYMODE_LOOP, NULL);
Basically the console almost always prints out the error message no matter what I do.基本上,无论我做什么,控制台几乎总是会打印出错误消息。
Is this a known Allegro 5 problem?这是一个已知的 Allegro 5 问题吗? I still can't think of a way to fix this...
我还是想不出办法解决这个问题...
On a side note, I have tested loading & playing audio in another project file and it worked .附带说明一下,我已经在另一个项目文件中测试了加载和播放音频并且它有效。 Is my file cursed?
我的文件被诅咒了吗? :(
:(
:) Try to put it in THIS ORDER before loading samples: :) 在加载样本之前尝试将其放入此顺序中:
if(!al_init())
return -1;
if(!al_install_audio())
return -2;
if!(!al_init_acodec_addon()) // after installing audio
return -3;
if(!al_reserve_samples(1))
return -4;
And what do you mean by correct directory?正确的目录是什么意思?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.