Author Topic: BASS.NET API 2.4.12.7  (Read 783457 times)

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #300 on: 30 Dec '07 - 20:33 »
Because.......  ;D

Since I am porting I just left it as an int.


I will change and see

Thanks

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #301 on: 30 Dec '07 - 23:56 »
Well, that is slightly better. Some colors after about one minute it fades to white then crashes.

I have reverified my port of the VB.NET example line by pain staking line and can't imagine what could be wrong.
Unless there is some subtle difference in the use of int and IntPtr for Window handles

Actually, it has to be related to the window handles, I am just stumped.

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #302 on: 31 Dec '07 - 00:19 »
IntPtr = not Int32 ??

greets BassFan


No they are not the same.

BassFan

  • Guest
Re: BASS .NET API 2.4.0.0 beta!
« Reply #303 on: 31 Dec '07 - 01:53 »
Well, that is slightly better. Some colors after about one minute it fades to white then crashes.

I have reverified my port of the VB.NET example line by pain staking line and can't imagine what could be wrong.
Unless there is some subtle difference in the use of int and IntPtr for Window handles

Actually, it has to be related to the window handles, I am just stumped.

only what i can do for you
send me this sample over VisTeam@arcor.de that i can show what is wrong under XP
that is all

no code nothing can do for you ;)

greets BassFan

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #304 on: 31 Dec '07 - 02:36 »
BassFan,

I just emailed you my project, I hope that is what you mean't

Thanks,

Steve

BassFan

  • Guest
Re: BASS .NET API 2.4.0.0 beta!
« Reply #305 on: 31 Dec '07 - 12:44 »
BassFan,

I just emailed you my project, I hope that is what you mean't

Thanks,

Steve

ok i have compile your Source with VS 2005 and send only the EXE to MikaelS
MikaelS tell me AVS work under Vista with no problem

think you have a problem with resources ..

Ram, CPU, or what ever

greets BassFan

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #306 on: 31 Dec '07 - 17:19 »
Hum...

Okay when I get home I will reboot and try again.

Maybe something got hosed when I was treating int and IntPtr's the same.

Thanks

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #307 on: 31 Dec '07 - 22:15 »
BassFan,

I just emailed you my project, I hope that is what you mean't

Thanks,

Steve

ok i have compile your Source with VS 2005 and send only the EXE to MikaelS
MikaelS tell me AVS work under Vista with no problem

think you have a problem with resources ..

Ram, CPU, or what ever

greets BassFan

BassFan,

Can you send me the exe that you sent MikaelS?

Mine doesn't work on XP or Vista.

Maybe it is an issue with VS 2008

BassFan

  • Guest
Re: BASS .NET API 2.4.0.0 beta!
« Reply #308 on: 31 Dec '07 - 23:08 »
BassFan,

I just emailed you my project, I hope that is what you mean't

Thanks,

Steve

ok i have compile your Source with VS 2005 and send only the EXE to MikaelS
MikaelS tell me AVS work under Vista with no problem

think you have a problem with resources ..

Ram, CPU, or what ever

greets BassFan

BassFan,

Can you send me the exe that you sent MikaelS?

Mine doesn't work on XP or Vista.

Maybe it is an issue with VS 2008


yes no problem ;)

greets

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #309 on: 1 Jan '08 - 00:23 »
Okay,

Your exe works great on XP and for a while on Vista.
There must be something wrong with my Vista box.


I also ported my project to VS 2005 but my exe still didn't work on XP nor Vista.

Could you send me the whole project you converted. I must have some project setting wrong.
This is insane.

Thanks for your efforts

BassFan

  • Guest
Re: BASS .NET API 2.4.0.0 beta!
« Reply #310 on: 1 Jan '08 - 01:01 »
Okay,

Your exe works great on XP and for a while on Vista.
There must be something wrong with my Vista box.


I also ported my project to VS 2005 but my exe still didn't work on XP nor Vista.

Could you send me the whole project you converted. I must have some project setting wrong.
This is insane.

Thanks for your efforts

Yes i send then your code back ... ;)
please when finish i will insert to the Archive of BassVis Ok ?

greets BassFan

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #311 on: 1 Jan '08 - 06:30 »
Sure not problem let me clean it up a bit if you don't mind.

BassFan

  • Guest
Re: BASS .NET API 2.4.0.0 beta!
« Reply #312 on: 1 Jan '08 - 12:14 »
Sure not problem let me clean it up a bit if you don't mind.

