<commit_before>#include "ctrcommon/sound.hpp"

#include "service.hpp"

#include <3ds.h>

void* soundAlloc(u32 size) {
    return linearAlloc(size);
}

void soundFree(void* mem) {
    linearFree(mem);
}

bool soundPlay(u32 channel, SoundFormat format, u32 sampleRate, void* samples, u32 numSamples) {
    if(!serviceRequire("csnd")) {
        return false;
    }

    if(channel > 7) {
        channel = 7;
    }

    GSPGPU_FlushDataCache(NULL, (u8*) samples, numSamples * (format == FORMAT_PCM16 ? 2 : 1));
    Result res = csndPlaySound((int) (8 + channel), format | SOUND_ONE_SHOT, sampleRate, samples, samples, numSamples * (format == FORMAT_PCM16 ? 2 : 1));
    if(res != 0) {
        platformSetError(serviceParseError((u32) res));
    }

    return res == 0;
}<commit_msg>Update to latest ctrulib.<commit_after>#include "ctrcommon/sound.hpp"

#include "service.hpp"

#include <3ds.h>

void* soundAlloc(u32 size) {
    return linearAlloc(size);
}

void soundFree(void* mem) {
    linearFree(mem);
}

bool soundPlay(u32 channel, SoundFormat format, u32 sampleRate, void* samples, u32 numSamples) {
    if(!serviceRequire("csnd")) {
        return false;
    }

    if(channel > 7) {
        channel = 7;
    }

    GSPGPU_FlushDataCache(NULL, (u8*) samples, numSamples * (format == FORMAT_PCM16 ? 2 : 1));
    Result res = csndPlaySound((int) (8 + channel), format | SOUND_ONE_SHOT, sampleRate, 1, 0, samples, samples, numSamples * (format == FORMAT_PCM16 ? 2 : 1));
    if(res != 0) {
        platformSetError(serviceParseError((u32) res));
    }

    return res == 0;
}
{'fraction_non_alphanumeric': 0.14276649746192893, 'fraction_numerical': 0.03299492385786802, 'mean_word_length': 3.571014492753623, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6314058', 'n_tokens_mistral': 587, 'n_tokens_neox': 543, 'n_words': 131}