Author Topic: VB.NET BASS_StreamCreateFile doesn't work? (SOLVED)  (Read 2893 times)

Rakham01

  • Posts: 15
Hi!

I'm a long time VB6.0 user and now I'm trying to convert my old MP3player application to VB.NET 2008.
This basic command "cHandle = BASS_StreamCreateFile(BASSFALSE, StrPtr(filename), 0, 0, 0)" is not working anymore, because .NET does not support StrPtr-function anymore. cHandle is type Integer, so how can I create a pointer to filename in VB.NET??? I downloaded VB.NET.DLL, but those VB.NET examples were missing, so I can't figure out, how to get handle to file. Help???
« Last Edit: 20 Feb '12 - 14:31 by Rakham01 »

radio42

  • Posts: 4574
Re: VB.NET BASS_StreamCreateFile doesn't work?
« Reply #1 on: 20 Feb '12 - 08:59 »
In VB.Net you don't need any 'StrPtr' function.
Just use the 'filename' directly.
Please see the examples as given in the "BASS_StreamCreateFile" function of the help.

Rakham01

  • Posts: 15
Re: VB.NET BASS_StreamCreateFile doesn't work?
« Reply #2 on: 20 Feb '12 - 09:20 »
Thank's for your answer. I tried to install BASS.NET.DLL with SetUp, but I had some difficulties with the Help files and example files. From Start-menu I can open "BASS.NET API for .NET/Samples" but then I get an error message, because the real project is missing. I made a reference to installed BASS.NET and can open it from solution explorer, but without Help-files and examples, it's difficult. With BASS.DLL it was those VB-examples and ready made modules/classes (Bass.bas and cbass_time.cls) with Type and parameter definitions, that gave me a real kick start for using BASS. It's a very nice product with built in properties and I would like to continue with BASS.NET. Any chance to get those Help-files and examples, without using that SetUp?

radio42

  • Posts: 4574
Re: VB.NET BASS_StreamCreateFile doesn't work?
« Reply #3 on: 20 Feb '12 - 09:31 »
Sounds strange, as when you install BASS.NET via the setup, all help files and samples are automatically installed.
Also note, that BASS.NET is the .Net wrapper for BASS and its add-ons - so the native BASS libs are still needed!

In addition please read the 'redme.txt' file contained in the installer download.

When using the start menu (as you already described) you'll also find the "BASS.NET API Offline Help" link - which will open the help file directly.

Here are some more infos out of the above mentioned 'readme.txt'...

The Bass.Net.dll release version is now installed in the specified <install-dir>
and will already be registered to the .NET Framework as a standard component (if you leave the installation options checked).
There are four Bass.Net versions deployed (each in a seperate sub-folder):
.\v2.0    : Bass.Net for .Net 2.0
.\v4.0    : Bass.Net for .Net 4.0
.\compact : Bass.Net CE for .Net CompactFramework 3.5
.\iphone  : Bass.Net iPhone for .Net CompactFramework 3.5
When writing your own application using BASS.NET you can simple add a new project reference and select the
appropriate "BASS.NET API" from the standard .NET components tab targeting your used .Net Framework version - that's all!
The native BASS libraries are NOT included here and need to be downloaded seperately.
In order to run the samples provided, you need to copy the relevant BASS libraries to the output directories first!
To uninstall BASS.NET simple go to the windows control panel and select software...and remove BASS.NET there.

INCLUDED/INSTALLED FILES
------------------------
\<install-dir>:
  LICENSE.rtf            : the BASS.NET API license file
  readme.txt             : setup and general information text file (this)
  .\v2.0
    Bass.Net.dll         : the BASS.NET API library (targeting the .Net Framework 2.0)
    Bass.Net.xml         : the BASS.NET API xml documentation file (needed for IntelliSense)
  .\v4.0
    Bass.Net.dll         : the BASS.NET API library (targeting the .Net Framework 4.0)
    Bass.Net.xml         : the BASS.NET API xml documentation file (needed for IntelliSense)
  .\compact
    Bass.Net.compact.dll : the BASS.NET CE API library (targeting the .Net CompactFramework 3.5)
    Bass.Net.compact.xml : the BASS.NET CE API xml documentation file (needed for IntelliSense)
  .\iphone
    Bass.Net.iphone.dll  : the BASS.NET iPhone API library (targeting the .Net CompactFramework 3.5, static '__Internal')
    Bass.Net.iphone.xml  : the BASS.NET iPhone API xml documentation file (needed for IntelliSense)
  .\Help
    Bass.Net.chm         : the actual MS Help 1.x offline help file for the BASS.NET API
    H2Reg.exe            : helpware.net utility allowing registering MS Help 2.x Collections (done during setup)
    *.Hx?                : the actual MS Help 2.x online help files which will be integrated into your Visual Studio 2005/2008environment
    HelpLibraryManagerLauncher.exe : HelpViewer utility allowing registering MS HelpViewer Collections (done during setup)
    *.msh?               : the actual MS HelpViewer online help files which will be integrated into your Visual Studio 2010 environment
    Install_Bass.Net_HelpVS2008.bat : shell script to manually install the Help 2.x files (to VS2005/2008)
    Remove_Bass.Net_HelpVS2008.bat : shell script to manually remove the Help 2.x files (from VS2005/2008)
    Install_Bass.Net_HelpVS2010.bat : shell script to manually install the HelpViewer files (to VS2010)
    Remove_Bass.Net_HelpVS2010.bat : shell script to manually remove the HelpViewer files (from VS2010)
