Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - AnoHito

Pages: [1]
1
D / Re: Bizzare issue playing audio files
« on: July 27, 2014, 06:45:30 pm »
This is because I haven't had a chance to update the binaries for the most recent version, so that one is on me. I'll be building them tonight for each system though.

Have you considered packaging the binaries with a copy of the DSFML source tree they are compatible with? That might make it easier for people to get everything up and running.

Can you let me know where this happens so I can fix it in the source code?

Sure thing. Here is a list of all the places the error occurs: dsfml/audio/sound.cpp - 160; dsfml/audio/soundbuffer.cpp - 126; dsfml/audio/soundrecorder.cpp - 58; dsfml/audio/soundrecorderstruct.cpp - 71; dsfml/graphics/image.cpp - 159; dsfml/graphics/view.cpp - 130; dsfml/network/http.cpp - 113, 120; dsfml/network/packet.cpp - 73, 80; dsfml/network/tcpsocket.cpp - 60, 66, 81

It's awesome you managed to get it working though! Let me know if you have any other problems.

Will do. But other than the audio issue things have actually been going really well. I was able to get dbox and DSFML working together in a reasonable way, and I'm well on my way to having a working game engine. :)

2
D / Re: Bizzare issue playing audio files
« on: July 22, 2014, 09:57:52 am »
I just tested out the new version of of DSFML, and while I did have a few problems getting things to work, I was finally able to play audio files without triggering a crash. ;)

Here are some of the difficulties I ran into in case you want to look into fixing them:

  • The latest precompiled nightly seems to be missing several functions in the audio library, resulting in unresolved symbol errors when used with the latest DSFML sources.
  • Visual C++ does not allow implicit returns, so I had to add a few return statements in order to get DSFML-C to compile.
  • sfErrAudio_getOutput causes unresolved external symbol errors with the latest DSFML-C, so I had to comment out it's use.
  • An invalid file descriptor exception was thrown when I called music.openFromFile, even when the audio file existed. Trying to open a file that doesn't exist also results in an invalid memory operation error, which I don't think should happen normally... But I was able to get things working correctly by enclosing the call to openFromFile in a try/catch block, and once I suppressed the error everything worked perfectly.

So things are still a little hacked together on my end, but who cares if the solution is a little messy as long as it works. ;)

3
D / Re: Bizzare issue playing audio files
« on: July 01, 2014, 07:05:13 am »
Awesome news. ;D Sorry, for the late reply, but I've doing a lot of game engine programming lately which has kept me pretty busy. I've really been enjoying coding in D too. It's such a welcome change to have a fast low level language that still retains a lot of the high level niceties that I've grown accustomed to by coding in Ruby. C++ actually scared me away from serious game programming for a long time...

4
D / Re: Bizzare issue playing audio files
« on: June 02, 2014, 08:30:14 am »
You do need to be running it in the debugger to see the error I was getting. If you run it normally it doesn't appear. I didn't even know about the error that happens if the music finished though.

Edit: Ah, yes, confirmed. I get a core.exception.InvalidMemoryOperationError if I let the music file play until the end.

5
D / Re: Bizzare issue playing audio files
« on: June 02, 2014, 06:10:42 am »
Okay, awesome. ;D But what about the unresolved external symbol error? Is there anything I could do to handle that a little more gracefully than just blanking out the function?

6
D / Re: Bizzare issue playing audio files
« on: June 02, 2014, 01:55:56 am »
Okay, I think I solved the problem. I'm not really sure what the cause was, but by going through the whole process of building SFML and SFML-C on my own setup, I was able to get the audio working. :) But I did run into a couple of non-critical but still worrying issues during the process. First of all, when building dsfml-graphics, I encountered the following error:

Quote
Error   1   error LNK2001: unresolved external symbol "public: static struct sf::Shader::CurrentTextureType sf::Shader::CurrentTexture" (?CurrentTexture@Shader@sf@@2UCurrentTextureType@12@A)   C:\Development\Libraries\DSFML-C\build\src\SFML\Graphics\Shader.obj   dsfml-graphics

