I am trying to create an application with audio from the BASS.NET Library, but I am getting a few errors on the "My First BASS Application" sample. I followed the given directions on http://bass.radio42.com/help/, but when I try running the pasted code, an error comes up on this line:
if ( Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero) )
the error I recieve is:
An unhandled exception of type 'System.TypeInitializationException' occurred in Bass Test.exe
I tried to follow all the directions, but for #4, instead of adding bass.dll, I added bass.net.dll thinking it was typo.
4.Copy the 'bass.dll' to your executable directory (e.g. .\bin\Debug).
The sample code is:
using System;
using Un4seen.Bass;
namespace MyFirstBass
{
class Program
{
static void Main(string[] args)
{
// init BASS using the default output device
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", 0, 0, BASSFlag.BASS_DEFAULT);
if (stream != 0)
{
// play the stream channel
Bass.BASS_ChannelPlay(stream, false);
}
else
{
// error creating the stream
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();
}
}
}
}
I am guessing that the code is fine but my computer's output device is whats causing the error.