/usr/share/doc/libalure-dev/examples/alureplay.c is in libalure-dev 1.2-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #include <stdio.h>
#include "AL/alure.h"
volatile int isdone = 0;
static void eos_callback(void *unused, ALuint unused2)
{
isdone = 1;
(void)unused;
(void)unused2;
}
int main( int argc, char **argv)
{
ALuint src, buf;
if(argc < 2)
{
fprintf(stderr, "Usage %s <soundfile>\n", argv[0]);
return 1;
}
if(!alureInitDevice(NULL, NULL))
{
fprintf(stderr, "Failed to open OpenAL device: %s\n", alureGetErrorString());
return 1;
}
alGenSources(1, &src);
if(alGetError() != AL_NO_ERROR)
{
fprintf(stderr, "Failed to create OpenAL source!\n");
alureShutdownDevice();
return 1;
}
buf = alureCreateBufferFromFile(argv[1]);
if(!buf)
{
fprintf(stderr, "Could not load %s: %s\n", argv[1], alureGetErrorString());
alDeleteSources(1, &src);
alureShutdownDevice();
return 1;
}
alSourcei(src, AL_BUFFER, buf);
if(alurePlaySource(src, eos_callback, NULL) == AL_FALSE)
{
fprintf(stderr, "Failed to start source!\n");
alDeleteSources(1, &src);
alDeleteBuffers(1, &buf);
alureShutdownDevice();
return 1;
}
while(!isdone)
{
alureSleep(0.125);
alureUpdate();
}
alDeleteSources(1, &src);
alDeleteBuffers(1, &buf);
alureShutdownDevice();
return 0;
}
|