Okay, here is a code snippet I used. This is just a testcode I use in a small console program just to see if the functions I need are supported. The mixer is there just to enable gapless playback. The exact function at which the crash occurs is way before the mixer creation: var stream = Bass.BASS_StreamCreateFile(pathplusfile, 0, 0, flags);
The file it tries to play is in the exact same folder as the executing program, hence the pathplusfile.
[b]
var flags = BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_UNICODE | BASSFlag.BASS_SAMPLE_SOFTWARE | BASSFlag.BASS_SAMPLE_FLOAT;
var pathplusfile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "wavfile.wav");
Console.Write(string.Format("We are looking for {0} {1}", pathplusfile, Environment.NewLine));
var stream = Bass.BASS_StreamCreateFile(pathplusfile, 0, 0, flags);
Console.Write(" came passed stream creation." + Environment.NewLine);
var mixerflags = BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_MIXER_NORAMPIN;
if (stream == 0)
{
Console.WriteLine("We could not create stream due to: "); //todo: add bass error
}
BASS_CHANNELINFO ci = new BASS_CHANNELINFO();
Bass.BASS_ChannelGetInfo(stream, ci); // get the sample format
Console.Write(" came passed channel queryinfo." + Environment.NewLine);
var success = false;
var mixerHandle = BassMix.BASS_Mixer_StreamCreate(ci.freq,
ci.chans,
BASSFlag.BASS_MIXER_END); // create mixer
Console.Write(" came passed mixerstream creation." + Environment.NewLine);
if (mixerHandle == 0)
{
Console.Write("mixer handle failure");
}
var _mixerStallSync = new SYNCPROC(OnMixerStall); //attach the handler
Bass.BASS_ChannelSetSync(mixerHandle,
BASSSync.BASS_SYNC_END | BASSSync.BASS_SYNC_MIXTIME,
0L,
_mixerStallSync,
System.IntPtr.Zero);
BassMix.BASS_Mixer_StreamAddChannel(mixerHandle,
stream,
mixerflags);
if (Bass.BASS_ChannelPlay(mixerHandle, false))
{
Console.Write("Started playing" + Environment.NewLine);
Console.WriteLine("Press button to stop playing");
}
else
{
Console.Write("Could not start playback");
Console.Write("error: " + Bass.BASS_ErrorGetCode());
}
}
static void OnMixerStall(int handle, int channel, int data, IntPtr user)
{ }[/b]