i have time enough no problem ;)

greets BassFan

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #313 on: 1 Jan '08 - 16:27 »
BassFan,

I have been goolgling my Vista problem which is precisely:

Code: [Select]
attempted to read or write protected memory

LoaderLock was detected
Message: Attempting managed execution inside OS Loader lock.
Do not attempt to run managed code inside a DllMain or image
initialization function since doing so can cause the application to hang.

It happens when I make the following class only on a Winamp plugin:

BassVis.BASS_VIS_ExecutePlugin(mExec, mVisParam);



Seems to be a problem when you have both VS2005 and VS2008 installed at the same time.

I haven't found a solution yet other than to format and reinstall excluding VS2008.

Lot's of people are having this problem. I recompiled the project you sent back to me and the problem came
back which is consistent which my Google findings.

I don't want to reinstall or remove VS2008..... but I will continue to Google for now.....

 >:( Vista and their new secure protected nonsense..........
« Last Edit: 1 Jan '08 - 16:29 by smesser »

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #314 on: 1 Jan '08 - 16:30 »
BassFan,

I have been Googling my Vista problem which is precisely:

Code: [Select]
attempted to read or write protected memory

LoaderLock was detected
Message: Attempting managed execution inside OS Loader lock.
Do not attempt to run managed code inside a DllMain or image
initialization function since doing so can cause the application to hang.

It happens when I make the following class only on a Winamp plugin:

BassVis.BASS_VIS_ExecutePlugin(mExec, mVisParam);



Seems to be a problem when you have both VS2005 and VS2008 installed at the same time.

I haven't found a solution yet other than to format and reinstall excluding VS2008.

Lot's of people are having this problem. I recompiled the project you sent back to me and the problem came
back which is consistent which my Google findings.

I don't want to reinstall or remove VS2008..... but I will continue to Google for now.....

 >:( Vista and their new secure protected nonsense..........

BassFan

  • Guest
Re: BASS .NET API 2.4.0.0 beta!
« Reply #315 on: 1 Jan '08 - 19:08 »
you can deactivate LoaderLock in the Debugger option ;)

Debugger .. Managed Debugging Assistants
Deactivate LoaderLock ;)

greets BassFan

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #316 on: 1 Jan '08 - 22:14 »
Yeah, I already tried that, it still has a problem.

