Hi Ampli,
Unfortunately I don't have purebasic nor linux installed, but here some ideas for you to research about it.
Using Energy's example, you will need to remove "wimm.lib" and "kernel32.lib" they are windows specific, on linux you will use SDL.
Use something like this:
ImportC "-lSDL2"
Here is a "C" code used to setup sdl audio, I think it should be easy to convert to purebasic:
static void synthCallback(void *udata, Uint8 *stream, int len) {
/* the music is stereo - use 32 bit for left and right channel */
static int32_t* sample = (int32_t*)synthBuffer;
int32_t* ptr = (int32_t*) stream;
udata += 0;
int i;
for (i = len / (SYNTH_OUTPUT_SAMPLE_SIZE * SYNTH_CHANNELS); i > 0 ; i--) {
/* loop the track */
if (samplePosition >= MAX_SAMPLES) {
samplePosition = 0;
sample = udata;
}
/* copy left and right channel at the same time */
*ptr++ = *sample++;
samplePosition++;
}
}
/* audio specification */
SDL_AudioSpec audioSpec;
audioSpec.freq = SAMPLE_RATE;
audioSpec.format = AUDIO_S16SYS;
audioSpec.channels = SYNTH_CHANNELS;
audioSpec.silence = 0;
audioSpec.samples = SYNTH_PLAY_BUFFER;
audioSpec.size = 0;
audioSpec.callback = synthCallback;
audioSpec.userdata = synthBuffer;
/* setup audio */
if (SDL_OpenAudio(&audioSpec, NULL)) {
fprintf(stderr, "SDL_OpenAudio() failed\n");
SDL_Quit();
return EXIT_FAILURE;
}
/* no multicore - precalculate the music */
__4klang_render(synthBuffer);
/* start the music */
SDL_PauseAudio(0);
Another thing to check is how to allocate memory for "synthBuffer", I believe it should be:
synthBuffer = AllocateMemory(#MAX_SAMPLES*#SAMPLE_TYPE*2)