|
Post by (X) on Apr 24, 2021 16:20:43 GMT 1
Here is my attempt at putting all BASS functionality into one GFA library file.
The following - previously submitted - demo is now "lighter" because I import the BASS functionality with the "BASS.inc.LG32" file. Of course I have not tested this code exhaustively, so, problems may still lie in wait. See this link for a demo:
See the last post for the latest and most up to date version of the library file.
How was this done?
In order to adapt VB5 code to GFA there are several modifications that need to be done. For example a Type declaration in VB5 like: Type Data as Long EndType Does not work in GFA because 'Data' is recognized as a reserved name. If you change the GFA code to: Type -Long data EndType This will pass.
|
|
|
Post by wbtcpip on Apr 24, 2021 17:10:09 GMT 1
all the "64" ending functions are unnecessary because GFA has Large variable ... exemple:
Declare Function BASS_StreamCreateFile Lib "bass.dll" (ByVal mem As Int, ByVal file As Int, ByVal offset As Large, ByVal length As Large, ByVal flags As Int) As Int Declare Function BASS_ChannelBytes2Seconds Lib "bass.dll" (ByVal handle As Int, ByVal pos As Large) As Double Declare Function BASS_ChannelSeconds2Bytes Lib "bass.dll" (ByVal handle As Int, ByVal pos As Double) As Large Declare Function BASS_ChannelSetPosition Lib "bass.dll" (ByVal handle As Int, ByVal pos As Large, ByVal mode As Int) As Int Declare Function BASS_ChannelGetPosition Lib "bass.dll" (ByVal handle As Int, ByVal mode As Int) As Large Declare Function BASS_ChannelSetSync Lib "bass.dll" (ByVal handle As Int, ByVal type_ As Int, ByVal param As Large, ByVal proc As Int, ByVal user As Int) As Int
|
|
|
Post by (X) on Apr 24, 2021 21:19:48 GMT 1
all the "64" ending functions are unnecessary because GFA has Large variable ... exemple: Declare Function BASS_StreamCreateFile Lib "bass.dll" (ByVal mem As Int, ByVal file As Int, ByVal offset As Large, ByVal length As Large, ByVal flags As Int) As Int Declare Function BASS_ChannelBytes2Seconds Lib "bass.dll" (ByVal handle As Int, ByVal pos As Large) As Double Declare Function BASS_ChannelSeconds2Bytes Lib "bass.dll" (ByVal handle As Int, ByVal pos As Double) As Large Declare Function BASS_ChannelSetPosition Lib "bass.dll" (ByVal handle As Int, ByVal pos As Large, ByVal mode As Int) As Int Declare Function BASS_ChannelGetPosition Lib "bass.dll" (ByVal handle As Int, ByVal mode As Int) As Large Declare Function BASS_ChannelSetSync Lib "bass.dll" (ByVal handle As Int, ByVal type_ As Int, ByVal param As Large, ByVal proc As Int, ByVal user As Int) As Int
I am amending the listing as per your suggestions...
|
|
|
Post by (X) on May 3, 2021 11:20:42 GMT 1
In this update of "BASS.inc.G32", I have replaced all
"ByRef <var name> as Any"
with
"ByVal <var name> As Int32".
I kept a commented copy of the original statement above each change.
( I found this works by trial and error. If someone has a better solution, please let me know.)
See the last post for the latest and most up to date version of the library file.
|
|
|
Post by (X) on May 4, 2021 12:11:09 GMT 1
For variable type declarations, I used GFA's type shorthand to replace most if not all long hand notation:
I replaced: "<var> As Int32" with "<var>%" , "<var> as Single" with "<var>!" , "<var> as Word" with "<var>&" and "<var> as Byte" with "<var>|" .
This has the effect of shortening the line lengths considerably and makes it more readable.
|
|
|
Post by rogercabo on May 18, 2021 15:43:43 GMT 1
I used GFA's variable type shorthand for Int32 variables and parameters and replaced most if not all "<var> As Int32" with "<var>%".
I also did the same for the variables of type: "<var> as Single" -> '!' and "<var> as Byte" -> '|'. Thanks for the cool implementation. Some of the LO/HI function exist already in Gb32 and they are a lot faster. They use fast shifting.. HiCard(), HiWord(), LoByte(), LoCard(), LoWord(), HiLarge() .. etc.. These available GB32 functions are about 100-200 times faster.. MakeWord() also exist.
Is there any special reason why you add these functions into the inc.g32?
$StepOff
Dim t# = Timer Dim l%, i% Dim p% = &x0000000000000010
For i% = 0 To 100000 l% = Lo_Byte(p) l% = Lo_Byte(p) l% = Lo_Byte(p) l% = Lo_Byte(p) l% = Lo_Byte(p) l% = Lo_Byte(p) l% = Lo_Byte(p) l% = Lo_Byte(p) l% = Lo_Byte(p) l% = Lo_Byte(p) Next i% MsgBox Timer - t & " lowbyte:" & l%
Dim t# = Timer For i% = 0 To 100000 l% = LoByte(p) l% = LoByte(p) l% = LoByte(p) l% = LoByte(p) l% = LoByte(p) l% = LoByte(p) l% = LoByte(p) l% = LoByte(p) l% = LoByte(p) l% = LoByte(p) Next i% MsgBox Timer - t & " lowbyte:" & l%
Function Lo_Byte(ByVal lparam%) As Long Lo_Byte = lparam And $FF End Function
|
|
|
Post by (X) on May 18, 2021 19:38:37 GMT 1
The Hi_... and Lo_... functions were in the original VB5 code module, so I just included them as helper functions in the BASS.inc library without checking if GFA had anything like it. We could remove them entirely from the BASS.inc file and rely on GFA's built-in versions instead. The same goes for any "get string from an address pointer" function which in GFA, we can use the CharPeek command. (Though there is mention of ANSI vs UNICODE strings that I do not completely understand how to handle.) I am presently working on a way to populate a ListView to let the user view and possibly modify over a dozen configuration settings. (The first line is the way I want it to look. I am working on a generic function that will take minimum effort to Add or Modify the settings.)
|
|
|
Post by (X) on Jun 21, 2021 2:57:13 GMT 1
This is the latest version:
|
|
joe
New Member
Posts: 5
|
Post by joe on Aug 3, 2021 15:57:20 GMT 1
hi could someone write a simple example program that uses bass.dll to play 2 mp3s at the same time?
|
|
|
Post by (X) on Aug 4, 2021 17:40:07 GMT 1
|
|