19 May '13 - 06: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: Library path allocation in bass_ofr.dll and bass_tak.dll  (Read 1424 times)
CoRoNe
Posts: 13


« on: 5 Feb '12 - 12:07 »
Reply with quoteQuote

Hello,

First I have to say, Bass is a wonderful piece of software and normally I don't need to visit your forum because the software I'm using that uses Bass has been working fine... up until now. And I really regret I don't have the programming skills to find a solution for it.
I'm using the DC-Bass Source Filter to play a lot of Bass supported formats through DirectShow. This one is working just fine and isn't of any concern here now.

I'm also using BassAudio, which is a wrapper for Bass and additional libraries meant to function as a sourcefilter of Bass supported formats in Avisynth. Nowadays however, it's issued with BeHappy, which is an AviSynth based audio transcoding tool.
This wrapper is working great. I can load every Bass supported format in Avisynth, (flac,wv,ape,tta, heck even cd's; BassAudioSource("E:\Track01.cda")), except for OptimFROG (*.ofr) and TAK Audio (*.tak), which are also the only formats that require an external library; OptimFROG.dll and tak_deco_lib.dll. See http://forum.doom9.org/showthread.php?p=1555525#post1555525, where I already discussed this issue.
As you can see in tebasuna51 (who I believe has taken over development of BassAudio from dimzon) his last post, putting OptimFROG.dll and tak_deco_lib.dll in the Windows\system32 directory is the only way for it to work and that it's actually the source of bass_ofr and bass_tak I have to approach in order for BassAudio to open ofr- and tak-files with OptimFROG.dll and tak_deco_lib.dll in the same directory as bass.dll and bass_*.dll.
Now I was wondering what anyone of you people here have to say about this issue and if you think it's really an issue with bass_ofr and bass_tak.
Again, I really wished I had finished my computer informatics education, because now I don't have the programming skills to look into it myself.

Anxiously awaiting your reply,

Reino
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #1 on: 6 Feb '12 - 14:50 »
Reply with quoteQuote

I think placing those DLLs in the same folder as the app's EXE file should work. Putting them in the Windows folder is generally not a good idea (if multiple apps do that there could be version conflicts).
Logged
CoRoNe
Posts: 13


« Reply #2 on: 6 Feb '12 - 16:30 »
Reply with quoteQuote

I see...hmm. That seems to work as well indeed.
Are you people a bit familiar with Avisynth scripts?
Loadplugin("D:\BeHappy 0.2.5.30809\plugins(updated)\BassAudio.dll")

#BassAudioSource("D:\TEST files\Audio\Across the River_sample(2ch).wv")
#BassAudioSource("D:\TEST files\Audio\Across the River_sample(2ch).ofr")
BassAudioSource("D:\TEST files\Audio\Across the River_sample(2ch).tak")
(BassAudio.dll, bass.dll, bass_*.dll, OptimFROG.dll and tak_deco_lib.dll are all in that same directory)
Copy-pasting this in notepad, saving it as an avs-file and feeding it to a DirectShow mediaplayer, like MPC-HC or Zoom Player, will in this case result in the tak-file being played through DirectShow. But only if tak_deco_lib.dll (which bass_tak.dll needs) resides in either the Windows/System32 dir or in the same directory as MPC-HC. This of course isn't really practical, because if I would open the avs-file in Zoom Player for instance, I would have to move OptimFROG.dll and tak_deco_lib.dll to it's directory, or of course keep them in the Windows/System32 dir, but I see you don't encourage that for obvious reasons.
So a short version of my previous post: Is it possible to change bass_ofr.dll and bass_tak.dll so they accept OptimFROG.dll and tak_deco_lib.dll in their own directory?

Dcoder (author of DC-Bass Source Filter) also faced this issue when he added OptimFROG support to his DirectShow filter. He made a workaround for it with functions like WideLastDelimiter, WideExtractFilePath, WideExtractFileExt and GetFilterDirectory. That way OptimFROG.dll can reside in the same directory and playing ofr-files works perfectly. If you want to have a look, it's in BassDecoder.pass in DCBassSource_v1.30_Source.zip. This isn't C++ of course, but Delphi, but I thought I'd mention it away.
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #3 on: 7 Feb '12 - 17:08 »
Reply with quoteQuote

So a short version of my previous post: Is it possible to change bass_ofr.dll and bass_tak.dll so they accept OptimFROG.dll and tak_deco_lib.dll in their own directory?

The DLL search path is described here...

   http://msdn.microsoft.com/en-us/library/7d83bc18.aspx

To load a DLL from a different path, dynamic loading (eg. LoadLibrary) would need to be used, requesting the different path. Besides modifying the add-on (eg. bass_ofr.dll) to do that, another option would be to dynamically load the DLL yourself, eg. load OptimFROG.dll before loading bass_ofr.dll, so that OptimFROG.dll is already in memory when bass_ofr.dll asks for it.
Logged
CoRoNe
Posts: 13


« Reply #4 on: 7 Feb '12 - 20:37 »
Reply with quoteQuote

After a bit of searching I found: Doom9's Forum - Loading External .dll into AviSynth (LoadDll Plugin Inside).

LoadDll("D:\BeHappy 0.2.5.30809\plugins(updated)\OptimFROG.dll")
LoadDll("D:\BeHappy 0.2.5.30809\plugins(updated)\tak_deco_lib.dll")
Loadplugin("D:\BeHappy 0.2.5.30809\plugins(updated)\BassAudio.dll")

#BassAudioSource("D:\TEST files\Audio\Across the River_sample(2ch).wv")
#BassAudioSource("D:\TEST files\Audio\Across the River_sample(2ch).ofr")
BassAudioSource("D:\TEST files\Audio\Across the River_sample(2ch).tak")
This seems to be working great, but I don't like the idea. Needing an additional plugin for something the initial plugin ought to be doing in the first place. I don't understand why searching for external dlls in the plugin's own directory isn't considered normal.

As I already mentioned, I really regret I don't have the skills to look into that myself, so if someone else could have a look at bass_ofr and bass_tak, I would really appreciate it!!
Thanks for your input so far, Ian.
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #5 on: 8 Feb '12 - 17:05 »
Reply with quoteQuote

The secondary DLLs aren't found by Windows because the "plugins" directory isn't in its DLL search path (see the link above). The only way to load the DLLs from there is to load them dynamically, or set the current directory beforehand. The latter may be more convenient in this case. Does BassAudio.dll load all add-ons that it finds in the "plugins" directory? If so, perhaps it could set the current directory to the "plugins" directory before doing that (and then restore the previous setting afterwards).
Logged
CoRoNe
Posts: 13


« Reply #6 on: 9 Feb '12 - 18:14 »
Reply with quoteQuote

A bit annoying this issue goes across forums, but you could please read from here: http://forum.doom9.org/showthread.php?p=1556800#post1556800
Because the "plugins" directory isn't in the DLL search path, BassAudio has the same issue.
Would it be a lot of effort to modify bass_ofr.dll and bass_tak.dll accordingly?

P.s. Could you tell me why bass_tak isn't listed between the Bass add-ons?
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #7 on: 10 Feb '12 - 15:15 »
Reply with quoteQuote

A bit annoying this issue goes across forums, but you could please read from here: http://forum.doom9.org/showthread.php?p=1556800#post1556800
Because the "plugins" directory isn't in the DLL search path, BassAudio has the same issue.
Would it be a lot of effort to modify bass_ofr.dll and bass_tak.dll accordingly?

It would mean changing the way that the secondary DLLs are loaded, ie. dynamically loading them and importing the functions, rather than simply leaving that to Windows as is normally done. Note the error message that you're currently seeing is displayed by Windows rather than BASS_OFR/TAK (BASS_OFR/TAK code won't be executed before Windows has loaded the needed DLLs).