Code: [Select]
   at System.Windows.Forms.SafeNativeMethods.GetWindowTextLength(HandleRef hWnd)
   at System.Windows.Forms.Control.get_WindowText()
   at System.Windows.Forms.Form.get_WindowText()
   at System.Windows.Forms.Control.set_CacheTextInternal(Boolean value)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmEraseBkgnd(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.SafeNativeMethods.DrawThemeParentBackground(HandleRef hwnd, HandleRef hdc, COMRECT prc)
   at System.Windows.Forms.VisualStyles.VisualStyleRenderer.DrawParentBackground(IDeviceContext dc, Rectangle bounds, Control childControl)
   at System.Windows.Forms.ButtonRenderer.DrawParentBackground(Graphics g, Rectangle bounds, Control childControl)
   at System.Windows.Forms.ButtonInternal.ButtonStandardAdapter.PaintThemedButtonBackground(PaintEventArgs e, Rectangle bounds, Boolean up)
   at System.Windows.Forms.ButtonInternal.ButtonStandardAdapter.PaintWorker(PaintEventArgs e, Boolean up, CheckState state)
   at System.Windows.Forms.ButtonInternal.ButtonStandardAdapter.PaintUp(PaintEventArgs e, CheckState state)
   at System.Windows.Forms.ButtonInternal.ButtonStandardAdapter.PaintOver(PaintEventArgs e, CheckState state)
   at System.Windows.Forms.ButtonInternal.ButtonBaseAdapter.Paint(PaintEventArgs pevent)
   at System.Windows.Forms.ButtonBase.OnPaint(PaintEventArgs pevent)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at Un4seen.Bass.AddOn.Vis.BassVis.BASS_VIS_ExecutePlugin(BASS_VIS_EXEC exec, BASS_VIS_PARAM param)
   at BassVisExample.Form1.cmdStartVis_Click(Object sender, EventArgs e) in D:\C#\BassVisExample\Form1.cs:line 681
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at BassVisExample.Program.Main() in D:\C#\BassVisExample\Program.cs:line 18
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

I found this quite interesting

Code: [Select]
Most of the time you will not see this kind of an error with purely .NET code.
The CLR was designed to avoid these situations with developer code. However, when
you go beyond purely managed code, an invalid pointer is what causes this problem.
This can happen when you pass a pointer to an API. If the pointer is null (the address is 0),
you will almost always get this error (assuming the unmanaged code doesn't crash first). If
he pointer contains an address value that is outside the allocated memory range for the app,
or is in the range reserved for OS usage, then you will also get the error. Additionally, you can
map memory with different access levels (actually, as a .NET programmer, you usually don't, but
some other unmanaged code might). If your process doesn't have "read" access to that mapped
memory range, you'll also get this error.

In short, most of the time it's a bug with your code trying to use unmanaged code (passing
something by value instead of by ref, or passing a null pointer, or something to that effect),
or it's a bug in a 3rd party unmanaged library (even possibly a driver depending on what kind
of code we're interacting with here).



The reason that this is interseting at the call that is failing is using null IntPtr's.

The call that fails is BassVis.BASS_VIS_ExecutePlugin(mExec, mVisParam) in the ;

If I look at the values of mVisParam just before the call are all zero.

I also found this on a Microsoft newsgroup

Code: [Select]
This is honestly a brutal class of problems to diagnose because they're only present
when you don't have debug information. Some suggestions:

Try turning on all optimizations, run the program under the debugger, and see if the error occurs.
(Typically all optimizations are turned off in debug mode so that debugging is easier.) This will at
least give you a way to reproduce the error when you have more debug information. This honestly
won't help you a whole lot because by the time you crash, the method call that corrupted the
memory is long gone.
Look at all unmanaged code that you're calling: COM objects, C/C++ DLLs, Win32 calls, etc. Check
the P/Invoke signatures and COM interop thunks for all unmanaged code to verify that they're correct.
Don't trust P/Invoke signatures that you find on the 'net. They're not always correct. Verify for yourself
that your data types and parameter orderings are correct.

Try removing the unmanaged code (stub out the calls) and see if the problem goes away. If it does,
investigate the component to verify that it is free of memory leaks. (Note that you might only be masking
the problem as you re-arrange code.)
Try running your code under a unmanaged memory checker like Compuware BoundsChecker, which will look for memory leaks and access violations. This will likely give you some hints as to which unmanaged component is misbehaving.

To sum it up I believe (IMO) that installing .net 3.5 which forces .net 2.0 SP1 inposes some new restraints on
the way you are allowed to called functions using P/Invoke. As more and more people switch to Vista (if they switch..) we start to see this problem more and more. My Googling found 100's of circumstances like the one
I am experiencing.

Note: This is my interpretation of my findings, it may or may not reflect anyone's reality other than my own  ;)
« Last Edit: 1 Jan '08 - 22:16 by smesser »

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #317 on: 2 Jan '08 - 15:14 »
Bernd and MikaelS,

Futhermore I set up a new XP machine with only VS2005 build the exe and ran it.

It works fine for a while but having let a sonique visual run over night it eventually stops responding.
If I let the dephi exe run on the same machine using the same Sonique visual it runs great overnight.

I would have to assume at this point there is problem in the BassVis wrapper since the Delphi exe doesn't use it.

MikaelS, if you could run that exe that BassFan sent you overnight you could either verify or refute my theory.

I also read that VB and C# doesn't marshall data the same. Just a thought

radio42

  • Posts: 4576
Re: BASS .NET API 2.4.0.0 beta!
« Reply #318 on: 2 Jan '08 - 15:36 »
I don't really believe, that this is a BASS.NET issue.
Since if a plugin is working correctly and all of a sudden (without calling any additional function just stops responding) - I would know what to do.

So the only real difference (which might cause any of such problems) might be the .Net Garbage Collector.
But that would mean, that any parameter data given to BASS_VIS would be used even after the method returns...and such BASS_VIS would rely on any pointer still pointing to the same memory location even after the method was called.
But this is out of the of the scope of BASS.NET and I don't know what to do.

What you can try (to see, if it is a Garbage Collector thing) is the following:
Setup a timer and call "GC.Collect()" every so often, e.g. every 5 seconds.
If the problem now happens much earlier, e.g. after 10 seconds - then it is a GC issue!

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #319 on: 2 Jan '08 - 16:35 »
Bernd,

I will try that once I get home as my machine at work is set up the same as my main dev machine at home.

It doesn't really make sense to me, if it were a garabage collection issue what could I do?

--Steve

radio42

  • Posts: 4576
Re: BASS .NET API 2.4.0.0 beta!
« Reply #320 on: 2 Jan '08 - 17:06 »
If it is a Garbage Collection thing there is nothing we/you could do.
But...BassFan might be, by not referencing the memory given in the params directly, but making a copy of them for his local use first. But I am not sure, if it is really a GC thing - as it should be!

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta!
« Reply #321 on: 2 Jan '08 - 19:39 »
Okay I understand. That makes sense, well all theories do until you prove them wrong  ;)

