0
0

I am having difficulty on my project "Athena" which is basically a mediaplayer-like GUI for FMOD Ex written in C#. The purpose of this program is primarily to serve as a music loop point tester.

I have created a Windows Form and a function TTRPlaySound which plays a sound. Below you can see the opening section of the form (where some variables are created), form load script where the system is launched, and then later the function TTRPlaySound, which takes arguments of filename (e.g. C:\media\test.mp3) and start/end loop points.

[code:gfwwa458] public FMOD.System system = null;
public FMOD.Sound TTRSound = null;
public FMOD.Channel TTRChannel = null;

    public uint TTRLength = 0;
    public FMOD.SOUND_TYPE TTRSoundType = new FMOD.SOUND_TYPE();
    public FMOD.SOUND_FORMAT TTRSoundFormat = new FMOD.SOUND_FORMAT();
    public FMOD.TAG TTRDataTag = new FMOD.TAG(); 

    public string GAPT_LastDirectoryName = string.Empty;

    public uint GAPT_CurrentLoopStart = 0;
    public uint GAPT_CurrentLoopDone = 0;

    public string GAPT_CurrentPlaybackState = "Stopped"; //stopped paused playing
    public string GAPT_LastTrackName = string.Empty;
    public string GAPT_CurrentTrackAuthor = string.Empty;
    public string GAPT_CurrentTrackTitle = string.Empty;
    public string GAPT_CurrentFileType = string.Empty;
    public string GAPT_CurrentFileSize = string.Empty;

    public string GAPT_LastPROCESSEDName = string.Empty;
    public string GAPT_LastPROCESSEDState = string.Empty;

    public string GAPT_IssueWorkerCommand = string.Empty;

    public int TTRTrackPlayingEntryID = -1;[/code:gfwwa458]

[code:gfwwa458] public Form1()
{
InitializeComponent();

        uint FMODversion = 0;
        FMOD.RESULT result;

        /*
            Create a System object and initialize.
        */
        result = FMOD.Factory.System_Create(ref system);
        ERRCHECK(result);

        result = system.getVersion(ref FMODversion);
        ERRCHECK(result);
        if (FMODversion < FMOD.VERSION.number)
        {
            MessageBox(new IntPtr(0), "VERSION MISMATCH: fmodex.dll" + Environment.NewLine + "Version detected: " + FMODversion.ToString("X") + Environment.NewLine + "Version expected: " + FMOD.VERSION.number.ToString("X"), "Version Mismatch", MB_OK | ICON_STOP);
            Environment.Exit(-1);
        }

        result = system.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
        ERRCHECK(result);

        backgroundWorker2.RunWorkerAsync();

    }[/code:gfwwa458]

[code:gfwwa458] protected void TTRPlaySound(string Argument0, uint Argument1, uint Argument2)
{

        FMOD.RESULT result;

        int TTRNull = 0;

            GAPT_LastTrackName = Argument0;

            GAPT_CurrentTrackTitle = Path.GetFileName(Argument0);

            GAPT_CurrentLoopStart = Argument1;
            GAPT_CurrentLoopDone = Argument2;

            result = system.createSound(Argument0, FMOD.MODE.SOFTWARE | FMOD.MODE._2D | FMOD.MODE.CREATESTREAM, ref TTRSound);
            ERRCHECK(result);

            result = TTRSound.setLoopPoints(GAPT_CurrentLoopStart, FMOD.TIMEUNIT.MS, GAPT_CurrentLoopDone, FMOD.TIMEUNIT.MS);
            ERRCHECK(result);

            if (checkBox1.Checked)
            {
                result = TTRSound.setMode(FMOD.MODE.LOOP_NORMAL | FMOD.MODE.ACCURATETIME);
            }
            else
            {
                result = TTRSound.setMode(FMOD.MODE.LOOP_OFF | FMOD.MODE.ACCURATETIME);
            }


            result = system.playSound(FMOD.CHANNELINDEX.REUSE, TTRSound, false, ref TTRChannel);
            ERRCHECK(result);

            result = TTRSound.getLength(ref TTRLength, FMOD.TIMEUNIT.MS);
            ERRCHECK(result);

            // result = TTRSound.getTag(null, -1, ref TTRDataTag);
            // ERRCHECK(result);

            result = TTRSound.getFormat(ref TTRSoundType, ref TTRSoundFormat, ref TTRNull, ref TTRNull);
            ERRCHECK(result);

            TTRFetchSoundTypeTextifier();
            TTRFetchTrackFilesize();

            GAPT_CurrentPlaybackState = "Playing";

    }[/code:gfwwa458]

If I uncomment the line "result = TTRSound.getTag(null, -1, ref TTRDataTag);", I simply get "vshost.exe has stopped responding" when it hits that point, and don’t understand why. With the line commented out, my program works perfectly, but no tags are thus read (obviously)

