Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - MaximumTrainer

Pages: [1] 2
1
Audio / Re: 2.3 - linked frameworks?
« on: May 14, 2015, 10:54:25 pm »
Now using 2.3 in Windows and OSX and working perfectly.

I was thinking, would it be possible to have some arrangement with Qt and become affiliated? I'm sure they could drop their QAudio module and use SFML, it would be a great thing for Qt and for SFML

Thanks!

2
Audio / Re: 2.3 - linked frameworks?
« on: May 12, 2015, 11:10:43 pm »
Finally learned what RPATH is, you can set it in Qt .pro file this way:

    #set RPATH (place to look for .dylib & framework by default)
    QMAKE_RPATHDIR += @executable_path/../Frameworks
    QMAKE_RPATHDIR += @executable_path/lib

Still not sure if all the 2.3 frameworks used are compliant LGPL like it was in 2.1?
Good documentation, found my answer : http://www.sfml-dev.org/license.php
Merci!


3
Audio / 2.3 - linked frameworks?
« on: May 12, 2015, 01:38:30 am »
I am using SFML 2.1 and wanted to upgrade to 2.3.
I'm using SFML just for audio playback inside a Qt software. (maximumtrainer.com)

For 2.1, I just had to have sfml-audio and sfml-system + sndfile.framework in order to use it.
Now it seems there is more linked libs to sfml-audio (list at the bottom)

Wondering if it's worth it to upgrade to 2.3 on OSX, I upgraded on Windows but I'm having problem with OSX dependencies using @rpath. With 2.1 deployment was easy, but now I have a bunch of install_name_tool to do.  Is there an easy way to integrate 2.3 with Qt that i'm missing?

Thank you for the great framework, I wish it was integrated in Qt instead of the audio they use.


   @rpath/libsfml-audio.2.3.dylib (compatibility version 2.3.0, current version 2.3.0)
   @rpath/libsfml-system.2.3.dylib (compatibility version 2.3.0, current version 2.3.0)
   @rpath/../Frameworks/OpenAL.framework/Versions/A/OpenAL (compatibility version 1.0.0, current version 1.16.0)
   @rpath/../Frameworks/vorbisenc.framework/Versions/A/vorbisenc (compatibility version 3.0.0, current version 3.10.0)
   @rpath/../Frameworks/vorbisfile.framework/Versions/A/vorbisfile (compatibility version 7.0.0, current version 7.6.0)
   @rpath/../Frameworks/vorbis.framework/Versions/A/vorbis (compatibility version 5.0.0, current version 5.7.0)
   @rpath/../Frameworks/ogg.framework/Versions/A/ogg (compatibility version 9.0.0, current version 9.2.0)
   @rpath/../Frameworks/FLAC.framework/Versions/A/FLAC (compatibility version 12.0.0, current version 12.0.0)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
   /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 19.0.0)

4
Audio / Re: Using sfml-audio OSX and Qt
« on: November 04, 2014, 05:13:15 pm »
Nevermind I think I found it, I did uncompress the tar.gz with 7zip instead of the OSX unzipper, will post result.

Yes that was it, just had to unzip it on the host system and it's working now.
Thanks SFML!

5
Audio / [SOLVED] Using sfml-audio OSX and Qt
« on: November 04, 2014, 04:46:12 pm »
Hi there,

I'm using Qt 5.3.1 and i'm trying to use use sfml-audio on OSX (10.9). I can compile the code fine but at execution, i'm having problem using the .dylib and get a strange message (see bottom of post)

I was able to successfully build ans use sfml-audio with the windows version (qt 5.3.1 and msvc2012).
I'm kind of new on OSX, I used the nice tutorial made to install SFML on OSX, everything went good. If you have any clue why it doesn't accept the .dylib at runtime on OSX, would be appreciated to share! ;)


Here is the windows .pro file
QT       += core gui widgets webkit webkitwidgets
QT       -= sql
#CONFIG += console


TARGET = MaximumTrainer
TEMPLATE = app

CONFIG += qwt qt thread
RC_FILE = myapp.rc

# For Release, disable QDebug for performance
#DEFINES += QT_NO_DEBUG_OUTPUT

#src files for qwt
INCLUDEPATH += C:/Dropbox/qwt-6.1.0/src

#SFML
INCLUDEPATH += C:/Dropbox/SFML-2.1-windows-vc11-32bits/include
LIBS +=  C:/Dropbox/SFML-2.1-windows-vc11-32bits/lib/sfml-audio.lib



Here is the OSX .pro file:
QT       += core gui widgets webkit webkitwidgets
QT       -= sql

TARGET = MaximumTrainer
TEMPLATE = app

CONFIG += release
CONFIG += qt thread
CONFIG += c++11
CONFIG += x86_64
CONFIG -= i386


#src files for qwt
INCLUDEPATH += /Users/tourlou2/Dropbox/qwt-6.1.0/src

macx {
    QMAKE_MAC_SDK = macosx10.9
}


