Android fix.

This commit is contained in:
lotodore
2012-04-22 11:03:36 +00:00
parent 74f4d0cd42
commit f5d4e8e72f
2 changed files with 10 additions and 10 deletions
+8 -8
View File
@@ -17,7 +17,7 @@
*****************************************************************************/
#include "sdlplayer.h"
#ifndef __ANDROID_API__
#ifndef ANDROID
#if (defined __APPLE__)
#include <SDL.h>
#else
@@ -28,11 +28,11 @@
using namespace std;
SDLPlayer::SDLPlayer(ConfigFile *c)
#ifndef __ANDROID_API__
#ifndef ANDROID
: soundData(NULL), currentChannel(0) , audioEnabled(0), myConfig(c)
#endif
{
#ifndef __ANDROID_API__
#ifndef ANDROID
SDL_Init(SDL_INIT_AUDIO);
initAudio();
@@ -43,7 +43,7 @@ SDLPlayer::SDLPlayer(ConfigFile *c)
SDLPlayer::~SDLPlayer()
{
#ifndef __ANDROID_API__
#ifndef ANDROID
closeAudio();
SDL_Quit();
#endif
@@ -51,7 +51,7 @@ SDLPlayer::~SDLPlayer()
void SDLPlayer::initAudio()
{
#ifndef __ANDROID_API__
#ifndef ANDROID
if (!audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
int audio_rate = 44100;
Uint16 audio_format = AUDIO_S16; /* 16-bit stereo */
@@ -69,7 +69,7 @@ void SDLPlayer::initAudio()
void SDLPlayer::playSound(string audioString, int playerID)
{
#ifndef __ANDROID_API__
#ifndef ANDROID
if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
QFile myFile(myAppDataPath + "sounds/default/" + QString::fromStdString(audioString)+".wav");
@@ -156,7 +156,7 @@ void SDLPlayer::playSound(string audioString, int playerID)
void SDLPlayer::audioDone()
{
#ifndef __ANDROID_API__
#ifndef ANDROID
if(audioEnabled) {
Mix_HaltChannel(currentChannel);
Mix_FreeChunk(sound);
@@ -169,7 +169,7 @@ void SDLPlayer::audioDone()
void SDLPlayer::closeAudio()
{
#ifndef __ANDROID_API__
#ifndef ANDROID
if(audioEnabled) {
audioDone();
Mix_CloseAudio();
+2 -2
View File
@@ -23,7 +23,7 @@
#include "configfile.h"
#include <string>
#ifndef __ANDROID_API__
#ifndef ANDROID
#ifdef __APPLE__
#include <SDL_mixer.h>
#else
@@ -52,7 +52,7 @@ public:
private:
#ifndef __ANDROID_API__
#ifndef ANDROID
Mix_Chunk *sound;
unsigned char *soundData;
int currentChannel;