Bass.net : ERROR_FILE_OPEN when trying to create a stream

243 views Asked by At

I'm trying to use the bass.net library, but each time I try to create a stream from an audio file (mp3 and wav) I get a BASS_ERROR_FILE_OPEN error.

Actually, even the sample provided with bass.net lead to the same result.

Here is the code, which I assume is Ok since it comes from the sample :

        if ( Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero) )
        {
            // create a stream channel from a file
            int stream = Bass.BASS_StreamCreateFile("test.mp3", 0L, 0L, BASSFlag.BASS_DEFAULT);
            if (stream != 0)
            {
                // play the channel
                Bass.BASS_ChannelPlay(stream, false);
            }
            else
            {
                // error
                Console.WriteLine("Stream error: {0}", Bass.BASS_ErrorGetCode());
            }

            // wait for a key
            Console.WriteLine("Press any key to exit");
            Console.ReadKey(false);

            // free the stream
            Bass.BASS_StreamFree(stream);
            // free BASS
            Bass.BASS_Free();

The BASS_Init methods works correctly, the problem really comes from the StreamCreateFile.

The "test.mp3" file is correctly added to my project. I have a project reference to bass.net.dll and I also added the bass.dll file in bin/Debug, as said on bass website.

I can't figure out what I'm doing wrong, so I'll be grateful if anyone can help me.

0

There are 0 answers