Jump to content

App freezes when trying to load Quake 1 ogg music


Go to solution Solved by Josh,

Recommended Posts

Posted

Steam, beta branch.

In steam version music can be found in steam games path\Quake\rerelease\id1\music

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[]) {
    //Get the displays
    auto displays = GetDisplays();

    //Create window
    auto window = CreateWindow("Ultra Engine", 0, 0, 800, 600, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER);

    //Load sound
    auto sound = LoadSound("track02.ogg");

    //Play sound
    auto speaker = CreateSpeaker();
    speaker->SetSound(sound);
    speaker->SetLooping(true);
    speaker->Play();

    while (window->Closed() == false) {
        if (window->KeyDown(KEY_ESCAPE)) break;
    }
    return 0;
}

 

Check out Slipgate Tactics - turn based tactics Quake fan game, which is made with Ultra Engine/Leadwerks 5:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

  • Solution
Posted

It works, but it seems that loading is very slow...

Debug: 98 seconds
Release: 96 seconds

These results cause me to believe the problem has to do with constant buffer resizing (4096 bytes at a time), instead of decoding time. If I disable resizing and copying data to the uncompressed sound buffer, it only takes 904 milliseconds to decode the same file in release builds, and 2076 in debug builds.

I was able to eliminate this delay simply by switching to STL vectors, as they have some implementation-dependent optimizations to help with frequent resizes. When a vector is resized, a memory block that is about 30% bigger than requested is allocated, which eliminates a lot of frequent resizing. You can see the difference by checking size() and capacity() of a vector.

  • Like 1

Let's build cool stuff and have fun. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...