Trying to fix android build.
This commit is contained in:
+1
-7
@@ -383,7 +383,7 @@ unix:!mac {
|
|||||||
$${PREFIX}/lib64
|
$${PREFIX}/lib64
|
||||||
}
|
}
|
||||||
android{
|
android{
|
||||||
LIB_DIRS = ../cmoss/bin/droid/lib/armv5
|
LIB_DIRS = $${PREFIX}/lib/armv5
|
||||||
}
|
}
|
||||||
BOOST_FS = boost_filesystem \
|
BOOST_FS = boost_filesystem \
|
||||||
boost_filesystem-mt
|
boost_filesystem-mt
|
||||||
@@ -598,12 +598,6 @@ gui_800x480 {
|
|||||||
android{
|
android{
|
||||||
# Use old boost::filesystem, because the new version requires std::wstring.
|
# Use old boost::filesystem, because the new version requires std::wstring.
|
||||||
DEFINES += BOOST_FILESYSTEM_VERSION=2
|
DEFINES += BOOST_FILESYSTEM_VERSION=2
|
||||||
# If /usr/include is included, this will mess with the android sdk.
|
|
||||||
INCLUDEPATH -= /usr/include
|
|
||||||
LIBPATH -= /usr/lib
|
|
||||||
# Include directory containing android builds of used libs.
|
|
||||||
INCLUDEPATH += ../cmoss/bin/droid/include
|
|
||||||
LIBPATH += ../cmoss/bin/droid/lib/armv5
|
|
||||||
# sqlite3 is included directly.
|
# sqlite3 is included directly.
|
||||||
INCLUDEPATH += src/third_party/sqlite3
|
INCLUDEPATH += src/third_party/sqlite3
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,10 +245,6 @@ mac{
|
|||||||
android{
|
android{
|
||||||
# Use old boost::filesystem, because the new version requires std::wstring.
|
# Use old boost::filesystem, because the new version requires std::wstring.
|
||||||
DEFINES += BOOST_FILESYSTEM_VERSION=2
|
DEFINES += BOOST_FILESYSTEM_VERSION=2
|
||||||
# If /usr/include is included, this will mess with the android sdk.
|
|
||||||
INCLUDEPATH -= /usr/include
|
|
||||||
# Include directory containing android builds of used libs.
|
|
||||||
INCLUDEPATH += ../cmoss/bin/droid/include
|
|
||||||
# sqlite3 is included directly.
|
# sqlite3 is included directly.
|
||||||
INCLUDEPATH += src/third_party/sqlite3
|
INCLUDEPATH += src/third_party/sqlite3
|
||||||
SOURCES += src/third_party/sqlite3/sqlite3.c
|
SOURCES += src/third_party/sqlite3/sqlite3.c
|
||||||
|
|||||||
@@ -17,33 +17,41 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#include "sdlplayer.h"
|
#include "sdlplayer.h"
|
||||||
|
|
||||||
|
#ifndef __ANDROID_API__
|
||||||
#if (defined __APPLE__)
|
#if (defined __APPLE__)
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#else
|
#else
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
SDLPlayer::SDLPlayer(ConfigFile *c)
|
SDLPlayer::SDLPlayer(ConfigFile *c)
|
||||||
|
#ifndef __ANDROID_API__
|
||||||
: soundData(NULL), currentChannel(0) , audioEnabled(0), myConfig(c)
|
: soundData(NULL), currentChannel(0) , audioEnabled(0), myConfig(c)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifndef __ANDROID_API__
|
||||||
SDL_Init(SDL_INIT_AUDIO);
|
SDL_Init(SDL_INIT_AUDIO);
|
||||||
initAudio();
|
initAudio();
|
||||||
|
|
||||||
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
|
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SDLPlayer::~SDLPlayer()
|
SDLPlayer::~SDLPlayer()
|
||||||
{
|
{
|
||||||
|
#ifndef __ANDROID_API__
|
||||||
closeAudio();
|
closeAudio();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLPlayer::initAudio()
|
void SDLPlayer::initAudio()
|
||||||
{
|
{
|
||||||
|
#ifndef __ANDROID_API__
|
||||||
if (!audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
|
if (!audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
|
||||||
int audio_rate = 44100;
|
int audio_rate = 44100;
|
||||||
Uint16 audio_format = AUDIO_S16; /* 16-bit stereo */
|
Uint16 audio_format = AUDIO_S16; /* 16-bit stereo */
|
||||||
@@ -56,11 +64,12 @@ void SDLPlayer::initAudio()
|
|||||||
audioEnabled = 1;
|
audioEnabled = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLPlayer::playSound(string audioString, int playerID)
|
void SDLPlayer::playSound(string audioString, int playerID)
|
||||||
{
|
{
|
||||||
|
#ifndef __ANDROID_API__
|
||||||
if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
|
if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
|
||||||
|
|
||||||
QFile myFile(myAppDataPath + "sounds/default/" + QString::fromStdString(audioString)+".wav");
|
QFile myFile(myAppDataPath + "sounds/default/" + QString::fromStdString(audioString)+".wav");
|
||||||
@@ -142,11 +151,12 @@ void SDLPlayer::playSound(string audioString, int playerID)
|
|||||||
// currentChannel = Mix_PlayChannel(-1, sound,0);
|
// currentChannel = Mix_PlayChannel(-1, sound,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLPlayer::audioDone()
|
void SDLPlayer::audioDone()
|
||||||
{
|
{
|
||||||
|
#ifndef __ANDROID_API__
|
||||||
if(audioEnabled) {
|
if(audioEnabled) {
|
||||||
Mix_HaltChannel(currentChannel);
|
Mix_HaltChannel(currentChannel);
|
||||||
Mix_FreeChunk(sound);
|
Mix_FreeChunk(sound);
|
||||||
@@ -154,14 +164,16 @@ void SDLPlayer::audioDone()
|
|||||||
delete[] soundData;
|
delete[] soundData;
|
||||||
soundData = NULL;
|
soundData = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLPlayer::closeAudio()
|
void SDLPlayer::closeAudio()
|
||||||
{
|
{
|
||||||
|
#ifndef __ANDROID_API__
|
||||||
if(audioEnabled) {
|
if(audioEnabled) {
|
||||||
audioDone();
|
audioDone();
|
||||||
Mix_CloseAudio();
|
Mix_CloseAudio();
|
||||||
audioEnabled = false;
|
audioEnabled = false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,15 +21,15 @@
|
|||||||
#define SDLPLAYER_H
|
#define SDLPLAYER_H
|
||||||
|
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#if (defined __APPLE__)
|
#ifndef __ANDROID_API__
|
||||||
|
#ifdef __APPLE__
|
||||||
#include <SDL_mixer.h>
|
#include <SDL_mixer.h>
|
||||||
#else
|
#else
|
||||||
#include <SDL/SDL_mixer.h>
|
#include <SDL/SDL_mixer.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
// struct Mix_Chunk;
|
// struct Mix_Chunk;
|
||||||
|
|
||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
#ifndef __ANDROID_API__
|
||||||
Mix_Chunk *sound;
|
Mix_Chunk *sound;
|
||||||
unsigned char *soundData;
|
unsigned char *soundData;
|
||||||
int currentChannel;
|
int currentChannel;
|
||||||
@@ -60,7 +61,7 @@ private:
|
|||||||
|
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
QString myAppDataPath;
|
QString myAppDataPath;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user