File: speed.c

package info (click to toggle)
alsaplayer 0.99.82-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,892 kB
  • sloc: ansic: 40,741; cpp: 14,400; makefile: 983; sh: 796; lex: 751; asm: 45; python: 29; sed: 16
file content (35 lines) | stat: -rw-r--r-- 748 bytes parent folder | download | duplicates (10)
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
#include <alsaplayer/control.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main (int argc, char *argv[])
{
	int i;
	char artist[AP_ARTIST_MAX];
	char title[AP_TITLE_MAX];
	float speed = 0.0;
	int session_id = 0;

	if (ap_get_title(session_id, title) &&
	    ap_get_artist(session_id, artist)) {
		printf("File playing: %s - %s\n", title, artist);
	}
	
	if (argc == 2) {
		if (sscanf (argv[1], "%f", &speed) == 1) {
			if (speed == 0.0) {
				printf ("Pausing player\n");
				ap_pause(session_id);
			} else {
				printf ("Setting speed to %.2f\n", speed);
				ap_set_speed(session_id, speed);
			}
		}
	}
	if (ap_get_speed(session_id, &speed)) {
		printf ("Current speed = %.2f\n", speed);
	}	
	return 0;
}