我无法SDL_Mixer
在树莓派上播放声音。该程序可以编译并构建,但我听到的只是一声短促的吱吱声(像静态的),什么也没有。
有任何想法吗?
#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>
#include <stdio.h>
#include <string>
#include <iostream>
int main()
{
Mix_Chunk *snd1 = NULL;
Mix_Music *m = NULL;
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
std::cout << "Something went wrong";
}
if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024) < 0) {
std::cout << "Kunne ikke loade musikk";
}
snd1 = Mix_LoadWAV("bicycle_bell.wav");
if(snd1 == NULL) {
std::cout << "Fant ikke filen";
}
Mix_PlayChannel(-1, snd1, 0);
Mix_FreeChunk(snd1);
Mix_Quit();
return 1;
}