music_mpg.h
author Ozkan Sezer <sezeroz@gmail.com>
Thu, 11 Oct 2018 11:50:10 +0300
branchSDL-1.2
changeset 902 6c862e733898
permissions -rw-r--r--
remove smpeg support completely and backport libmpg123 support instead.
     1 /*
     2     SDL_mixer:    An audio mixer library based on the SDL library
     3     Copyright (C) 1997-2017 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 #ifdef MP3_MUSIC
    23 
    24 #include <mpg123.h>
    25 
    26 typedef struct
    27 {
    28     SDL_RWops* src;
    29     int freesrc;
    30 
    31     SDL_AudioSpec mixer;
    32 
    33     int playing;
    34     int volume;
    35 
    36     mpg123_handle* handle;
    37 
    38     int gotformat;
    39     SDL_AudioCVT cvt;
    40     Uint8 buf[8192];
    41     size_t len_available;
    42     Uint8* snd_available;
    43 }
    44 mpg_data;
    45 
    46 mpg_data* mpg_new_rw(SDL_RWops *src, SDL_AudioSpec* mixer, int freesrc);
    47 void mpg_delete(mpg_data* m);
    48 
    49 void mpg_start(mpg_data* m);
    50 void mpg_stop(mpg_data* m);
    51 int mpg_playing(mpg_data* m);
    52 
    53 int mpg_get_samples(mpg_data* m, Uint8* stream, int len);
    54 void mpg_seek(mpg_data* m, double seconds);
    55 void mpg_volume(mpg_data* m, int volume);
    56 
    57 #endif
    58