I think it would be far simpler/better to make a small modification to the BassAudio.DLL, to have it set the current directory before loading the BASS add-ons, something like this...

char dir[MAX_PATH];
GetCurrentDirectory(sizeof(dir), dir); // get current directory
SetCurrentDirectory(...);  // set current directory to the plugins directory
// load BASS add-ons via BASS_PluginLoad here
SetCurrentDirectory(dir); // restore current directory

P.s. Could you tell me why bass_tak isn't listed between the Bass add-ons?

I wasn't actually aware that there was a BASS_TAK add-on Smiley

It must have been created by a 3rd-party. Do you have a link for it?
Logged
CoRoNe
Posts: 13


« Reply #8 on: 10 Feb '12 - 17:13 »
Reply with quoteQuote

I wasn't aware of it either, but I thought if someone can make a DirectShow filter around tak_deco_lib.dll, perhaps someone could've created bass_tak.dll as well. And after a bit of googling...voila!
Downloadlinks here: http://forum.doom9.org/showthread.php?p=1555525#post1555525

I'll pass on your suggestion and hope tebasuna51 can work it out somehow.
Thanks a lot for your help, Ian!

[edit]No luck. BassAudio can't do it. Luckily there are a few workarounds available.[/edit]
« Last Edit: 11 Feb '12 - 21:11 by CoRoNe » Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines