music_cmd.h
author Ozkan Sezer <sezeroz@gmail.com>
Sat, 13 Oct 2018 23:02:04 +0300
branchSDL-1.2
changeset 908 6b860486ce24
parent 892 9dd046cb6cd7
permissions -rw-r--r--
Mix_InitMP3: unload dll if mpg123_init() fails.
     1 /*
     2   SDL_mixer:  An audio mixer library based on the SDL library
     3   Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 /* This file supports an external command for playing music */
    23 
    24 #ifdef CMD_MUSIC
    25 
    26 #include <sys/types.h>
    27 #include <limits.h>
    28 #include <stdio.h>
    29 #if defined(__linux__) && defined(__arm__)
    30 # include <linux/limits.h>
    31 #endif
    32 #ifndef PATH_MAX /* GNU/Hurd? */
    33 # define PATH_MAX 4096
    34 #endif
    35 typedef struct {
    36 	char file[PATH_MAX];
    37 	char cmd[PATH_MAX];
    38 	pid_t pid;
    39 } MusicCMD;
    40 
    41 /* Unimplemented */
    42 extern void MusicCMD_SetVolume(int volume);
    43 
    44 /* Load a music stream from the given file */
    45 extern MusicCMD *MusicCMD_LoadSong(const char *cmd, const char *file);
    46 
    47 /* Start playback of a given music stream */
    48 extern void MusicCMD_Start(MusicCMD *music);
    49 
    50 /* Stop playback of a stream previously started with MusicCMD_Start() */
    51 extern void MusicCMD_Stop(MusicCMD *music);
    52 
    53 /* Pause playback of a given music stream */
    54 extern void MusicCMD_Pause(MusicCMD *music);
    55 
    56 /* Resume playback of a given music stream */
    57 extern void MusicCMD_Resume(MusicCMD *music);
    58 
    59 /* Close the given music stream */
    60 extern void MusicCMD_FreeSong(MusicCMD *music);
    61 
    62 /* Return non-zero if a stream is currently playing */
    63 extern int MusicCMD_Active(MusicCMD *music);
    64 
    65 #endif /* CMD_MUSIC */