LIBS += /Users/tourlou2/Dropbox/SFML-2.1-osx-clang-universal/lib/libsfml-audio.2.1.dylib
LIBS += /Users/tourlou2/Dropbox/SFML-2.1-osx-clang-universal/lib/libsfml-system.2.1.dylib

INCLUDEPATH +=  /Users/tourlou2/Dropbox/SFML-2.1-osx-clang-universal/include


QMake step:
Starting: "/Users/tourlou2/Qt5.3.1/5.3/clang_64/bin/qmake" /Users/tourlou2/Dropbox/PowerVelo2_mac3/PowerVelo2.pro -r -spec macx-clang CONFIG+=x86_64

When I try to run the project inside QtCreator:
Starting /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_3_clang_64bit-Release/MaximumTrainer.app/Contents/MacOS/MaximumTrainer...
dyld: Library not loaded: @executable_path/../Frameworks/libsfml-audio.2.dylib
Referenced from: /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_3_clang_64bit-Release/MaximumTrainer.app/Contents/MacOS/MaximumTrainer
Reason: no suitable image found. Did find:
/Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_3_clang_64bit-Release/MaximumTrainer.app/Contents/MacOS/../Frameworks/libsfml-audio.2.dylib: file too short
/Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_3_clang_64bit-Release/MaximumTrainer.app/Contents/MacOS/../Frameworks/libsfml-audio.2.dylib: file too short
/usr/local/lib/libsfml-audio.2.dylib: file too short
The program has unexpectedly finished.

6
Got it! The proposition to had control of the AudioDevice to the user seems good. I'll wait for 2.2, during that time I'm using the other dll as a temporary solution.  Great project again, i'm gonna check to help with my limited c++ experience ;)



7
Great to know!
Just curious, if the new OpenAL-Soft seems to fix this problem, why not include it in SFML? may be over my head here..  good luck ;)

8
Might be this bug: https://github.com/SFML/SFML/issues/30

A fix is pending, you'll find the corresponding branch at the end of the discussion.

Thanks for the link Laurent, I read the discussion and will follow the progress.

In the meantime, I was able to get rid of the error by replacing the openal32.dll provided in 2.1 by the one found at :
http://kcat.strangesoft.net/openal.html#download
I'll have to make sure I can use this dll in production but I think it is legit.

SFML rocks! A+

9
Yes will definitely delete the object before the main program closes, I heard it's bad practice to let the OS do the job :)

Finally I was able to run the project in debug mode

Here is the debug message I get :
https://www.dropbox.com/s/5l62b7ol0hod81u/debugModeSFML.png?dl=0
I put a breakpoint and see that the error is triggered right after my main is over (after the return)

Here is the minimal example :
#Pro File
TARGET = testSound

SOURCES += main.cpp

#SFML
INCLUDEPATH += C:/Dropbox/SFML-2.1-windows-vc11-32bits/include
LIBS +=  C:/Dropbox/SFML-2.1-windows-vc11-32bits/lib/sfml-audio-d.lib


main.cpp
#include <QDebug>
#include <QThread>

#include <SFML/Audio.hpp>


int main() {

    qDebug() << "start main";

    sf::SoundBuffer buffer;
    if (!buffer.loadFromFile("C:/Dropbox/PowerVelo2/sound/resume.wav")) {
        qDebug() << "error open file";
        return 1;
    }
    else {
        qDebug() << "good";
    }


    // Create a sound instance and play it
    sf::Sound sound(buffer);
    sound.play();

    // Loop while the sound is playing
    while (sound.getStatus() == sf::Sound::Playing)
    {
        QThread::msleep(200);
        qDebug() << "looping...waiting for sound to be over" << sound.getStatus();
    }

    qDebug() << "done";

    return EXIT_SUCCESS;
}


10
Thanks for your kind help Laurent.

Yes I am new with C++ (1 year). I didn't delete the SoundPlayer because it is created in the main and lives for as long as my program lives.  I know C++ doesn't have a GC like Java.

Anyway, I don't think the problem is memory. I created a small test program below where everything is created on the stack.

int main() {

    sf::SoundBuffer buffer;
    if (!buffer.loadFromFile("C:/Dropbox/PowerVelo2/sound/resume.wav"))
        return 1;

    // Display sound informations
    std::cout << "canary.wav :" << std::endl;
    std::cout << " " << buffer.getSampleRate()           << " samples / sec" << std::endl;
    std::cout << " " << buffer.getChannelCount()         << " channels"      << std::endl;

    // Create a sound instance and play it
    sf::Sound sound(buffer);
    sound.play();

    // Loop while the sound is playing
    while (sound.getStatus() == sf::Sound::Playing)
    {
        QThread::msleep(200);
        qDebug() << "looping...waiting for sound to be over";
    }

    qDebug() << "done";

    return EXIT_SUCCESS;
}
 

log :
Starting C:\Dropbox\build-PowerVelo2-Desktop_Qt_5_2_1_MSVC2012_32bit-Release\release\MaximumTrainer.exe...
canary.wav :
 44100 samples / sec
 2 channels
