Skip to content

Commit

Permalink
Add MP3 decoding support using 'minimp3'
Browse files Browse the repository at this point in the history
  • Loading branch information
vittorioromeo committed Dec 7, 2021
1 parent d0ebdc8 commit b7d31e9
Show file tree
Hide file tree
Showing 12 changed files with 3,575 additions and 5 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Expand Up @@ -175,14 +175,14 @@ if(SFML_USE_SYSTEM_DEPS)
foreach(DEP_FILE ${DEP_LIBS} ${DEP_BINS} ${DEP_HEADERS})
get_filename_component(DEP_DIR ${DEP_FILE} PATH)

if(NOT DEP_DIR MATCHES "/stb_image(/|$)")
set(CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH} ${DEP_DIR})
if(NOT DEP_DIR MATCHES "/(stb_image|minimp3)(/|$)")
list(APPEND CMAKE_IGNORE_PATH "${DEP_DIR}")
endif()

get_filename_component(DEP_PARENT_DIR ${DEP_DIR} PATH)
while(NOT DEP_PARENT_DIR STREQUAL "${CMAKE_SOURCE_DIR}/extlibs")
if(NOT DEP_DIR MATCHES "/stb_image(/|$)")
set(CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH} ${DEP_PARENT_DIR})
if(NOT DEP_DIR MATCHES "/(stb_image|minimp3)(/|$)")
list(APPEND CMAKE_IGNORE_PATH "${DEP_PARENT_DIR}")
endif()

get_filename_component(DEP_PARENT_DIR ${DEP_PARENT_DIR} PATH)
Expand Down
1 change: 1 addition & 0 deletions examples/asset_licenses.md
Expand Up @@ -11,6 +11,7 @@ All assets are under public domain (CC0):
| shader/resources/background.jpg | Arcana Dea | [Public Domain Images][4] |
| shader/resources/devices.png | Kenny.nl | [Game Icons Pack][5] |
| sound/resources/ding.flac | Kenny.nl | [Interface Sounds Pack][6] |
| sound/resources/ding.mp3 | Kenny.nl | [Interface Sounds Pack][6] |
| win32/resources/image1.jpg | Kenny.nl | [Toon Character Pack][7] |
| win32/resources/image2.jpg | Kenny.nl | [Toon Character Pack][7] |
| sound/resources/killdeer.wav | US National Park Services | [Bird sounds][8] |
Expand Down
3 changes: 3 additions & 0 deletions examples/sound/Sound.cpp
Expand Up @@ -93,6 +93,9 @@ int main()
// Play music from a flac file
playMusic("ding.flac");

// Play music from a mp3 file
playMusic("ding.mp3");

// Wait until the user presses 'enter' key
std::cout << "Press enter to exit..." << std::endl;
std::cin.ignore(10000, '\n');
Expand Down
Binary file added examples/sound/resources/ding.mp3
Binary file not shown.

0 comments on commit b7d31e9

Please sign in to comment.