Added Qt Multimedia support in order to replace Phonon. Currently does not work on Mac.
This commit is contained in:
+125
-113
@@ -23,28 +23,32 @@
|
|||||||
#include "SLES/OpenSLES_Android.h"
|
#include "SLES/OpenSLES_Android.h"
|
||||||
|
|
||||||
#elif defined USE_PHONON
|
#elif defined USE_PHONON
|
||||||
#include <phonon/AudioOutput>
|
#include <phonon/AudioOutput>
|
||||||
#include <phonon/MediaObject>
|
#include <phonon/MediaObject>
|
||||||
#elif defined WIN32
|
#elif defined WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define WITH_FMOD
|
#define WITH_FMOD
|
||||||
#elif defined (PSP)
|
#elif defined (PSP)
|
||||||
#include <pspgu.h>
|
#include <pspgu.h>
|
||||||
#include <pspkernel.h>
|
#include <pspkernel.h>
|
||||||
#include <pspdisplay.h>
|
#include <pspdisplay.h>
|
||||||
#include <pspdebug.h>
|
#include <pspdebug.h>
|
||||||
#include <pspctrl.h>
|
#include <pspctrl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pspaudiolib.h>
|
#include <pspaudiolib.h>
|
||||||
#include <psprtc.h>
|
#include <psprtc.h>
|
||||||
|
|
||||||
#include "JAudio.h"
|
#include "JAudio.h"
|
||||||
#include "JMP3.h"
|
#include "JMP3.h"
|
||||||
|
#elif defined QT_CONFIG
|
||||||
|
#include "QMediaPlayer"
|
||||||
|
#include "QMediaPlaylist"
|
||||||
|
#include "QSoundEffect"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_FMOD
|
#ifdef WITH_FMOD
|
||||||
#include "../Dependencies/include/fmod.h"
|
#include "../Dependencies/include/fmod.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
@@ -67,7 +71,7 @@ public:
|
|||||||
#ifdef USE_PHONON
|
#ifdef USE_PHONON
|
||||||
Phonon::AudioOutput* mOutput;
|
Phonon::AudioOutput* mOutput;
|
||||||
Phonon::MediaObject* mMediaObject;
|
Phonon::MediaObject* mMediaObject;
|
||||||
public slots:
|
public slots:
|
||||||
void seekAtTheBegining();
|
void seekAtTheBegining();
|
||||||
#elif defined (PSP)
|
#elif defined (PSP)
|
||||||
JMP3* mTrack;
|
JMP3* mTrack;
|
||||||
@@ -82,6 +86,10 @@ public:
|
|||||||
SLPlayItf playInterface;
|
SLPlayItf playInterface;
|
||||||
SLSeekItf seekInterface;
|
SLSeekItf seekInterface;
|
||||||
SLVolumeItf musicVolumeInterface;
|
SLVolumeItf musicVolumeInterface;
|
||||||
|
#elif defined QT_CONFIG
|
||||||
|
QMediaPlaylist* playlist;
|
||||||
|
QMediaPlayer* player;
|
||||||
|
string fullpath;
|
||||||
#else
|
#else
|
||||||
void* mTrack;
|
void* mTrack;
|
||||||
#endif //WITH_FMOD
|
#endif //WITH_FMOD
|
||||||
@@ -92,13 +100,15 @@ public:
|
|||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
class JSample
|
class JSample
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
JSample();
|
JSample();
|
||||||
~JSample();
|
~JSample();
|
||||||
|
|
||||||
unsigned long fileSize();
|
unsigned long fileSize();
|
||||||
|
#ifdef QT_CONFIG
|
||||||
#if defined (PSP)
|
QSoundEffect effect;
|
||||||
|
void* mSample;
|
||||||
|
#elif defined (PSP)
|
||||||
WAVDATA *mSample;
|
WAVDATA *mSample;
|
||||||
#elif defined (IOS)
|
#elif defined (IOS)
|
||||||
std::string filename;
|
std::string filename;
|
||||||
@@ -133,126 +143,128 @@ class JSoundSystem
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Get the singleton instance
|
/// Get the singleton instance
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
static JSoundSystem* GetInstance();
|
static JSoundSystem* GetInstance();
|
||||||
|
|
||||||
static void Destroy();
|
static void Destroy();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Load music.
|
/// Load music.
|
||||||
///
|
///
|
||||||
/// @note MP3 is the only supported format for the moment.
|
/// @note MP3 is the only supported format for the moment.
|
||||||
///
|
///
|
||||||
/// @param filename - Name of the music file.
|
/// @param filename - Name of the music file.
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
JMusic *LoadMusic(const char *fileName);
|
JMusic *LoadMusic(const char *fileName);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Delete music from memory.
|
/// Delete music from memory.
|
||||||
///
|
///
|
||||||
/// @param music - Music to be deleted.
|
/// @param music - Music to be deleted.
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
//void FreeMusic(JMusic *music);
|
//void FreeMusic(JMusic *music);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Play music.
|
/// Play music.
|
||||||
///
|
///
|
||||||
/// @param music - Music to be played.
|
/// @param music - Music to be played.
|
||||||
/// @param looping - Play the music in a loop.
|
/// @param looping - Play the music in a loop.
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void PlayMusic(JMusic *music, bool looping = false);
|
void PlayMusic(JMusic *music, bool looping = false);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Stop playing.
|
/// Stop playing.
|
||||||
///
|
///
|
||||||
/// @param music - Music to be stopped.
|
/// @param music - Music to be stopped.
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void StopMusic(JMusic *music);
|
void StopMusic(JMusic *music);
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Resume playing.
|
/// Resume playing.
|
||||||
///
|
///
|
||||||
/// @param music - Music to be resumed.
|
/// @param music - Music to be resumed.
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void ResumeMusic(JMusic *music);
|
void ResumeMusic(JMusic *music);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Pause playing.
|
/// Pause playing.
|
||||||
///
|
///
|
||||||
/// @param music - Music to be paused.
|
/// @param music - Music to be paused.
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void PauseMusic(JMusic *music);
|
void PauseMusic(JMusic *music);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Load sound effect.
|
/// Load sound effect.
|
||||||
///
|
///
|
||||||
/// @note WAV sound effect only.
|
/// @note WAV sound effect only.
|
||||||
///
|
///
|
||||||
/// @param fileName - Sound effect for loading.
|
/// @param fileName - Sound effect for loading.
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
JSample *LoadSample(const char *fileName);
|
JSample *LoadSample(const char *fileName);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Delete sound effect from memory.
|
/// Delete sound effect from memory.
|
||||||
///
|
///
|
||||||
/// @param sample - Sound to be deleted.
|
/// @param sample - Sound to be deleted.
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
//void FreeSample(JSample *sample);
|
//void FreeSample(JSample *sample);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Play sound effect.
|
/// Play sound effect.
|
||||||
///
|
///
|
||||||
/// @param sample - Sound for playing.
|
/// @param sample - Sound for playing.
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void PlaySample(JSample *sample);
|
void PlaySample(JSample *sample);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// Set volume for audio playback.
|
/// Set volume for audio playback.
|
||||||
///
|
///
|
||||||
/// @param volume - New volume.
|
/// @param volume - New volume.
|
||||||
///
|
///
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void SetVolume(int volume);
|
void SetVolume(int volume);
|
||||||
|
|
||||||
void SetMusicVolume(int volume);
|
void SetMusicVolume(int volume);
|
||||||
|
|
||||||
void SetSfxVolume(int volume);
|
void SetSfxVolume(int volume);
|
||||||
|
|
||||||
int mChannel;
|
int mChannel;
|
||||||
protected:
|
protected:
|
||||||
JSoundSystem();
|
JSoundSystem();
|
||||||
~JSoundSystem();
|
~JSoundSystem();
|
||||||
|
|
||||||
void InitSoundSystem();
|
void InitSoundSystem();
|
||||||
void DestroySoundSystem();
|
void DestroySoundSystem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef PSP
|
||||||
JMusic *mCurrentMusic;
|
JMusic *mCurrentMusic;
|
||||||
JSample *mCurrentSample;
|
JSample *mCurrentSample;
|
||||||
|
#endif
|
||||||
|
|
||||||
int mVolume;
|
int mVolume;
|
||||||
int mMusicVolume;
|
int mMusicVolume;
|
||||||
int mSampleVolume;
|
int mSampleVolume;
|
||||||
|
|
||||||
|
|
||||||
static JSoundSystem* mInstance;
|
static JSoundSystem* mInstance;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+125
-76
@@ -22,6 +22,8 @@
|
|||||||
JMusic::JMusic()
|
JMusic::JMusic()
|
||||||
#ifdef USE_PHONON
|
#ifdef USE_PHONON
|
||||||
: mOutput(0), mMediaObject(0)
|
: mOutput(0), mMediaObject(0)
|
||||||
|
#elif defined QT_CONFIG
|
||||||
|
: playlist(0), player(0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -40,7 +42,12 @@ int JMusic::getPlayTime(){
|
|||||||
|
|
||||||
JMusic::~JMusic()
|
JMusic::~JMusic()
|
||||||
{
|
{
|
||||||
#ifdef USE_PHONON
|
#ifdef QT_CONFIG
|
||||||
|
if(player)
|
||||||
|
delete player;
|
||||||
|
if(playlist)
|
||||||
|
delete playlist;
|
||||||
|
#elif defined USE_PHONON
|
||||||
if(mOutput)
|
if(mOutput)
|
||||||
delete mOutput;
|
delete mOutput;
|
||||||
if(mMediaObject)
|
if(mMediaObject)
|
||||||
@@ -144,65 +151,88 @@ void JSoundSystem::DestroySoundSystem()
|
|||||||
|
|
||||||
JMusic *JSoundSystem::LoadMusic(const char *fileName)
|
JMusic *JSoundSystem::LoadMusic(const char *fileName)
|
||||||
{
|
{
|
||||||
#ifdef USE_PHONON
|
JMusic* music = NULL;
|
||||||
JMusic* music = new JMusic();
|
#ifdef QT_CONFIG
|
||||||
if (music)
|
music = new JMusic();
|
||||||
{
|
if (music)
|
||||||
music->mOutput = new Phonon::AudioOutput(Phonon::GameCategory, 0);
|
|
||||||
music->mMediaObject = new Phonon::MediaObject(0);
|
|
||||||
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
|
|
||||||
music->mMediaObject->setCurrentSource(QString(fullpath.c_str()));
|
|
||||||
Phonon::Path mediapath = Phonon::createPath(music->mMediaObject, music->mOutput);
|
|
||||||
Q_ASSERT(mediapath.isValid());
|
|
||||||
}
|
|
||||||
return music;
|
|
||||||
#elif (defined WITH_FMOD)
|
|
||||||
JMusic* music = new JMusic();
|
|
||||||
if (music)
|
|
||||||
{
|
{
|
||||||
JFileSystem* fileSystem = JFileSystem::GetInstance();
|
music->player = new QMediaPlayer;
|
||||||
if (fileSystem->OpenFile(fileName))
|
music->player->setVolume(100);
|
||||||
{
|
music->playlist = new QMediaPlaylist;
|
||||||
int size = fileSystem->GetFileSize();
|
music->fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
|
||||||
char *buffer = new char[size];
|
music->playlist->addMedia(QUrl(music->fullpath.c_str()));
|
||||||
fileSystem->ReadFile(buffer, size);
|
music->playlist->setCurrentIndex(0);
|
||||||
music->mTrack = FSOUND_Sample_Load(FSOUND_UNMANAGED, buffer, FSOUND_LOADMEMORY, 0, size);
|
}
|
||||||
|
#elif defined USE_PHONON
|
||||||
delete[] buffer;
|
music = new JMusic();
|
||||||
fileSystem->CloseFile();
|
if (music)
|
||||||
}
|
{
|
||||||
|
music->mOutput = new Phonon::AudioOutput(Phonon::GameCategory, 0);
|
||||||
|
music->mMediaObject = new Phonon::MediaObject(0);
|
||||||
|
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
|
||||||
|
music->mMediaObject->setCurrentSource(QString(fullpath.c_str()));
|
||||||
|
Phonon::Path mediapath = Phonon::createPath(music->mMediaObject, music->mOutput);
|
||||||
|
Q_ASSERT(mediapath.isValid());
|
||||||
|
}
|
||||||
|
#elif (defined WITH_FMOD)
|
||||||
|
music = new JMusic();
|
||||||
|
if (music)
|
||||||
|
{
|
||||||
|
JFileSystem* fileSystem = JFileSystem::GetInstance();
|
||||||
|
if (fileSystem->OpenFile(fileName))
|
||||||
|
{
|
||||||
|
int size = fileSystem->GetFileSize();
|
||||||
|
char *buffer = new char[size];
|
||||||
|
fileSystem->ReadFile(buffer, size);
|
||||||
|
music->mTrack = FSOUND_Sample_Load(FSOUND_UNMANAGED, buffer, FSOUND_LOADMEMORY, 0, size);
|
||||||
|
|
||||||
|
delete[] buffer;
|
||||||
|
fileSystem->CloseFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return music;
|
|
||||||
#else
|
#else
|
||||||
cerr << fileName << endl;
|
cerr << fileName << endl;
|
||||||
return NULL;
|
|
||||||
#endif
|
#endif
|
||||||
|
return music;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JSoundSystem::PlayMusic(JMusic *music, bool looping)
|
void JSoundSystem::PlayMusic(JMusic *music, bool looping)
|
||||||
{
|
{
|
||||||
#ifdef USE_PHONON
|
#ifdef QT_CONFIG
|
||||||
if (music && music->mMediaObject && music->mOutput)
|
if(music && music->player && music->playlist)
|
||||||
{
|
|
||||||
if(looping)
|
|
||||||
{
|
{
|
||||||
music->mMediaObject->connect(music->mMediaObject, SIGNAL(aboutToFinish()), music, SLOT(seekAtTheBegining()));
|
if(looping)
|
||||||
|
music->playlist->setPlaybackMode(QMediaPlaylist::Loop);
|
||||||
|
|
||||||
|
// music->player->setPlaylist(music->playlist);
|
||||||
|
music->player->setMedia(QUrl(music->fullpath.c_str()));
|
||||||
|
music->player->play();
|
||||||
|
stringstream stream;
|
||||||
|
stream << "Player state : " << music->player->state();
|
||||||
|
DebugTrace(stream.str());
|
||||||
}
|
}
|
||||||
music->mOutput->setVolume((qreal)mVolume*0.01);
|
#elif USE_PHONON
|
||||||
music->mMediaObject->play();
|
if (music && music->mMediaObject && music->mOutput)
|
||||||
|
|
||||||
}
|
|
||||||
#elif (defined WITH_FMOD)
|
|
||||||
if (music && music->mTrack)
|
|
||||||
{
|
{
|
||||||
mChannel = FSOUND_PlaySound(mChannel, music->mTrack);
|
if(looping)
|
||||||
SetMusicVolume(mVolume);
|
{
|
||||||
|
music->mMediaObject->connect(music->mMediaObject, SIGNAL(aboutToFinish()), music, SLOT(seekAtTheBegining()));
|
||||||
|
}
|
||||||
|
music->mOutput->setVolume((qreal)mVolume*0.01);
|
||||||
|
music->mMediaObject->play();
|
||||||
|
|
||||||
if (looping)
|
}
|
||||||
FSOUND_SetLoopMode(mChannel, FSOUND_LOOP_NORMAL);
|
#elif (defined WITH_FMOD)
|
||||||
else
|
if (music && music->mTrack)
|
||||||
FSOUND_SetLoopMode(mChannel, FSOUND_LOOP_OFF);
|
{
|
||||||
|
mChannel = FSOUND_PlaySound(mChannel, music->mTrack);
|
||||||
|
SetMusicVolume(mVolume);
|
||||||
|
|
||||||
|
if (looping)
|
||||||
|
FSOUND_SetLoopMode(mChannel, FSOUND_LOOP_NORMAL);
|
||||||
|
else
|
||||||
|
FSOUND_SetLoopMode(mChannel, FSOUND_LOOP_OFF);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
music = 0;
|
music = 0;
|
||||||
@@ -213,7 +243,12 @@ void JSoundSystem::PlayMusic(JMusic *music, bool looping)
|
|||||||
|
|
||||||
void JSoundSystem::StopMusic(JMusic *music)
|
void JSoundSystem::StopMusic(JMusic *music)
|
||||||
{
|
{
|
||||||
#ifdef USE_PHONON
|
#ifdef QT_CONFIG
|
||||||
|
if (music && music->player && music->playlist)
|
||||||
|
{
|
||||||
|
music->player->stop();
|
||||||
|
}
|
||||||
|
#elif defined USE_PHONON
|
||||||
if (music && music->mMediaObject && music->mOutput)
|
if (music && music->mMediaObject && music->mOutput)
|
||||||
{
|
{
|
||||||
music->mMediaObject->stop();
|
music->mMediaObject->stop();
|
||||||
@@ -264,47 +299,61 @@ void JSoundSystem::SetSfxVolume(int volume){
|
|||||||
|
|
||||||
JSample *JSoundSystem::LoadSample(const char *fileName)
|
JSample *JSoundSystem::LoadSample(const char *fileName)
|
||||||
{
|
{
|
||||||
#if (defined USE_PHONON)
|
JSample* sample = NULL;
|
||||||
JSample* sample = new JSample();
|
#ifdef QT_CONFIG
|
||||||
if (sample)
|
sample = new JSample();
|
||||||
{
|
if (sample)
|
||||||
sample->mOutput = new Phonon::AudioOutput(Phonon::GameCategory, 0);
|
|
||||||
sample->mMediaObject = new Phonon::MediaObject(0);
|
|
||||||
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
|
|
||||||
sample->mMediaObject->setCurrentSource(QString(fullpath.c_str()));
|
|
||||||
Phonon::Path mediapath = Phonon::createPath(sample->mMediaObject, sample->mOutput);
|
|
||||||
Q_ASSERT(mediapath.isValid());
|
|
||||||
}
|
|
||||||
return sample;
|
|
||||||
#elif (defined WITH_FMOD)
|
|
||||||
JSample* sample = new JSample();
|
|
||||||
if (sample)
|
|
||||||
{
|
{
|
||||||
JFileSystem* fileSystem = JFileSystem::GetInstance();
|
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
|
||||||
if (fileSystem->OpenFile(fileName))
|
sample->effect.setSource(QUrl::fromLocalFile(fullpath.c_str()));
|
||||||
{
|
sample->effect.setLoopCount(0);
|
||||||
int size = fileSystem->GetFileSize();
|
sample->effect.setVolume(1);
|
||||||
char *buffer = new char[size];
|
sample->mSample = &(sample->effect);
|
||||||
fileSystem->ReadFile(buffer, size);
|
}
|
||||||
sample->mSample = FSOUND_Sample_Load(FSOUND_UNMANAGED, buffer, FSOUND_LOADMEMORY, 0, size);
|
#elif (defined USE_PHONON)
|
||||||
|
sample = new JSample();
|
||||||
|
if (sample)
|
||||||
|
{
|
||||||
|
sample->mOutput = new Phonon::AudioOutput(Phonon::GameCategory, 0);
|
||||||
|
sample->mMediaObject = new Phonon::MediaObject(0);
|
||||||
|
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
|
||||||
|
sample->mMediaObject->setCurrentSource(QString(fullpath.c_str()));
|
||||||
|
Phonon::Path mediapath = Phonon::createPath(sample->mMediaObject, sample->mOutput);
|
||||||
|
Q_ASSERT(mediapath.isValid());
|
||||||
|
}
|
||||||
|
#elif (defined WITH_FMOD)
|
||||||
|
sample = new JSample();
|
||||||
|
if (sample)
|
||||||
|
{
|
||||||
|
JFileSystem* fileSystem = JFileSystem::GetInstance();
|
||||||
|
if (fileSystem->OpenFile(fileName))
|
||||||
|
{
|
||||||
|
int size = fileSystem->GetFileSize();
|
||||||
|
char *buffer = new char[size];
|
||||||
|
fileSystem->ReadFile(buffer, size);
|
||||||
|
sample->mSample = FSOUND_Sample_Load(FSOUND_UNMANAGED, buffer, FSOUND_LOADMEMORY, 0, size);
|
||||||
|
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
fileSystem->CloseFile();
|
fileSystem->CloseFile();
|
||||||
}else
|
}else
|
||||||
sample->mSample = NULL;
|
sample->mSample = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
return sample;
|
|
||||||
#else
|
#else
|
||||||
cerr << fileName << endl;
|
cerr << fileName << endl;
|
||||||
return NULL;
|
|
||||||
#endif
|
#endif
|
||||||
|
return sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JSoundSystem::PlaySample(JSample *sample)
|
void JSoundSystem::PlaySample(JSample *sample)
|
||||||
{
|
{
|
||||||
#ifdef USE_PHONON
|
#ifdef QT_CONFIG
|
||||||
|
if(sample)
|
||||||
|
{
|
||||||
|
sample->effect.play();
|
||||||
|
}
|
||||||
|
#elif defined USE_PHONON
|
||||||
if (sample && sample->mMediaObject && sample->mOutput)
|
if (sample && sample->mMediaObject && sample->mOutput)
|
||||||
{
|
{
|
||||||
sample->mOutput->setVolume((qreal)mSampleVolume*0.01);
|
sample->mOutput->setVolume((qreal)mSampleVolume*0.01);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ else:CONFIG(graphics, graphics|console){
|
|||||||
folder_01.source = qml/QmlWagic
|
folder_01.source = qml/QmlWagic
|
||||||
folder_01.target = /usr/share
|
folder_01.target = /usr/share
|
||||||
DEPLOYMENTFOLDERS = folder_01
|
DEPLOYMENTFOLDERS = folder_01
|
||||||
QT += core gui opengl network
|
QT += core gui opengl network multimedia
|
||||||
QT -= declarative quick qml
|
QT -= declarative quick qml
|
||||||
#maemo5:DEFINES += QT_WIDGET
|
#maemo5:DEFINES += QT_WIDGET
|
||||||
DEFINES += QT_WIDGET
|
DEFINES += QT_WIDGET
|
||||||
@@ -46,6 +46,7 @@ CONFIG(graphics, graphics|console){
|
|||||||
../../JGE/src/qt/corewrapper.cpp\
|
../../JGE/src/qt/corewrapper.cpp\
|
||||||
../../JGE/src/Qtmain.cpp\
|
../../JGE/src/Qtmain.cpp\
|
||||||
../../JGE/src/JMD2Model.cpp\
|
../../JGE/src/JMD2Model.cpp\
|
||||||
|
../../JGE/src/pc/JSfx.cpp\
|
||||||
../../JGE/src/pc/JGfx.cpp
|
../../JGE/src/pc/JGfx.cpp
|
||||||
}
|
}
|
||||||
else:CONFIG(console, graphics|console){
|
else:CONFIG(console, graphics|console){
|
||||||
|
|||||||
@@ -303,7 +303,6 @@ SOURCES += \
|
|||||||
../../JGE/src/JSpline.cpp\
|
../../JGE/src/JSpline.cpp\
|
||||||
../../JGE/src/JNetwork.cpp\
|
../../JGE/src/JNetwork.cpp\
|
||||||
../../JGE/src/pc/JSocket.cpp\
|
../../JGE/src/pc/JSocket.cpp\
|
||||||
../../JGE/src/pc/JSfx.cpp\
|
|
||||||
../../JGE/src/JSprite.cpp\
|
../../JGE/src/JSprite.cpp\
|
||||||
../../JGE/src/Vector2D.cpp\
|
../../JGE/src/Vector2D.cpp\
|
||||||
../../JGE/src/tinyxml/tinystr.cpp\
|
../../JGE/src/tinyxml/tinystr.cpp\
|
||||||
|
|||||||
Reference in New Issue
Block a user