private void InitBass()              //初始化BASS
        {
            if (!Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_CPSPEAKERS, this.Handle))
            {
                MessageBox.Show("Bass初始化出错" + Bass.BASS_ErrorGetCode().ToString());
            }
        }
//**************************************************************
int stream = Bass.BASS_StreamCreateURL(selectedPath, 0, BASSFlag.BASS_DEFAULT, null, IntPtr.Zero);
Bass.BASS_ChannelPlay(stream, true);
//播放
可以完美播放,只是加载音乐时仅仅会加载音乐文件的一部分,例如4分钟的歌,只加载2分钟,
两分钟之后就停了,求破·有没有大神?帮帮我

解决方案 »

  1.   

      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();
                }