Skip to content

[raudio] Non-looping music stream stops before end #5021

Open
@Paperdomo101

Description

@Paperdomo101

Issue description

Playing a music stream with looping set to false will stop just before the end.

Environment

OS: macOS 15.5
Processor: Apple M4 Pro (arm64)

Issue Screenshot

Tested with resources/sound.wav

Image

Code Example

In examples/audio/audio_music_stream.c

// change
Music music = LoadMusicStream("resources/country.mp3");

// to
Music music = LoadMusicStream("resources/sound.wav"); // just so we don't have to wait as long
music.looping = false;

I believe the issue lies here at the end of UpdateMusicStream in raudio.c:

if (framesLeft <= subBufferSizeInFrames)
{
    if (!music.looping)   /*== this is being executed too early ==*/
    {
        ma_mutex_unlock(&AUDIO.System.lock);
        // Streaming is ending, we filled latest frames from input
        StopMusicStream(music);
        return;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions