24 May '13 - 05:13 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Dynamic loading of Bass_FX, Bass_mix, Bass_enc...  (Read 1868 times)
fredvs
Posts: 327


« on: 23 Aug '11 - 20:48 »
Reply with quoteQuote

Hello Ian, hello everybody.
Is there a plan to give, like for Bass_dynamic.pas (pascal/delphi), dynamic headers for Bass_FX.pas, Bass_mix and Bass_enc ?

PS: Bass_dynamic.pas works perfectly for Windows, Linux and Mac OSX (compiled with Lazarus)... Wink
PS2: Dynamic loading allows you to choose the directory where Bass-libraries are stored and allows you to load-unload it when you need it...

Thanks

* lazarus_dynamic.zip (17.81 KB - downloaded 27 times.)
« Last Edit: 25 Aug '11 - 19:40 by fredvs » Logged
Wishmaster
Posts: 124


« Reply #1 on: 23 Aug '11 - 22:41 »
Reply with quoteQuote

 Wink

* Dynamics.rar (30.08 KB - downloaded 56 times.)
Logged
Ian @ un4seen
Administrator
Posts: 15270


« Reply #2 on: 24 Aug '11 - 14:31 »
Reply with quoteQuote

Nice Smiley

Would you mind if I put that package up on the BASS page?
Logged
fredvs
Posts: 327


« Reply #3 on: 24 Aug '11 - 19:04 »
Reply with quoteQuote

@ Wishmaster : you are great, many thanks.
Logged
Wishmaster
Posts: 124


« Reply #4 on: 24 Aug '11 - 22:46 »
Reply with quoteQuote

@ Ian
No, I do not mind!  You can do with it what you want! 

have fun  Wink
Logged
fredvs
Posts: 327


« Reply #5 on: 25 Aug '11 - 19:40 »
Reply with quoteQuote

Hello everybody.
The dynamics headers of Wishmaster are working for Delphi.
They do not work for Lazarus/FPC.
In attach : lazarus_dynamic_bass.pas is working perfectly for Windows, Linux and Mac OSX.
Sadly lazarus_dynamic_bassFX.pas is only working for Windows  Cry
Is there a king who can see what goes wrong with lazarus_dynamic_bassFX.pas and why it do not work for Linux and Mac OSX  Embarrassed
Many thanks

* lazarus_dynamic.zip (17.81 KB - downloaded 35 times.)
Logged
Wishmaster
Posts: 124


« Reply #6 on: 30 Aug '11 - 03:56 »
Reply with quoteQuote

Hi

@fredvs   I've never used Lazarus / FPC So I have no idea why it does not work Huh


Here is an update for bass Dynamics

* Dynamics.rar (37.62 KB - downloaded 26 times.)
Logged
fredvs
Posts: 327


« Reply #7 on: 30 Aug '11 - 16:15 »
Reply with quoteQuote

@ Wishmaster
If you are a Delphi user, it could be a good idea to try Lazarus.
All your Delphi codes must be working with Lazarus and it opens for you, with the same code, the world of Linux, Mac OSX, Iphones, Arm, Windows, and much other OS... Wink


« Last Edit: 30 Aug '11 - 18:17 by fredvs » Logged
Wishmaster
Posts: 124


« Reply #8 on: 18 Jul '12 - 03:33 »
Reply with quoteQuote

hi

Here is an update for bass Dynamics! Please test the Lib's

I have noticed that people with older Delphi versions (delphi 7) have problems with

BASS_WASAPI_DEVICEINFO = record
...
 &type : DWORD;   // Error
...
end

[Bug] Dynamic_WASAPI.pas (56): Invalid character in input file: '&' ($ 26)


@ Ian

1. why is BASSWASAPI still a beta?
2. there are some undocumented flags (in bass.dll) like...
    BASS_CONFIG_REC_LOOPBACK and BASS_DEVICE_LOOPBACK
    Are they still use?






* bass24-delphidyn.rar (42.25 KB - downloaded 21 times.)
Logged
Ian @ un4seen
Administrator
Posts: 15270


« Reply #9 on: 18 Jul '12 - 17:29 »
Reply with quoteQuote

1. why is BASSWASAPI still a beta?

No particular reason. It probably is about time for it to be removed from "beta", but you just know a bug will appear straight after Smiley

2. there are some undocumented flags (in bass.dll) like...
    BASS_CONFIG_REC_LOOPBACK and BASS_DEVICE_LOOPBACK
    Are they still use?

Yes, the loopback recording option is currently still present in BASS.DLL. It will probably remain so at least until the next major version update.
Logged
Martin Kuhn
Posts: 9


« Reply #10 on: 2 Sep '12 - 05:58 »
Reply with quoteQuote

Hello Wishmaster
a) bass_aac.dll is missing as dynamic loading version.
Would it be possible to include it into an update the dynamic wrapper package?

b) Would it be possible to add a short ReadMe.txt to the package
- Target: Whats the advantage of using the dynamic version instead the static one
- Usage: Which codelines have to be added to load dynamically and where (example of usage)


