Yes you are right, ist .NET / C#. Simple code with a handful P/Invokes:
public partial class Form1 : Form
{
private int stream = 0;
public Form1()
{
InitializeComponent();
BASS_Init(-1, 44100, 0, IntPtr.Zero, IntPtr.Zero); // works fine
}
private void btnClose_Click(object sender, EventArgs e)
{
BASS_Free(); // works fine
Close();
}
private void btnPlay_Click(object sender, EventArgs e)
{
stream = BASS_StreamCreateFile(0, @"\Storage Card\test.mp3", 0, 0, BASS_DEFAULT | BASS_UNICODE); // works fine
//long byteLen = BASS_ChannelGetLength(stream, BASS_POS_BYTES); // this line throws NotSupportedException
BASS_ChannelPlay(stream, 1); // works fine
}
private const int BASS_DEFAULT = 0;
private const int BASS_UNICODE = -2147483648;
private const int BASS_POS_BYTES = 0;
[DllImport("bass", CharSet = CharSet.Auto)]
private static extern int BASS_Init(int device, int freq, int flags, IntPtr hwnd, IntPtr clsid);
[DllImport("bass", CharSet = CharSet.Auto)]
private static extern int BASS_Free();
[DllImport("bass", CharSet = CharSet.Auto)]
private static extern int BASS_StreamCreateFile(int memory, string file, long offset, long length, int flags);
[DllImport("bass", CharSet = CharSet.Auto)]
private static extern long BASS_ChannelGetLength(int handle, int mode);
[DllImport("bass", CharSet = CharSet.Auto)]
private static extern int BASS_ChannelPlay(int handle, int restart);
}
Is there any wrong with the P/Invoke signatures? Or could it be, there is a problem with Windows Mobile 6.5?