looping...waiting for sound to be over
looping...waiting for sound to be over
looping...waiting for sound to be over
looping...waiting for sound to be over
looping...waiting for sound to be over
done
The program has unexpectedly finished.
C:\Dropbox\build-PowerVelo2-Desktop_Qt_5_2_1_MSVC2012_32bit-Release\release\MaximumTrainer.exe crashed

11
Do you think dynamically allocated memory magically frees itself?

Well I'm not using "new" on the buffer and it is a member of the "SoundPlayer" object, so the buffer should get deleted when my SoundPlayer object is deleted.

Not sure what happen when the program is over, I supposed all the pointer and data used is deleted by default, could be wrong, worked too much with Java -_-

12
Minimal example :


int main(int argc, char *argv[]) {
 SoundPlayer *soundPlayer = new SoundPlayer();
}

// SoundPlayer.h
#ifndef SOUNDPLAYER_H
#define SOUNDPLAYER_H

#include <QResource>
#include <QtCore>

#include "SFML/Audio.hpp"
#include <iomanip>
#include <iostream>


class SoundPlayer
{

public:
    SoundPlayer();
private :
    sf::SoundBuffer bufferSoundAchievement;
};
Q_DECLARE_METATYPE(SoundPlayer*)

#endif // SOUNDPLAYER_H


// SoundPlayer.cpp
SoundPlayer::SoundPlayer()
{}


log :
Starting C:\Dropbox\build-PowerVelo2-Desktop_Qt_5_2_1_MSVC2012_32bit-Release\release\MaximumTrainer.exe...
The program has unexpectedly finished.
C:\Dropbox\build-PowerVelo2-Desktop_Qt_5_2_1_MSVC2012_32bit-Release\release\MaximumTrainer.exe crashed

Note :
I can use the soundPlayer just fine to play sounds, setVolume, etc.  The crash happen only when the application is closing.
Merci beaucoup!

In case you need, my Qt project file:
QT       += core gui widgets webkit webkitwidgets
QT       -= sql

TARGET = MaximumTrainer
TEMPLATE = app


CONFIG += qwt qt thread
RC_FILE = myapp.rc

DEFINES += NOMINMAX

#SFML
INCLUDEPATH += C:/Dropbox/SFML-master/include
LIBS +=  C:/Dropbox/SFML-2.1-win-vc11-32bits/lib/sfml-audio.lib


debug :
https://www.dropbox.com/s/7xjnjgk7hqvt465/debugSound.png?dl=0
Is it possible that my app close and the buffer is still open?

13
After further debugging, I found that as soon as I create a class with a "sf::SoundBuffer" private member, I get this error.

e.g:
class SoundPlayer
{

public:
    explicit SoundPlayer();

private :
    sf::SoundBuffer bufferSoundAchievement;

};
Q_DECLARE_METATYPE(SoundPlayer*)

#endif // SOUNDPLAYER_H

As soon as I create a pointer to this class, my program crashes, if I comment the sf::SoundBuffer, it doesn't crash. still investigating

14
Audio / Re: [SOLVED] Qt Resources - Loading a sound from a ressource
« on: October 17, 2014, 07:58:07 pm »
I think i'm not freeing the ressource properly after using SFML
I get this error : The program has unexpectedly finished.
If I comment the use of my SoundPlayer, no error -_-

int main(int argc, char *argv[]) {

    SoundPlayer *soundPlayer = new SoundPlayer();
    app.setProperty("SoundPlayer", QVariant::fromValue<SoundPlayer*>(soundPlayer));
    //do stuff with the player

       /// App terminated, Trying to force resource delete so I don't get the error..
    soundPlayer->~SoundPlayer();
}

//------------------------------------- soundPlayer.cpp
#include "soundplayer.h"
#include <QDebug>


SoundPlayer::~SoundPlayer() {


    qDebug() << "DESTRUCTOR SOUNDPLAYER";
    freeMemory();

}

void SoundPlayer::freeMemory() {

    qDebug() << "freeing memory";

    soundAchievement.resetBuffer();
    soundAchievement.~Sound();

    //    bufferSoundAchievement.~SoundBuffer();

    qDebug() << "end freeing memory";
}

SoundPlayer::SoundPlayer(QObject *parent) : QObject(parent)
{

    QResource qrcAchievement(":/sound/fireTorch");
    bufferSoundAchievement.loadFromMemory(qrcAchievement.data(), qrcAchievement.size());
    soundAchievement =  sf::Sound(bufferSoundAchievement);
}


void SoundPlayer::setVolume(double volume) {

    qDebug() << "setVolume soundPlayer";
    soundAchievement.setVolume(volume);
}

void SoundPlayer::playSoundAchievement() {
    soundAchievement.play();
}
...

 

15
Audio / Re: Qt Resources - Loading a sound from a ressource
« on: October 16, 2014, 06:35:01 pm »
Got it! not sure it's the cleanest way though..


    QResource mySound(":/sound/resume");


    if (!buffer.loadFromMemory(mySound.data(), mySound.size())) {
        qDebug() << "cant play";
        return 0;
    }
    sf::Sound sound(buffer);
    sound.play();

Pages: [1] 2
anything