Hi -- first of all thank for your answers!
I changed the code according to your advice:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Un4seen.Bass;
using Un4seen.Bass.AddOn.Wma;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private int _stream;
private void Form1_Load(object sender, EventArgs e)
{
BassNet.Registration("**");
// BASS Multimedia initialisieren
if (
!Bass.BASS_Init(-1, 44100,
BASSInit.BASS_DEVICE_DEFAULT, Handle, null))
{
MessageBox.Show("Bass-Initialisierung fehlgeschlagen.");
}
int _wmaPlugIn = Bass.BASS_PluginLoad("basswma.dll");
BASS_PLUGININFO pluginInfo = Bass.BASS_PluginGetInfo(_wmaPlugIn);
MessageBox.Show(_wmaPlugIn.ToString());
MessageBox.Show(this, String.Format("{0}\nName={1}\nExtensions={2}", "basswma.dll", Utils.BASSAddOnGetSupportedFileName("basswma.dll"), Utils.BASSAddOnGetSupportedFileExtensions("basswma.dll")));
}
private void simpleButton1_Click(object sender, EventArgs e)
{
string datei = @"c:\1.wma";
_stream = Bass.BASS_StreamCreateFile(datei, 0, 0, BASSFlag.BASS_DEFAULT);
MessageBox.Show(Bass.BASS_ErrorGetCode().ToString());
Bass.BASS_ChannelPlay(_stream, false);
BASS_CHANNELINFO info = new BASS_CHANNELINFO();
if (Bass.BASS_ChannelGetInfo(_stream, info))
{
// display the channel info..
this.labelControl1.Text = String.Format("Type={0}, Channels={1}, OrigRes={2}", Utils.BASSChannelTypeToString(info.ctype), info.chans, info.origres);
}
}
}
}
and here is what i get:
when debuggingeverything is fine:
from:
MessageBox.Show(_wmaPlugIn.ToString());
i get the number 269484032
from:
MessageBox.Show(this, String.Format("{0}\nName={1}\nExtensions={2}", "basswma.dll", Utils.BASSAddOnGetSupportedFileName("basswma.dll"), Utils.BASSAddOnGetSupportedFileExtensions("basswma.dll")));
i get "basswma.dll Name=Windows Media Audio Entensions=*.wma;*.wmv
when clicking the button i get "BASS_OK" and the label shows the correct type, channels and bitrate and is playing...
when I am publishingfrom:
MessageBox.Show(_wmaPlugIn.ToString());
i get the number 269484032
from:
MessageBox.Show(this, String.Format("{0}\nName={1}\nExtensions={2}", "basswma.dll", Utils.BASSAddOnGetSupportedFileName("basswma.dll"), Utils.BASSAddOnGetSupportedFileExtensions("basswma.dll")));
i get "basswma.dll Name=Windows Media Audio Entensions=*.wma;*.wmv
when clicking the button i get "BASS_OK" and the label shows nothing and the stream is not playing... when i am clicking a second time on the button then i get "BASS_ERROR_HANLDE".
Of course the bass.dll and the basswma.dll (and Bass.Net.dll) are in the application folder...
Hope this helps!
Thank you very much
martin