c++ - SDL_mixer no sound for certain mp3 files -
so i'm having issues sdl_mixer, , seems plays fine on amount of mp3s (although "fine". noticed @ beginning of mp3s there's small segment of sound corruption, , starts playing) on mp3 files, there's absolute silence. doesn't seem play anything. , mix_playmusic doesn't seem return error, nor else, seems not make single sound. i'll random "access reading violation" when trying play files, every other time, it's silence.
here code i'm using play mp3 file:
#include "sdl.h" #include "sdl_mixer.h" #include <iostream> bool initlibs() { //initialize sdl subsystems if( sdl_init( sdl_init_everything ) == -1 ) { return false; } int flags = mix_init_mp3 | mix_init_ogg; if(mix_init(flags)!=flags) { return false; } //initialize sdl_mixer if( mix_openaudio(mix_default_frequency, audio_s16, 2, 4096 ) == -1 ) { return false; } //if initialized fine return true; } int main(int argc, char* argv[]) { if(!initlibs()) { std::cout << "error loading libraries" << std::endl; } mix_music* music = mix_loadmus("test.mp3"); if(music == nullptr) { std::cout << "error loading music: " << mix_geterror() << std::endl; } else { if(mix_playmusic(music, -1) == -1) { std::cout << "error playing music: " << mix_geterror() << std::endl; } } sdl_delay(30000); system("pause"); mix_haltmusic(); mix_freemusic(music); system("pause"); return 0; } i examining differences in mp3 files, , seems real difference ones lame3.99 encoding ones don't seem work. able explain this?
edit: after more testing, seems happen on other ones
Comments
Post a Comment