0
0

I’ve wrapped a simple C# FMOD class for playing mp3 files.
The "Play" function just works well while the "Stop" funtion I think may have some problem.


    //StopTrack - used to stop playing
    public static void StopTrack()
    {
        //check if the handle is still valid
        //if it's not, the track is probably already finished
        if (_soundHandle.ToInt32() > 0)
        {
            //stop playing
            Stop(_soundHandle);
            //release the resources
            Close();
        }

}

When I want to delete the mp3 file I’ve just played, the program comes up with an exception: "Process can’t visit file "xxx.mp3", because another process is using it."

Maybe the "Close()" above doesn’t really RELEASE the resources?

Waiting for your kind reply.

  • You must to post comments
0
0

use
FSOUND_Stream_Stop
then
FSOUND_Stream_Close

both using stream pointer/handle!

  • You must to post comments
0
0

[quote="Controller":3fnbw6wp]use
FSOUND_Stream_Stop
then
FSOUND_Stream_Close

both using stream pointer/handle![/quote:3fnbw6wp]

Thanks a lot… I’ve P/Invoke the wrong one. So "FSOUND_Close" should be "FSOUND_Stream_Close". You a great help.

    [DllImport("fmodce.dll", EntryPoint = "FSOUND_Stream_Stop", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
    public extern static bool Stop(IntPtr fstream);

    [DllImport("fmodce.dll", EntryPoint = "FSOUND_Close", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
    public extern static void Close();.
  • You must to post comments
0
0

Seeing ‘CharSet = CharSet.Unicode’… fmod does not suppoert unicode (fmodex does, at least optionally for loading streams/sounds)

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.