radio42

  • Posts: 4576
Re: BASS .NET API 2.4.0.0 beta!
« Reply #322 on: 8 Jan '08 - 17:17 »
Ian has added a new BASS_ENCODE_FP_32BIT flag to "BASSenc".
So make sure to use the new BASS.NET version with the latest BASSenc add-on!!!

So an update of BASS.NET in on the page (in the official BASS 2.4 beta post).

Or you might find the new version right here...
Lib only:
  www.un4seen.com/filez/4/Bass24.Net_beta.zip
Installer:
  www.un4seen.com/filez/4/Bass24.Net.zip

smesser

  • Posts: 122
Re: BASS .NET API 2.4.0.0 beta! and BASS FX 2.4 beta
« Reply #323 on: 21 Jan '08 - 15:38 »
I am trying to create a Winamp like preamp using BASS FX and BASS_BFX_VOLUME.

I have used the search button  :) and read the help files.

I don't know if it makes a difference but I am using this along with a 10 band BASS_DX8_PARAMEQ EQ.
No matter what I have tried I can't get the following code to alter the sound at all. I can't imagine what
I am doing wrong.

Here is my code.

Code: [Select]
// Variable
private BASS_BFX_VOLUME FxVolume;


Code: [Select]
fx[(int)Bands.PREAMP] = Bass.BASS_ChannelSetFX(channel, BASSFXType.BASS_FX_BFX_VOLUME, 1);
Code: [Select]
channel = Bass.BASS_StreamCreateFile(StreamFile, 0, 0, BASSFlag.BASS_SAMPLE_FX | BASSFlag.BASS_SAMPLE_LOOP);

Code: [Select]
if (channel != 0)
{
   ...
   fx[(int)Bands.PREAMP] = Bass.BASS_ChannelSetFX(channel, BASSFXType.BASS_FX_BFX_VOLUME, 1);
   ...
   FxVolume = new BASS_BFX_VOLUME();
   Bass.BASS_FXGetParameters(fx[(int)Bands.PREAMP], FxVolume);

   FxVolume.lChannel = BASSFXChan.BASS_BFX_CHANALL;
   FxVolume.fVolume = 1;

   Bass.BASS_FXSetParameters(fx[(int)Bands.PREAMP], FxVolume);

   // Play the filestream
   Bass.BASS_ChannelPlay(channel, false);
}
// The Trackbar change method

Code: [Select]
private void Preamp_Changed(object sender, EventArgs e)
{
      if (FxVolume == null)
      {
           return;
      }
         
      // For max value I have tried everything from 1 to 32678
      float pos = (float)Utils.DBToLevel(barPreamp.Value - 12, 200.0);

      Bass.BASS_FXGetParameters(fx[(int)Bands.PREAMP], FxVolume);

      FxVolume.fVolume = pos;
      Bass.BASS_FXSetParameters(fx[(int)Bands.PREAMP], FxVolume);
      Console.WriteLine(pos);
}

In the documentation it states the value of fVolume can be 0..1..n.
n can get pretty big, what is the range 0..32768 or what?

Anyways I have never been able to get the above code to alter the sound at all.

PS: My trackbar is -12 to +12

« Last Edit: 21 Jan '08 - 15:44 by smesser »

radio42

  • Posts: 4576
Re: BASS .NET API 2.4.0.0 beta!
« Reply #324 on: 21 Jan '08 - 15:58 »
No, Volume is a float value and is used as the amplification multiplier.
So it's range is:

0f = silent (= -unlim. dB)
..
1f = normal volume (no amplification = 0dB)
..
> 1f = amplification.

To translate this value to a DB level you might use "Utils.LevelToDB(volume, 1.0)".
If your trackbar value range is between -12 and +12 (meaning -12dB and +12dB) you would need to translate that dB value back to a float level value: "Utils.DBToLevel(trackbarValue, 1.0)"