hzeller / rpi-rgb-led-matrix

Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO
GNU General Public License v2.0
3.63k stars 1.15k forks source link

Can't add mp3 file #1542

Open lorenzoantei opened 1 year ago

lorenzoantei commented 1 year ago

I'm try to edit led-image-viewer util to add mp3 playback. I add `#include <SDL2/SDL.h>

include <SDL2/SDL_mixer.h>`

into main(): `if (SDL_Init(SDL_INIT_AUDIO) != 0) { printf("Error initializing SDL: %s\n", SDL_GetError()); return -1; }

int mixer_flags = MIX_INIT_MP3; int mixer_result = Mix_Init(mixer_flags); if (mixer_flags != mixer_result) { printf("Error initialising SDL mixer (result: %d).\n", mixer_result); printf("Mix_Init: %s\n", Mix_GetError()); return -1; }

Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 640); Mix_Music *music = Mix_LoadMUS("sample.mp3"); Mix_PlayMusic(music, 1); uint32_t audio_start_time = SDL_GetTicks();`

But I'm getting trouble with make. Can someone suggest how I can do it? I simply need to play a mp3 looped with 3 gifs.

combs commented 1 year ago

this is more of a general "how to use SDL" question, have you tried stackexchange? nothing specific to rpi-rgb-led-matrix...