\<AppUserData>\BASS.NET\Samples:
  .\CS                   : this folder contains all C# examples and a global solution for it (sample.sln)
  .\VB                   : this folder contains all VB examples and a global solution for it (sample.sln)


So as you can see, all the .Net samples are installed in your "\<AppUserData>\BASS.NET\Samples" directory (e.g. C:\Users\username\AppData\Roaming\BASS.NET\Samples).

Rakham01

  • Posts: 15
Re: VB.NET BASS_StreamCreateFile doesn't work?
« Reply #4 on: 20 Feb '12 - 10:20 »
Well, I tried to install BASS.NET with help files first, but allways got an error message, that "Application is missing..." or something like that. So I unchecked those checkboxes from installation, but thank's to your reply, I found those samples in folder "C:\Documents and Settings\username\Application Data\BASS.NET\Samples\VB\". I'm still using XP. Now I'll try to continue from here :)

Rakham01

  • Posts: 15
Re: VB.NET BASS_StreamCreateFile doesn't work?
« Reply #5 on: 20 Feb '12 - 10:34 »
I still get warning "The referenced project '..\..\..\Bass.Net.csproj' does not exist.   VB_MyFirstBass", but i'm able to open Solution Explorer and see the code in "VB_MYFirstBass". One question: If I use "Dim stream As Integer = Bass.BASS_StreamCreateFile("test.mp3", 0, 0, BASSFlag.BASS_DEFAULT)" to create the stream, do I still need those old "Declare Function BASS_StreamCreateFile64 Lib "bass.dll" Alias "BASS_StreamCreateFile" (ByVal mem As Long, ByVal file As Any, ByVal offset As Long, ByVal offsethigh As Long, ByVal length As Long, ByVal lengthhigh As Long, ByVal flags As Long) As Long" declarations and "Function BASS_StreamCreateFile" in some VB.NET module?
If I need, I'll have to change those "Long-types" to Integer.

radio42

  • Posts: 4574
Re: VB.NET BASS_StreamCreateFile doesn't work?
« Reply #6 on: 20 Feb '12 - 11:21 »
No, of course not.
VB.Net as absolutly nothing to do with 'older' VB apps!
So you should forget all the 'older' VB AI stuff as well.

The first errors you get during the installation are about installing integrated help systems for Visual Studio 2005 resp. 2010.
Ie. if you select to install a help system for a VS version you haven't installed on your system - you would get such errors.

I'll take a look to the 'referenced project not found' issue. Maybe there has been something broken for the VB samples....

Rakham01

  • Posts: 15
Re: VB.NET BASS_StreamCreateFile doesn't work?
« Reply #7 on: 20 Feb '12 - 11:39 »
So I should do this:

* remove old BASS.DLL declarations from VB.NET project, meaning that I sould remove the whole module with
those "Declare Function BASS_StreamCreateFile64 Lib "bass.dll" Alias..." and "Function BASS_StreamCreateFile.." definitions?
* include BASS.DLL and BASS.NET.DLL in \BIN\DEBUG folders? (That's where the BASS.DLL is right now)
* use BASS.NET.DLL functions by reference like "Dim stream As Integer = Bass.BASS_StreamCreateFile("test.mp3", 0, 0, BASSFlag.BASS_DEFAULT)" with "Bass." prefix?

I have been using .NET only for about a week, so I apologize this all.

Rakham01

  • Posts: 15
Re: VB.NET BASS_StreamCreateFile doesn't work?
« Reply #8 on: 20 Feb '12 - 14:30 »
Finally, BASS.NET works well, creating stream, opening, playing and stopping them.
Just had to call those functions little differently, than with BASS.DLL.
I'm soo-ooo glaaa-aaad  ;D