If not enough information is provided, the project is on SVN and can be checked out from
[b:gfwwa458]https://subversion.ginever.net/svn/athena[/b:gfwwa458]

I would appreciate help in fixing this because I am stumped.

  • You must to post comments
0
0

No, there is no Sound played when the Dialog shows up… Tinytimrob wrote, that his code is properly working on Windows XP, I’ll try that tomorrow and come back to you with the results.

  • You must to post comments
0
0

This issue has been resolved and a fix will be in our next release for all branches.

  • You must to post comments
0
0

It’s good to know that there’s someone else out there with the same problem. I had previously given up hope (thinking it was just me) but now I am inspired to carry on searching for a solution.

I added a check-box to my program (checkBox2) and modified my tag-reading code of TTRPlaySound to read as follows:

[code:210ugi8i] result = system.playSound(FMOD.CHANNELINDEX.REUSE, TTRSound, Argument3, ref TTRChannel);
ERRCHECK(result);

            result = TTRSound.getLength(ref TTRLength, FMOD.TIMEUNIT.MS);
            ERRCHECK(result);

            result = TTRSound.getNumTags(ref TTRNumTags, ref TTRNumTagsUpdated);
            ERRCHECK(result);

            if (checkBox2.Checked)
            {

                result = TTRSound.getTag("TITLE", -1, ref TTRDataTag);
                if (result != FMOD.RESULT.ERR_TAGNOTFOUND)
                {
                    ERRCHECK(result);
                    oogimaflip_001 = Marshal.PtrToStringAnsi(TTRDataTag.data);
                }
                else
                {
                    // Title tag is not present
                    oogimaflip_001 = Path.GetFileName(Argument0);
                }

                result = TTRSound.getTag("ARTIST", -1, ref TTRDataTag);
                if (result != FMOD.RESULT.ERR_TAGNOTFOUND)
                {
                    ERRCHECK(result);
                    oogimaflip_002 = Marshal.PtrToStringAnsi(TTRDataTag.data) + " - ";
                }
                else
                {
                    oogimaflip_002 = "";
                }

                GAPT_CurrentTrackTitle = oogimaflip_002 + oogimaflip_001;
            }
            else
            {

                GAPT_CurrentTrackTitle = Path.GetFileName(Argument0);
            }[/code:210ugi8i]

This allows me to control whether getTag is run via the checkbox.

I then proceeded to experiment by trying to play different kinds of files. I noticed that files which didn’t have any tags (MIDI, WAV) still opened and played without a crash, even with getTag being run. The same applies for MP3s which didn’t have any tags at all. But as soon as I tried to load an MP3/OGG which had a tag, the crash happened.

To show that it works for me in XP but not Windows 7, I took a screenshot of the two running side-by-side (in both instances of the program I had just chosen to open Z:\Kaminko.mp3): [url:210ugi8i]http://media.thegineverblock.com/pics/soundgetTag1.png[/url:210ugi8i]
This proves my code isn’t at fault.

Windows XP is being run inside Oracle VirtualBox in the above screenshot.

Currently I’m installing Windows 7 Professional x64 in VirtualBox to see if the issue is reproducable on a fresh install of Windows 7, and will post back with my findings.

In the meantime, if anyone wants to help diagnose this problem or see if they can reproduce the crash without having to modify or compile any code, I have compiled a release build of Athena with the getTag checkbox, which can be found at [url:210ugi8i]http://athena.ginever.net/athenasvn_2010-11-17-a.zip[/url:210ugi8i] (requires .NET Framework 4.0 to run)

  • You must to post comments
0
0

Welcome to the forums Tinytimrob.

Can you try loading the MP3 you are testing with in the ‘readtags’ C# examlple. That should help us work out whether the problem is the file or the code.

  • You must to post comments
0
0

OK. I have completed the VirtualBox install of Windows 7 and then installed .NET 4.0 but no other updates. Athena (and thus getTag) worked perfectly, so the problem is clearly not caused by Windows 7 but something else.

I will try to do further tests to isolate the exact cause.

  • You must to post comments
0
0

peter,

Thanks for replying. I can confirm that it is definitely the code. readtags will open all of the files I have tried without a problem; but Athena refuses to load ANY file and ALWAYS crashes regardless of what file is loaded.

  • You must to post comments
0
0

My code is working fine on my XP machine.. I’ll also try to isolate the problem in another virtualmachine..

  • You must to post comments
0
0

Hello again,

I still need assistance with this. The code looks perfectly fine to me and I don’t understand why it isn’t working; reading the documentation isn’t helping me at all and I don’t think I’ll ever get it working without some help.

Thanks in advance.

  • You must to post comments
0
0

I discovered another curious behavior – I tested this in both of our applications (downloaded your zip-file):

