QTfrontend/util/SDLInteraction.cpp
changeset 8117 329d9756b57c
parent 6952 7f70f37bbf08
child 8326 023a71940f26
equal deleted inserted replaced
8115:ac1007c6dea8 8117:329d9756b57c
    26 
    26 
    27 #include "HWApplication.h"
    27 #include "HWApplication.h"
    28 
    28 
    29 #include "SDLInteraction.h"
    29 #include "SDLInteraction.h"
    30 
    30 
       
    31 #include "physfsrwops.h"
       
    32 
    31 extern char sdlkeys[1024][2][128];
    33 extern char sdlkeys[1024][2][128];
    32 extern char xb360buttons[][128];
    34 extern char xb360buttons[][128];
    33 extern char xb360dpad[128];
    35 extern char xb360dpad[128];
    34 extern char xbox360axes[][128];
    36 extern char xbox360axes[][128];
    35 
    37 
   191 
   193 
   192 void SDLInteraction::playSoundFile(const QString & soundFile)
   194 void SDLInteraction::playSoundFile(const QString & soundFile)
   193 {
   195 {
   194     SDLAudioInit();
   196     SDLAudioInit();
   195     if (!m_soundMap->contains(soundFile))
   197     if (!m_soundMap->contains(soundFile))
   196         m_soundMap->insert(soundFile, Mix_LoadWAV(soundFile.toLocal8Bit().constData()));
   198         m_soundMap->insert(soundFile, Mix_LoadWAV_RW(PHYSFSRWOPS_openRead(soundFile.toLocal8Bit().constData()), 1));
   197 
   199 
   198     //FIXME: this is a hack, but works as long as we have few concurrent playing sounds
   200     //FIXME: this is a hack, but works as long as we have few concurrent playing sounds
   199     if (Mix_Playing(lastchannel) == false)
   201     if (Mix_Playing(lastchannel) == false)
   200         lastchannel = Mix_PlayChannel(-1, m_soundMap->value(soundFile), 0);
   202         lastchannel = Mix_PlayChannel(-1, m_soundMap->value(soundFile), 0);
   201 }
   203 }
   230         return;
   232         return;
   231 
   233 
   232     SDLAudioInit();
   234     SDLAudioInit();
   233 
   235 
   234     if (m_music == NULL)
   236     if (m_music == NULL)
   235         m_music = Mix_LoadMUS(m_musicTrack.toLocal8Bit().constData());
   237         m_music = Mix_LoadMUS_RW(PHYSFSRWOPS_openRead(m_musicTrack.toLocal8Bit().constData()));
   236 
   238 
   237     Mix_VolumeMusic(MIX_MAX_VOLUME - 28);
   239     Mix_VolumeMusic(MIX_MAX_VOLUME - 28);
   238     Mix_FadeInMusic(m_music, -1, 1750);
   240     Mix_FadeInMusic(m_music, -1, 1750);
   239 }
   241 }
   240 
   242