Android fix.
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#include "sdlplayer.h"
|
#include "sdlplayer.h"
|
||||||
|
|
||||||
#ifndef __ANDROID_API__
|
#ifndef ANDROID
|
||||||
#if (defined __APPLE__)
|
#if (defined __APPLE__)
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#else
|
#else
|
||||||
@@ -28,11 +28,11 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
SDLPlayer::SDLPlayer(ConfigFile *c)
|
SDLPlayer::SDLPlayer(ConfigFile *c)
|
||||||
#ifndef __ANDROID_API__
|
#ifndef ANDROID
|
||||||
: soundData(NULL), currentChannel(0) , audioEnabled(0), myConfig(c)
|
: soundData(NULL), currentChannel(0) , audioEnabled(0), myConfig(c)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef __ANDROID_API__
|
#ifndef ANDROID
|
||||||
SDL_Init(SDL_INIT_AUDIO);
|
SDL_Init(SDL_INIT_AUDIO);
|
||||||
initAudio();
|
initAudio();
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ SDLPlayer::SDLPlayer(ConfigFile *c)
|
|||||||
|
|
||||||
SDLPlayer::~SDLPlayer()
|
SDLPlayer::~SDLPlayer()
|
||||||
{
|
{
|
||||||
#ifndef __ANDROID_API__
|
#ifndef ANDROID
|
||||||
closeAudio();
|
closeAudio();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
#endif
|
#endif
|
||||||
@@ -51,7 +51,7 @@ SDLPlayer::~SDLPlayer()
|
|||||||
|
|
||||||
void SDLPlayer::initAudio()
|
void SDLPlayer::initAudio()
|
||||||
{
|
{
|
||||||
#ifndef __ANDROID_API__
|
#ifndef ANDROID
|
||||||
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 */
|
||||||
@@ -69,7 +69,7 @@ void SDLPlayer::initAudio()
|
|||||||
|
|
||||||
void SDLPlayer::playSound(string audioString, int playerID)
|
void SDLPlayer::playSound(string audioString, int playerID)
|
||||||
{
|
{
|
||||||
#ifndef __ANDROID_API__
|
#ifndef ANDROID
|
||||||
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");
|
||||||
@@ -156,7 +156,7 @@ void SDLPlayer::playSound(string audioString, int playerID)
|
|||||||
|
|
||||||
void SDLPlayer::audioDone()
|
void SDLPlayer::audioDone()
|
||||||
{
|
{
|
||||||
#ifndef __ANDROID_API__
|
#ifndef ANDROID
|
||||||
if(audioEnabled) {
|
if(audioEnabled) {
|
||||||
Mix_HaltChannel(currentChannel);
|
Mix_HaltChannel(currentChannel);
|
||||||
Mix_FreeChunk(sound);
|
Mix_FreeChunk(sound);
|
||||||
@@ -169,7 +169,7 @@ void SDLPlayer::audioDone()
|
|||||||
|
|
||||||
void SDLPlayer::closeAudio()
|
void SDLPlayer::closeAudio()
|
||||||
{
|
{
|
||||||
#ifndef __ANDROID_API__
|
#ifndef ANDROID
|
||||||
if(audioEnabled) {
|
if(audioEnabled) {
|
||||||
audioDone();
|
audioDone();
|
||||||
Mix_CloseAudio();
|
Mix_CloseAudio();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifndef __ANDROID_API__
|
#ifndef ANDROID
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <SDL_mixer.h>
|
#include <SDL_mixer.h>
|
||||||
#else
|
#else
|
||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#ifndef __ANDROID_API__
|
#ifndef ANDROID
|
||||||
Mix_Chunk *sound;
|
Mix_Chunk *sound;
|
||||||
unsigned char *soundData;
|
unsigned char *soundData;
|
||||||
int currentChannel;
|
int currentChannel;
|
||||||
|
|||||||
Reference in New Issue
Block a user