When using getTag (after using showDialog()..) on an mp3-file with ID3v2 ONLY the program is not crashing, but there aren’t any tags read, tag.name/tag.data stay empty.
As soon as there is an ID3v1 included, application crashes again.

  • You must to post comments
0
0

Hi Tinytimrob,

The best approach in situations like this is to slowly build up the readtags example until it reproduces the issue you are seeing in your application. In that process you should discover the cause of the problem. It generally doesn’t take too long to do this, just search for all the FMOD function calls in you project including System::init and choose the ones which seem most relevant.

Out of interest does it make any difference if you read the tags before playing the sound?

  • You must to post comments
0
0

After getting my brother to test Athena on his computer (which is Windows Vista 32bit) he was able to reproduce the crash. Behaviour in the Windows 7 virtual machine is currently erratic (sometimes it crashes and sometimes it doesn’t)

  • You must to post comments
0
0

Hello,

Reading tags before playing the sound doesn’t help. But I think I have managed to find the cause of the problem.

My program uses OpenFileDialog() from System.Windows.Forms in order to locate the file by the program. If I comment out all these lines and instead just simply tell my script TTRPlaySound to run a hardcoded sound (e.g. "C:\folder\file.mp3") then it works fine.

If I then uncomment the lines to launch the OpenFileDialog, the getTag line will crash, even if the retrieved file name is not played.

[b:2j9xwp7i]STEPS TO REPRODUCE THE ISSUE USING READTAGS[/b:2j9xwp7i]

Find:
[code:2j9xwp7i] result = system.init(100, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
ERRCHECK(result);

        /*
            Open the specified file. Use FMOD_CREATESTREAM and FMOD_DONTPREBUFFER so it opens quickly
        */
        result = system.createSound("../../../../../examples/media/wave.mp3", (FMOD.MODE.SOFTWARE | FMOD.MODE._2D | FMOD.MODE.CREATESTREAM | FMOD.MODE.OPENONLY), ref sound);
        ERRCHECK(result);[/code:2j9xwp7i]

Replace with:
[code:2j9xwp7i] result = system.init(100, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
ERRCHECK(result);

        OpenFileDialog dialog = new OpenFileDialog();
        dialog.Filter = "All Files|*.*";
        dialog.Title = "Open";
        dialog.ShowDialog();

        /*
            Open the specified file. Use FMOD_CREATESTREAM and FMOD_DONTPREBUFFER so it opens quickly
        */
        result = system.createSound("../../../../../examples/media/wave.mp3", (FMOD.MODE.SOFTWARE | FMOD.MODE._2D | FMOD.MODE.CREATESTREAM | FMOD.MODE.OPENONLY), ref sound);
        ERRCHECK(result);[/code:2j9xwp7i]

Now rebuild readtags and launch it. The dialog opens and works fine. Readtags then crashes on the getTag line. However, if you put the lines to load the OpenFileDialog UNDERNEATH the getTag command, program works fine (tags are retrieved then dialog is shown)

I therefore summarise there is a fault with the FMOD C# implementation of getTag, it is incompatible with OpenFileDialog, and will crash if you have used OpenFileDialog prior to running the command getTag.

  • You must to post comments
0
0

Hi Tinytimrob, I did exactly as you said and added the OpenFileDialog code you posted to the readtags example and it does not crash for me. It sounds a bit unsual that adding unrelated code would cause a crash. Are you doing anything out of the ordinary?

  • You must to post comments
0
0

Hi, sorry for the delay in replying.

I am not doing anything out of the ordinary, but what I can say is that I ran the code under a Windows XP virtual machine and it runs fine; whereas under my main Windows 7 install it crashes using the behaviour I described.

I’m not too sure why this is; getTag and OpenFileDialog seem to work perfectly fine on my Win 7 system as long as they aren’t both used in the same program.

I will attempt to find out whether this is an issue specific to my PC or whether it is an issue with Windows 7 and get back to you.

  • You must to post comments
0
0

Hi,

I’m currently running into the exact same problem Tinytimrob is, except that I’m using a FolderBrowserDialog – but my application is also crashing when I’m using OpenFileDialog (at any point before getTag).

Creating the Object isnt a problem at all, but as soon as I have called ShowDialog(), I’m not able to use FMODs getTag anymore.

I also tried to use Tinytimrobs modified Readtags Example – with the same result he got. Application crashes as soon as getTag is called.

I’m currently also running Windows7 (x64) and I tried to debug this issue as far as I could, but I’m starting to get a littlebit helpless now.

Do you have any idea how to solve this issue?

Thanks in advance and best regards

  • You must to post comments
0
0

And no sound is actually being played when you show the dialog? Failure to call system update while sounds need processing will result in odd behaviors.

  • You must to post comments
Showing 16 results
Your Answer

Please first to submit.