File: play_ogg.c

package info (click to toggle)
allegro4.4 2%3A4.4.3.1-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 20,756 kB
  • sloc: ansic: 164,458; asm: 17,620; cpp: 3,848; javascript: 3,053; objc: 1,687; sh: 1,107; python: 676; pascal: 179; makefile: 57; perl: 29; lisp: 1
file content (36 lines) | stat: -rw-r--r-- 624 bytes parent folder | download | duplicates (3)
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
#include <stdio.h>
#include "logg.h"

int main(int argc, char** argv)
{
	SAMPLE* s;
	int voice;

	if (argc != 2) {
		printf("usage: %s file.ogg\n", argv[0]);
		return 0;
	}

	if (allegro_init() != 0) {
		printf("Error initialising Allegro.\n");
		return 1;
	}

	if (install_sound(DIGI_AUTODETECT, MIDI_NONE, 0) != 0) {
		printf("Error initialising sound: %s\n", allegro_error);
		return 1;
	}
	install_timer();

	s = logg_load(argv[1]);
	if (!s) {
		printf("Error loading %s\n", argv[1]);
		return 1;
	}

	voice = play_sample(s, 255, 128, 1000, 0);
	rest(s->len*1000/s->freq);
	destroy_sample(s);
	return 0;
}
END_OF_MAIN()