<commit_before>#include "../include/Cerium/Music.hpp"
#include "../include/Cerium/DebugLog.hpp"

namespace cerium
{
    Music::Music(const std::string &path, const bool & looped)
    {
        this->looped = looped;

        Mix_Init(MIX_INIT_MP3 | MIX_INIT_OGG);
        Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024);

        std::string filePath = "res/music/" + path;

        Mix_VolumeMusic(50);
        music = Mix_LoadMUS(filePath.c_str());

        if(music == NULL || music == nullptr)
        {
            DebugLog::add(filePath + " music loading error");
        }

        Mix_Quit();
    }


    void Music::resume(void)
    {
        Mix_ResumeMusic();
    }


    Music::~Music()
    {
        Mix_FreeMusic(music);
    }


    void Music::stop(void)
    {
        Mix_PauseMusic();
    }


    void Music::use()
    {
        Mix_PlayMusic(music, (int)looped);
    }
}<commit_msg>Only one music can be played at same time<commit_after>#include "../include/Cerium/Music.hpp"
#include "../include/Cerium/DebugLog.hpp"

namespace cerium
{
    Music::Music(const std::string &path, const bool & looped)
    {
        this->looped = looped;

        Mix_Init(MIX_INIT_MP3 | MIX_INIT_OGG);
        Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024);

        std::string filePath = "res/music/" + path;

        Mix_VolumeMusic(50);
        music = Mix_LoadMUS(filePath.c_str());

        if(music == NULL || music == nullptr)
        {
            DebugLog::add(filePath + " music loading error");
        }

        Mix_Quit();
    }


    Music::~Music()
    {
        Mix_FreeMusic(music);
    }


    void Music::resume(void)
    {
        Mix_ResumeMusic();
    }


    void Music::stop(void)
    {
        Mix_PauseMusic();
    }


    void Music::use()
    {
        if(!Mix_PlayingMusic())
        {
            Mix_PlayMusic(music, (int)looped);
        }
    }
}
{'fraction_non_alphanumeric': 0.1393008474576271, 'fraction_numerical': 0.013771186440677966, 'mean_word_length': 2.0866013071895426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3179178', 'n_tokens_mistral': 677, 'n_tokens_neox': 624, 'n_words': 105}