pax_global_header00006660000000000000000000000064112333617040014512gustar00rootroot0000000000000052 comment=c9a8603caa752585563645a289eb72d580e40c24 sdlaplay-0.0.4/000075500000000000000000000000001123336170400133225ustar00rootroot00000000000000sdlaplay-0.0.4/.gear/000075500000000000000000000000001123336170400143165ustar00rootroot00000000000000sdlaplay-0.0.4/.gear/rules000064400000000000000000000000471123336170400153740ustar00rootroot00000000000000tar: v@version@:. diff: v@version@:. . sdlaplay-0.0.4/.gear/tags/000075500000000000000000000000001123336170400152545ustar00rootroot00000000000000sdlaplay-0.0.4/.gear/tags/8bd5680c203f0c5e775cc676953ae0b3eed8b1ee000064400000000000000000000005321123336170400230050ustar00rootroot00000000000000object 6576294c93413190c25163371836c0674b883097 type commit tag v0.0.3 tagger Valery Inozemtsev 1248707911 +0400 sdlaplay 0.0.3 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAkptxUcACgkQcNyQ4l5HvIoqswCgm/4pE8b38uUC34F37/dyEXVG 1tEAoLvMG41ucJ7vmwp2AFLOtOTQJXDf =33ib -----END PGP SIGNATURE----- sdlaplay-0.0.4/.gear/tags/list000064400000000000000000000000601123336170400161460ustar00rootroot000000000000008bd5680c203f0c5e775cc676953ae0b3eed8b1ee v0.0.3 sdlaplay-0.0.4/Makefile.am000064400000000000000000000000671123336170400153610ustar00rootroot00000000000000bin_PROGRAMS = sdlaplay sdlaplay_SOURCES = sdlaplay.c sdlaplay-0.0.4/configure.ac000064400000000000000000000005601123336170400156110ustar00rootroot00000000000000AC_PREREQ([2.57]) AC_INIT(sdlaplay, [0.0.4], [https://bugzilla.altlinux.org]) AM_INIT_AUTOMAKE([dist-bzip2 foreign]) AC_PROG_CC AC_PROG_INSTALL AC_CHECK_LIB(SDL, SDL_Init, [], [AC_MSG_ERROR([libSDL is required, but was not found.])]) AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, [], [AC_MSG_ERROR([libSDL_mixer is required, but was not found.])]) AC_OUTPUT([Makefile]) sdlaplay-0.0.4/sdlaplay.c000064400000000000000000000066741123336170400153140ustar00rootroot00000000000000/* * Copyright (C) 2008 Valery V. Inozemtsev * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "SDL/SDL.h" #include "SDL/SDL_mixer.h" extern const char *__progname; static struct option const longopts[] = { {"volume", required_argument, 0, 'v'}, {"driver", required_argument, 0, 'd'}, {"rate", required_argument, 0, 'r'}, {"help", no_argument, 0, 'h'}, {0, no_argument, 0, 0} }; static void __attribute__ ((__noreturn__)) usage (FILE * stream, int status) { fprintf (stream, "\ %s - SDL audio player.\n\ Usage: %s [-v | --volume 0..100] [-d | --driver alsa|pulse] [-r | --rate 8000|11025|16000|22050|24000|32000|44100|48000] input file\n\ %s [-h | --help]\n\ \nReport bugs to http://bugs.altlinux.ru/\n", __progname, __progname, __progname); exit (status); } int main(int argc, char *argv[]) { int c; int audio_rate = 22050; Uint16 audio_format = AUDIO_S16; int audio_channels = 2; int audio_buffers = 4096; int volume = 100; char *driver = NULL; Mix_Music *music = NULL; char *filename; while ((c = getopt_long (argc, argv, "v:d:r:h", longopts, 0)) != -1) switch (c) { case 'v': volume = atoi(optarg); break; case 'd': driver = optarg; if ((strcmp(driver, "alsa") != 0) && (strcmp(driver, "pulse") != 0)) usage(stderr, EXIT_FAILURE); break; case 'r': if ((strcmp(optarg, "8000") != 0) && (strcmp(optarg, "11025") != 0) && (strcmp(optarg, "16000") != 0) && (strcmp(optarg, "22050") != 0) && (strcmp(optarg, "24000") != 0) && (strcmp(optarg, "32000") != 0) && (strcmp(optarg, "44100") != 0) && (strcmp(optarg, "48000") != 0)) usage(stderr, EXIT_FAILURE); audio_rate = atoi(optarg); break; case 'h': usage(stdout, EXIT_SUCCESS); break; default: usage(stderr, EXIT_FAILURE); } filename = argv[optind++]; if (!filename || !*filename) usage (stderr, EXIT_FAILURE); if (driver != NULL) setenv("SDL_AUDIODRIVER", driver, 1); if (SDL_Init(SDL_INIT_AUDIO) < 0) { fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); return 1; } if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)) { fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError()); return 1; } music = Mix_LoadMUS(filename); if (music == NULL) { fprintf(stderr, "Couldn't load %s: %s\n", filename, SDL_GetError()); return 1; } if (volume > 100) volume = 100; if (volume < 0) volume = 0; Mix_VolumeMusic((MIX_MAX_VOLUME / 100) * volume); if (Mix_PlayMusic(music, 0) == -1) fprintf(stderr, "Mix_PlayMusic: %s\n", Mix_GetError()); while (Mix_PlayingMusic()) SDL_Delay(100); Mix_HaltMusic(); Mix_FreeMusic(music); music = NULL; Mix_CloseAudio(); SDL_Quit(); return 0; } sdlaplay-0.0.4/sdlaplay.spec000064400000000000000000000011541123336170400160100ustar00rootroot00000000000000Name: sdlaplay Version: 0.0.3 Release: alt1 Summary: SDL audio player License: GPLv2 Group: Sound Packager: Valery Inozemtsev Source: %name-%version.tar BuildRequires: libSDL-devel libSDL_mixer-devel %description SDL audio player %prep %setup -q %build %autoreconf %configure %make %install %make DESTDIR=%buildroot install %files %_bindir/* %changelog * Mon Jul 27 2009 Valery Inozemtsev 0.0.3-alt1 - 0.0.3 * Wed Nov 19 2008 Valery Inozemtsev 0.0.2-alt1 - 0.0.2 * Tue Nov 11 2008 Valery Inozemtsev 0.0.1-alt1 - initial release