this would really be great!

best regards to you, my german speaking friend
Martin
Logged
Wishmaster
Posts: 124


« Reply #11 on: 2 Sep '12 - 23:14 »
Reply with quoteQuote

Hi, Martin

Quote
a) bass_aac.dll is missing as dynamic loading version.

there was no reason for a dynamic version because it is a Plug-in. so you can use BASS_PluginLoad(...) to load it
but if you really need it. I can add it Wink

Quote
Whats the advantage of using the dynamic version instead the static one

Let's now compare static and dynamic DLL loading to see what are advantages and disadvantages of both.

Static loading PROS:

    More easy for a beginner developer, no "ugly" API calls.
    DLLs loaded once, when the program starts.

Static loading CONS:


    The application will NOT start if any DLLs are missing (cannot be found). When you run the program you will see an ugly message: "This application has failed to start because 'missing.dll' was not found. Re-installingn the application may fix this problem".
    By design the DLL search order with static linking includes: the directory from which the application loaded, the system directory, the Windows directory, directories listed in the PATH environment variable.
    Note also that the search order might be different for various Windows versions.
    The safest is to always expect to have all the DLLs in the directory where the calling application is.
    More memory used, as all DLLs are loaded even if you will not use some of the functions.

Dynamic loading PROS:

    You can run your program even when some of the libraries it uses are not present.
    Smaller memory consumption - DLLs used when needed.
    You can specify the full path to the DLL.
    Use for functionality that is rarely needed by the application.
    Could be used for modular applications. The application only exposes (loads) modules (dlls) "approved" for the user.
    The ability to load and unload library dynamically, is the foundation of a plug-in system that allow a developer to add extra functionality to programs.
    Backwards compatibility with older Windows versions, in which system dlls may not support the same functions or in the same way. Detecting the Windows version first, then dynamic linking based on what your app is running on, allows you to support more versions of Windows and provide work arounds for older OSs, or at the very least gracefully disabling features you can't support.

Dynamic loading CONS:


    Requires more code, not trivial for a beginner developer.


I hope differences are clear and that you will know what type of DLL loading to use for your next project Wink
If you think some PROS or CONS are missing, feel free to let me know - I'll add it to the list.

Quote
Which codelines have to be added to load dynamically and where (example of usage)

In each unit there are two functions one for loading and the other for unloading


in Delphi you can use as following

(* bass plugin's *)
const
   BASS_DLL        = 1;
   BASS_WASAPI_DLL = 2;
   BASS_ASIO_DLL   = 3;

 var
   Bass_dll_Loaded : Array [1..3] of Boolean;

Procedure Bass_Load(Path : Widestring):
begin

   Bass_dll_Loaded[BASS_DLL]:= Load_BASSDLL(Path + 'bass.dll');
  if Bass_dll_Loaded[BASS_DLL] then
   begin
    If (HiWord(BASS_GetVersion()) <> BASSVERSION) then
     begin
      Bass_UnLoad();
      exit;
     end;
   end;


   Bass_dll_Loaded[BASS_WASAPI_DLL]:= Load_WASAPIDLL(Path + 'basswasapi.dll');
   Bass_dll_Loaded[BASS_ASIO_DLL]:= Load_ASIODLL(Path + 'bassasio.dll');


  // init bass

end;


procedure Bass_UnLoad();
begin
 (* free all WASAPI Input Device's *)
 (* free all ASIO Input Device's *)

 (* free all plugins. *)
  BASS_PluginFree(0);

 (* UnLoad Plugin's Dynamic *)
  Unload_WASAPIDLL();   Bass_dll_Loaded[BASS_WASAPI_DLL]:= false;
  Unload_ASIODLL();     Bass_dll_Loaded[BASS_ASIO_DLL]:= false;
  Unload_BASSDLL();     Bass_dll_Loaded[BASS_DLL]:= false;
end;




or

if not Load_WASAPIDLL(Path + 'basswasapi.dll') the
  // Failed to load the basswasapi DLL





Logged
Martin Kuhn
Posts: 9


« Reply #12 on: 3 Sep '12 - 04:35 »
Reply with quoteQuote

Thank you,
as far as i can see, perfectly explained (of course i will try that in my code...)

best regards
Martin
Logged
Wishmaster
Posts: 124


« Reply #13 on: 4 Sep '12 - 04:50 »
Reply with quoteQuote

hi

Here is the update for bass Dynamics! Please test the Lib's Especially with Linux and Mac OS

Quote
Sadly lazarus_dynamic_bassFX.pas is only working for Windows


@fredvs
What does not work, is it not load the bass_fx.dll? or does it give you back an error code
when you use the bass_fx functions?

I installed OpenSUSE/KDE and Lazarus in VMware Workstation. unfortunately It crashed on me every time I tried to save.
so i could not test it on Linux.


* bass24-delphidyn.rar (75.07 KB - downloaded 22 times.)
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines