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]
16
Audio / [SOLVED] Qt Resources - Loading a sound from a ressource
« on: October 16, 2014, 06:22:52 pm »
Hi guys,

First thanks SFML, I just tried it for the first time and it works so easily!

In my Qt project, all my sounds are mapped to resources,
I would like to play the sound from the resource instead of from the hard drive.

I can play the sound fine when I load from the disk, however, is there a way to use the ressource syntax to load a sound?

Thanks in advance!

    if (!buffer.loadFromFile(":/sound/resume")) {
        qDebug() << "cant play";
        return 0;
    }
//    if (!buffer.loadFromFile("C:\\Dropbox\\PowerVelo2\\sound\\CadenceTooHigh.wav")) {
//        qDebug() << "cant play";
//        return 0;
//    }
    sf::Sound sound(buffer);
    sound.play();

I suspect I may have to use "loadFromMemory" as the file should be in memory (it is inside the .exe)

Pages: 1 [2]