I was able to work around it with a lazy hack, but I couldn't figure out what was actually causing the error...

void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name)
{
    //CSFML_CALL(shader, setParameter(name, sf::Shader::CurrentTexture));
        return;
}

Secondly, I ran into an issue where even after closing the main window of the program, the audio would keep playing and the program would not exit. I was able to sort of fix things by manually calling exit(), but this causes my program to throw the following error when running in the debugger:

Quote
Unhandled exception at 0x7736A4B9 (ole32.dll) in DSFML_Example.exe: 0xC0000005: Access violation reading location 0xFEEEFEEE.

Since I build all the libraries with debugging information, I was able to track down the issue to the destructor of the SFML AudioDevice class:

AudioDevice::~AudioDevice()
{
    // Destroy the context
    alcMakeContextCurrent(NULL);
    if (audioContext)
        alcDestroyContext(audioContext);

    // Destroy the device
    if (audioDevice)
        alcCloseDevice(audioDevice);
}

It appears that the function is being called with an invalid "this" pointer. My best guess would some sort of garbage collection issue, but I don't really know enough about D to say for sure.

Here are the updated project files in case you'd like to look at them.

7
D / Bizzare issue playing audio files
« on: June 01, 2014, 07:37:49 am »
Hi, so just as a disclaimer, I am very new to both the D programming language and SFML, so there could easily be a facepalm worthy cause behind my current issue, but if there is I can't find it. I'm currently trying to get a simple test program that uses DSFML to work correctly. Here is my current code:

module winmain;

import core.runtime;
import core.sys.windows.windows;

import dsfml.system;
import dsfml.window;
import dsfml.graphics;
import dsfml.audio;

extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    int result;

    try
    {
        Runtime.initialize();
        result = myWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
    }
    catch (Throwable error)             // catch any uncaught exceptions
    {
        MessageBoxA(null, cast(char *)error.toString(), "Error", MB_OK | MB_ICONEXCLAMATION);
        result = 0;             // failed
    }

    return result;
}

int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
        void errorMessage(Throwable error)
        {
        MessageBoxA(null, cast(char *)error.toString(), "Error", MB_OK | MB_ICONEXCLAMATION);
        }

    // Load a sprite to display
        Texture texture;
        Sprite sprite;

    try
    {
                texture = new Texture();
                if(!texture.loadFromFile("cute_image.png"))
                        return 0;
                sprite = new Sprite(texture);
    }
    catch (Throwable error)
    {
                errorMessage(error);
        }

    // Create the main window
        auto size = texture.getSize();
    auto window = new RenderWindow(VideoMode(size.x, size.y), "DSFML window");

    // Create a graphical text to display
    auto font = new Font();
    if(!font.loadFromFile("arial.ttf"))
        return 0;
    auto text = new Text("Hello DSFML", font, 50);
        text.setColor(Color.Black);

        // Load a music to play
    try
    {
                auto music = new Music();
                if(!music.openFromFile("nice_music.ogg"))
                        return 0;

                // Play the music
                music.play();
    }
    catch (Throwable error)
    {
                errorMessage(error);
        }

    // Start the game loop
    while(window.isOpen())
    {
        // Process events
        Event event;
        while(window.pollEvent(event))
        {
            // Close window
            if(event.type == Event.EventType.Closed)
                window.close();
        }

        // Clear screen
        window.clear();

        // Draw the sprite
        window.draw(sprite);

        // Draw the string
        window.draw(text);

        // Update the window
        window.display();
    }

    return 0;
}
 

The problem is that while the audio file will load correctly, the program will throw a "Bad file descriptor" error when I actually try to play it. And if that weren't bad enough, when I try to close the program I get the following runtime error:

Quote
Unhandled exception at 0x7736A4B9 (ole32.dll) in DSFML_Example.exe: 0xC0000005: Access violation reading location 0xFEEEFEEE.

I really have no idea what's going on here. Looking through my code and configuration, it's not clear at all that I did anything horribly wrong. Here is a link to my entire Visual Studio project in case anyone wants to look at it (it requires you to have Visual D installed).

Pages: [1]