Android.mk
author Sam Lantinga <slouken@libsdl.org>
Sat, 23 Aug 2014 10:57:26 -0700
changeset 696 9599bb0ff844
parent 695 6a5e6d8d6a35
child 754 dac1854c8826
permissions -rw-r--r--
Fixed bug 2690 - Floating point exception in Mix_Volume()

Francisco de la Peña

This happens rarely under uncertain circunstances, as it doesn't crash always and does it randomly. Fortunately, I've got a backtrace when running a GDB session. Might be a divide by zero issue in SDL or SDL_mixer.

Program received signal SIGFPE, Arithmetic exception.
0x00000038e8c08a7d in mix_channels (udata=<optimized out>, stream=0x24e11b0 "", len=2048) at mixer.c:345
345 Mix_Volume(i, (mix_channel[i].fade_volume * ticks) / mix_channel[i].fade_length );
(gdb) bt f
#0 0x00000038e8c08a7d in mix_channels (udata=<optimized out>, stream=0x24e11b0 "", len=2048) at mixer.c:345
ticks = 0
mix_input = <optimized out>
i = 0
mixable = <optimized out>
volume = <optimized out>
sdl_ticks = 129373

Using SDL 2.0.3 and SDL_Mixer 2.0.0, PulseAudio, Fedora 20 x86_64 but looks like can be reproduced on other platforms.
     1 LOCAL_PATH := $(call my-dir)
     2 
     3 include $(CLEAR_VARS)
     4 
     5 LOCAL_MODULE := SDL2_mixer
     6 
     7 # Enable this if you want to support loading MOD music via modplug
     8 # The library path should be a relative path to this directory.
     9 SUPPORT_MOD_MODPLUG ?= true
    10 MODPLUG_LIBRARY_PATH := external/libmodplug-0.8.8.4
    11 
    12 # Enable this if you want to support loading MOD music via mikmod
    13 # The library path should be a relative path to this directory.
    14 SUPPORT_MOD_MIKMOD ?= true
    15 MIKMOD_LIBRARY_PATH := external/libmikmod-3.1.12
    16 
    17 # Enable this if you want to support loading MP3 music via SMPEG
    18 # The library path should be a relative path to this directory.
    19 SUPPORT_MP3_SMPEG ?= true
    20 SMPEG_LIBRARY_PATH := external/smpeg2-2.0.0
    21 
    22 # Enable this if you want to support loading OGG Vorbis music via Tremor
    23 # The library path should be a relative path to this directory.
    24 SUPPORT_OGG ?= true
    25 OGG_LIBRARY_PATH := external/libogg-1.3.1
    26 VORBIS_LIBRARY_PATH := external/libvorbisidec-1.2.1
    27 
    28 
    29 # Enable this if you want to support TiMidity
    30 SUPPORT_TIMIDITY ?= true
    31 
    32 LOCAL_C_INCLUDES := $(LOCAL_PATH) 
    33 LOCAL_CFLAGS := -DWAV_MUSIC 
    34 
    35 LOCAL_SRC_FILES := $(notdir $(filter-out %/playmus.c %/playwave.c, $(wildcard $(LOCAL_PATH)/*.c))) \
    36 
    37 
    38 LOCAL_LDLIBS :=
    39 LOCAL_STATIC_LIBRARIES :=
    40 LOCAL_SHARED_LIBRARIES := SDL2
    41 
    42 ifeq ($(SUPPORT_TIMIDITY),true)
    43 	LOCAL_C_INCLUDES += $(LOCAL_PATH)/timidity
    44 	LOCAL_CFLAGS += -DMID_MUSIC -DUSE_TIMIDITY_MIDI
    45 	LOCAL_SRC_FILES += $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/timidity/*.c))
    46 endif
    47 
    48 ifeq ($(SUPPORT_MOD_MODPLUG),true)
    49     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/src $(LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/src/libmodplug
    50     LOCAL_CFLAGS += -DMODPLUG_MUSIC -DMODPLUG_HEADER="<modplug.h>" -DHAVE_SETENV -DHAVE_SINF
    51     LOCAL_SRC_FILES += \
    52         $(MODPLUG_LIBRARY_PATH)/src/fastmix.cpp \
    53         $(MODPLUG_LIBRARY_PATH)/src/load_669.cpp \
    54         $(MODPLUG_LIBRARY_PATH)/src/load_abc.cpp \
    55         $(MODPLUG_LIBRARY_PATH)/src/load_amf.cpp \
    56         $(MODPLUG_LIBRARY_PATH)/src/load_ams.cpp \
    57         $(MODPLUG_LIBRARY_PATH)/src/load_dbm.cpp \
    58         $(MODPLUG_LIBRARY_PATH)/src/load_dmf.cpp \
    59         $(MODPLUG_LIBRARY_PATH)/src/load_dsm.cpp \
    60         $(MODPLUG_LIBRARY_PATH)/src/load_far.cpp \
    61         $(MODPLUG_LIBRARY_PATH)/src/load_it.cpp \
    62         $(MODPLUG_LIBRARY_PATH)/src/load_j2b.cpp \
    63         $(MODPLUG_LIBRARY_PATH)/src/load_mdl.cpp \
    64         $(MODPLUG_LIBRARY_PATH)/src/load_med.cpp \
    65         $(MODPLUG_LIBRARY_PATH)/src/load_mid.cpp \
    66         $(MODPLUG_LIBRARY_PATH)/src/load_mod.cpp \
    67         $(MODPLUG_LIBRARY_PATH)/src/load_mt2.cpp \
    68         $(MODPLUG_LIBRARY_PATH)/src/load_mtm.cpp \
    69         $(MODPLUG_LIBRARY_PATH)/src/load_okt.cpp \
    70         $(MODPLUG_LIBRARY_PATH)/src/load_pat.cpp \
    71         $(MODPLUG_LIBRARY_PATH)/src/load_psm.cpp \
    72         $(MODPLUG_LIBRARY_PATH)/src/load_ptm.cpp \
    73         $(MODPLUG_LIBRARY_PATH)/src/load_s3m.cpp \
    74         $(MODPLUG_LIBRARY_PATH)/src/load_stm.cpp \
    75         $(MODPLUG_LIBRARY_PATH)/src/load_ult.cpp \
    76         $(MODPLUG_LIBRARY_PATH)/src/load_umx.cpp \
    77         $(MODPLUG_LIBRARY_PATH)/src/load_wav.cpp \
    78         $(MODPLUG_LIBRARY_PATH)/src/load_xm.cpp \
    79         $(MODPLUG_LIBRARY_PATH)/src/mmcmp.cpp \
    80         $(MODPLUG_LIBRARY_PATH)/src/modplug.cpp \
    81         $(MODPLUG_LIBRARY_PATH)/src/snd_dsp.cpp \
    82         $(MODPLUG_LIBRARY_PATH)/src/snd_flt.cpp \
    83         $(MODPLUG_LIBRARY_PATH)/src/snd_fx.cpp \
    84         $(MODPLUG_LIBRARY_PATH)/src/sndfile.cpp \
    85         $(MODPLUG_LIBRARY_PATH)/src/sndmix.cpp
    86 endif
    87 
    88 ifeq ($(SUPPORT_MOD_MIKMOD),true)
    89     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MIKMOD_LIBRARY_PATH)/include
    90     LOCAL_CFLAGS += -DMOD_MUSIC
    91     LOCAL_SHARED_LIBRARIES += mikmod
    92 endif
    93 
    94 ifeq ($(SUPPORT_MP3_SMPEG),true)
    95     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(SMPEG_LIBRARY_PATH)
    96     LOCAL_CFLAGS += -DMP3_MUSIC
    97     LOCAL_SHARED_LIBRARIES += smpeg2
    98 endif
    99 
   100 ifeq ($(SUPPORT_OGG),true)
   101     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(OGG_LIBRARY_PATH)/include $(LOCAL_PATH)/$(VORBIS_LIBRARY_PATH)
   102     LOCAL_CFLAGS += -DOGG_MUSIC -DOGG_USE_TREMOR -DOGG_HEADER="<ivorbisfile.h>"
   103     ifeq ($(TARGET_ARCH_ABI),armeabi)
   104 	LOCAL_CFLAGS += -D_ARM_ASSEM_
   105     endif
   106     ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
   107 	LOCAL_CFLAGS += -D_ARM_ASSEM_
   108     endif
   109     LOCAL_SRC_FILES += \
   110         $(VORBIS_LIBRARY_PATH)/mdct.c \
   111         $(VORBIS_LIBRARY_PATH)/block.c \
   112         $(VORBIS_LIBRARY_PATH)/window.c \
   113         $(VORBIS_LIBRARY_PATH)/synthesis.c \
   114         $(VORBIS_LIBRARY_PATH)/info.c \
   115         $(VORBIS_LIBRARY_PATH)/floor1.c \
   116         $(VORBIS_LIBRARY_PATH)/floor0.c \
   117         $(VORBIS_LIBRARY_PATH)/vorbisfile.c \
   118         $(VORBIS_LIBRARY_PATH)/res012.c \
   119         $(VORBIS_LIBRARY_PATH)/mapping0.c \
   120         $(VORBIS_LIBRARY_PATH)/registry.c \
   121         $(VORBIS_LIBRARY_PATH)/codebook.c \
   122         $(VORBIS_LIBRARY_PATH)/sharedbook.c \
   123         $(OGG_LIBRARY_PATH)/src/framing.c \
   124         $(OGG_LIBRARY_PATH)/src/bitwise.c
   125 endif
   126 
   127 LOCAL_EXPORT_C_INCLUDES += $(LOCAL_C_INCLUDES)
   128 
   129 LOCAL_ARM_MODE := arm
   130 
   131 include $(BUILD_SHARED_LIBRARY)