#include "musicnode.h"

MusicNode::MusicNode(std::string musicFileName):
    m_music_file(musicFileName)
{
}

void MusicNode::init(){
    m_valid = m_music.openFromFile(m_music_file);
}

void MusicNode::play()
{
    if (m_valid)
        m_music.play();
}

void MusicNode::pause()
{
    if(m_valid)
        m_music.pause();
}

void MusicNode::stop()
{
    if(m_valid)
        m_music.stop();
}

void MusicNode::seek(int offset)
{
    m_music.setPlayingOffset(sf::seconds(offset));
}

void MusicNode::loop(bool l)
{
    m_music.setLoop(l);
}
