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 - MicroJoe

Pages: [1]
1
Audio / Re: [SOLVED] sf::Music and dynamic allocation
« on: June 04, 2013, 09:58:48 am »
Ok, thank you very much for your answers ; I will test these std::unique_ptr in a sandbox C++ project before though.

2
Audio / Re: [SOLVED] sf::Music and dynamic allocation
« on: June 04, 2013, 09:45:16 am »
Ok, so these pointers will be automatically destroyed on ~vector() called by my ~PlaylistManager() class ? I'm quite new to these C++11 things but I try to discover it step by step ; theses std::unique_ptr things seems very interesting because I love C++'s RAII (like you from your quote :D).

(Btw, I'm probably going to use Thor in this game too, looks… powerful! Hope it will compile with MSVC++11)

3
Audio / [SOLVED] sf::Music and dynamic allocation
« on: June 04, 2013, 03:53:23 am »
Good evening.

I was trying to make a little playlist manager for one of my games using the m3u format. The m3u-thing is working good but I decided to use dynamic allocation because sf::Music wasn't copyable.

Before that, I was playing music well before but since dynamic allocation the music is marked as playing but nothing goes out of my headphones.

Here is the part were I allocate the sf::Music instance :

m_currentMusics.clear();
for(auto &musicName : it->second)
{
        sf::Music* music = new sf::Music;
        if (!music->openFromFile(musicName))
        {
                delete music;
                continue;
        }
        music->setVolume(m_volume);
        m_currentMusics.push_back(music);
}

m_currentMusicIndex = 0;

if (m_currentMusics.size() > 0)
{
        m_currentMusics[m_currentMusicIndex]->play();
}

std::cout << (m_currentMusics[m_currentMusicIndex]->getStatus() == sf::Music::Status::Playing) << std::endl;
 

I do got a 1 answer on stdout meaning that the song's status is set to playing. Moreover, I toke a screenshot from VS debugger in order to show you that the song is loaded in the MusicManager after a call to the concerned method :



Any ideas ? :)

EDIT : Sorry for this useless topic, I set the m_volume to 0.6f instead of 60.f. Time to go bed I think.

Pages: [1]
anything