diff --git a/CMakeLists.txt b/CMakeLists.txt index 66d06762e..50a31be43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,12 @@ elseif(EXISTS "/opt/vc/include/bcm_host.h") set(BCMHOST found) set(GLSystem "OpenGL ES" CACHE STRING "The OpenGL system to be used") #------------------------------------------------------------------------------- +#check if we're running on OSMC Vero4K +elseif(EXISTS "/opt/vero3/lib/libMali.so") + MESSAGE("libMali.so found") + set(VERO4K found) + set(GLSystem "OpenGL ES" CACHE STRING "The OpenGL system to be used") +#------------------------------------------------------------------------------- #check if we're running on olinuxino / odroid / etc elseif(EXISTS "/usr/lib/libMali.so" OR EXISTS "/usr/lib/arm-linux-gnueabihf/libMali.so" OR @@ -64,6 +70,10 @@ if(DEFINED BCMHOST) add_definitions(-D_RPI_) endif() +if(DEFINED VERO4K) + add_definitions(-D_VERO4K_) +endif() + if(DEFINED libCEC_FOUND) add_definitions(-DHAVE_LIBCEC) endif() @@ -135,6 +145,11 @@ if(DEFINED BCMHOST) "/opt/vc/include/interface/vmcs_host/linux" "/opt/vc/include/interface/vcos/pthreads" ) +#add include directory for Vero4K +elseif(DEFINED VERO4K) + LIST(APPEND COMMON_INCLUDE_DIRS + "/opt/vero3/include" + ) else() if(${GLSystem} MATCHES "Desktop OpenGL") LIST(APPEND COMMON_INCLUDE_DIRS @@ -153,6 +168,10 @@ if(DEFINED BCMHOST) link_directories( "/opt/vc/lib" ) +elseif(DEFINED VERO4K) + link_directories( + "/opt/vero3/lib" + ) endif() set(COMMON_LIBRARIES @@ -191,6 +210,11 @@ if(DEFINED BCMHOST) brcmEGL ${OPENGLES_LIBRARIES} ) +elseif(DEFINED VERO4K) + LIST(APPEND COMMON_LIBRARIES + EGL + ${OPENGLES_LIBRARIES} + ) else() if(MSVC) LIST(APPEND COMMON_LIBRARIES diff --git a/README.md b/README.md index df2c1a25f..96c5c6782 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ EmulationStation has a few dependencies. For building, you'll need CMake, SDL2, All of this be easily installed with apt-get: ```bash sudo apt-get install libsdl2-dev libfreeimage-dev libfreetype6-dev libcurl4-openssl-dev \ - libasound2-dev libgl1-mesa-dev build-essential cmake fonts-droid \ - libvlc-dev libvlccore-dev vlc-nox + libasound2-dev libgl1-mesa-dev build-essential cmake fonts-droid-fallback libvlc-dev \ + libvlccore-dev vlc-bin ``` **On Fedora:** All of this be easily installed with dnf ( With rpmfusion activated) : diff --git a/es-app/src/VolumeControl.cpp b/es-app/src/VolumeControl.cpp index 29b3f3b28..cfa9f6c47 100644 --- a/es-app/src/VolumeControl.cpp +++ b/es-app/src/VolumeControl.cpp @@ -8,7 +8,7 @@ #endif #if defined(__linux__) - #ifdef _RPI_ + #if defined(_RPI_) || defined(_VERO4K_) const char * VolumeControl::mixerName = "PCM"; #else const char * VolumeControl::mixerName = "Master"; @@ -22,7 +22,7 @@ std::weak_ptr VolumeControl::sInstance; VolumeControl::VolumeControl() : originalVolume(0), internalVolume(0) #if defined (__APPLE__) - #error TODO: Not implemented for MacOS yet!!! + #error TODO: Not implemented for MacOS yet!!! #elif defined(__linux__) , mixerIndex(0), mixerHandle(nullptr), mixerElem(nullptr), mixerSelemId(nullptr) #elif defined(WIN32) || defined(_WIN32) @@ -36,9 +36,9 @@ VolumeControl::VolumeControl() } VolumeControl::VolumeControl(const VolumeControl & right): - originalVolume(0), internalVolume(0) + originalVolume(0), internalVolume(0) #if defined (__APPLE__) - #error TODO: Not implemented for MacOS yet!!! + #error TODO: Not implemented for MacOS yet!!! #elif defined(__linux__) , mixerIndex(0), mixerHandle(nullptr), mixerElem(nullptr), mixerSelemId(nullptr) #elif defined(WIN32) || defined(_WIN32) @@ -86,9 +86,9 @@ void VolumeControl::init() //try to open mixer device if (mixerHandle == nullptr) { - #ifdef _RPI_ + // Allow users to override the AudioCard and MixerName in es_settings.cfg + mixerCard = Settings::getInstance()->getString("AudioCard").c_str(); mixerName = Settings::getInstance()->getString("AudioDevice").c_str(); - #endif snd_mixer_selem_id_alloca(&mixerSelemId); //sets simple-mixer index and name @@ -256,7 +256,7 @@ int VolumeControl::getVolume() const int volume = 0; #if defined (__APPLE__) - #error TODO: Not implemented for MacOS yet!!! + #error TODO: Not implemented for MacOS yet!!! #elif defined(__linux__) if (mixerElem != nullptr) { @@ -350,7 +350,7 @@ void VolumeControl::setVolume(int volume) //store values in internal variables internalVolume = volume; #if defined (__APPLE__) - #error TODO: Not implemented for MacOS yet!!! + #error TODO: Not implemented for MacOS yet!!! #elif defined(__linux__) if (mixerElem != nullptr) { diff --git a/es-app/src/VolumeControl.h b/es-app/src/VolumeControl.h index 75f598ffc..a2e420e7e 100644 --- a/es-app/src/VolumeControl.h +++ b/es-app/src/VolumeControl.h @@ -27,7 +27,7 @@ class VolumeControl static const char * mixerName; static const char * mixerCard; int mixerIndex; - snd_mixer_t* mixerHandle; + snd_mixer_t* mixerHandle; snd_mixer_elem_t* mixerElem; snd_mixer_selem_id_t* mixerSelemId; #elif defined(WIN32) || defined(_WIN32) diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 53512c89b..bacfdb383 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -16,6 +16,7 @@ #include "SystemData.h" #include "VolumeControl.h" #include +#include GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MENU"), mVersion(window) { @@ -94,13 +95,49 @@ void GuiMenu::openSoundSettings() if (UIModeController::getInstance()->isUIModeFull()) { -#ifdef _RPI_ +#if defined(__linux__) + // audio card + auto audio_card = std::make_shared< OptionListComponent >(mWindow, "AUDIO CARD", false); + std::vector audio_cards; + #ifdef _RPI_ + // RPi Specific Audio Cards + audio_cards.push_back("local"); + audio_cards.push_back("hdmi"); + audio_cards.push_back("both"); + #endif + audio_cards.push_back("default"); + audio_cards.push_back("sysdefault"); + audio_cards.push_back("dmix"); + audio_cards.push_back("hw"); + audio_cards.push_back("plughw"); + audio_cards.push_back("null"); + if (Settings::getInstance()->getString("AudioCard") != "") { + if(std::find(audio_cards.begin(), audio_cards.end(), Settings::getInstance()->getString("AudioCard")) == audio_cards.end()) { + audio_cards.push_back(Settings::getInstance()->getString("AudioCard")); + } + } + for(auto ac = audio_cards.cbegin(); ac != audio_cards.cend(); ac++) + audio_card->add(*ac, *ac, Settings::getInstance()->getString("AudioCard") == *ac); + s->addWithLabel("AUDIO CARD", audio_card); + s->addSaveFunc([audio_card] { + Settings::getInstance()->setString("AudioCard", audio_card->getSelected()); + VolumeControl::getInstance()->deinit(); + VolumeControl::getInstance()->init(); + }); + // volume control device auto vol_dev = std::make_shared< OptionListComponent >(mWindow, "AUDIO DEVICE", false); std::vector transitions; transitions.push_back("PCM"); transitions.push_back("Speaker"); transitions.push_back("Master"); + transitions.push_back("Digital"); + transitions.push_back("Analogue"); + if (Settings::getInstance()->getString("AudioDevice") != "") { + if(std::find(transitions.begin(), transitions.end(), Settings::getInstance()->getString("AudioDevice")) == transitions.end()) { + transitions.push_back(Settings::getInstance()->getString("AudioDevice")); + } + } for(auto it = transitions.cbegin(); it != transitions.cend(); it++) vol_dev->add(*it, *it, Settings::getInstance()->getString("AudioDevice") == *it); s->addWithLabel("AUDIO DEVICE", vol_dev); @@ -134,14 +171,19 @@ void GuiMenu::openSoundSettings() #ifdef _RPI_ // OMX player Audio Device auto omx_audio_dev = std::make_shared< OptionListComponent >(mWindow, "OMX PLAYER AUDIO DEVICE", false); - std::vector devices; - devices.push_back("local"); - devices.push_back("hdmi"); - devices.push_back("both"); - // USB audio - devices.push_back("alsa:hw:0,0"); - devices.push_back("alsa:hw:1,0"); - for (auto it = devices.cbegin(); it != devices.cend(); it++) + std::vector omx_cards; + // RPi Specific Audio Cards + omx_cards.push_back("local"); + omx_cards.push_back("hdmi"); + omx_cards.push_back("both"); + omx_cards.push_back("alsa:hw:0,0"); + omx_cards.push_back("alsa:hw:1,0"); + if (Settings::getInstance()->getString("OMXAudioDev") != "") { + if (std::find(omx_cards.begin(), omx_cards.end(), Settings::getInstance()->getString("OMXAudioDev")) == omx_cards.end()) { + omx_cards.push_back(Settings::getInstance()->getString("OMXAudioDev")); + } + } + for (auto it = omx_cards.cbegin(); it != omx_cards.cend(); it++) omx_audio_dev->add(*it, *it, Settings::getInstance()->getString("OMXAudioDev") == *it); s->addWithLabel("OMX PLAYER AUDIO DEVICE", omx_audio_dev); s->addSaveFunc([omx_audio_dev] {