20 Jun '13 - 11:46 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  Developments / BASS / Re: Unity3d app using BASS_ASIO freezes on quit. on: 30 Oct '12 - 13:14
This issue seems to be fixed in the latest Unity 4 beta.
ReplyReply Reply with quoteQuote
2  Developments / BASS / Re: Unity3d app using BASS_ASIO freezes on quit. on: 3 Aug '12 - 14:01
This thread was somewhere in beta program some time ago, so I can't link it. Sorry.

Ian told me that this thread is created in the driver so it's not possible to modify its creation arguments as described in that thread )8
ReplyReply Reply with quoteQuote
3  Developments / BASS / Re: Unity3d app using BASS_ASIO freezes on quit. on: 3 Aug '12 - 13:19
No, this hasn't been fixed.

We discussed the problem with Ian over e-mail, he made some cleanup fixes to BASS but unity still freezes on quit.
It happens if one uses managed ASIOPROC or STREAMPROC in their app. Looks like Mono or Unity waits for some thread created by BASS or BASSASIO which has been closed already.

I tried to ask people if anyone used BASS with Unity or Mono before. But nobody replied )8

I had an idea to try and use unmanaged callbacks from a C library. But didn't have time since then.
ReplyReply Reply with quoteQuote
4  Developments / BASS / Anyone using BASS/BASSASIO with callbacks in Mono? on: 22 Jul '12 - 23:27
I am keep getting this error described in separate topic — http://www.un4seen.com/forum/?topic=13857.msg96554#msg96554
I am using Unity3d which uses some version of Mono and looks like either Unity3d or Mono fail to see that BASS thread closes on application quit. So it waits forever and freezes.

I wonder if it is Unity3d's fault or Mono's fault.

Anyone developing with BASS for Mono and using callbacks called from BASS/BASSASIO thread can share if they encountered the same problem?
ReplyReply Reply with quoteQuote
5  Developments / BASS / Re: Unity3d app using BASS_ASIO freezes on quit. on: 13 Jul '12 - 16:42
Hi.
Me again.
So, is it possible to fix this issue?
It is really anoying )8
ReplyReply Reply with quoteQuote
6  Developments / BASS / Re: Unity3d app using BASS_ASIO freezes on quit. on: 11 Jul '12 - 14:18
This is what I got from Unity support forums, should be helpful:
Generally the issue is a native thread which is started from managed code and never disposed.

The similar problem was with Phidgets .net library.
They haven't been calling CloseHande on thread when it has been terminated.
So thread was leaking as far as I understood.

But this didn't fix the problem completely:
Yes, this is all on Windows. The Unity editor now works fine and does not hang, however a windows build (32 or 64 bit) will still hang on exit.
It does seem strange that it now works in the editor (3.5.2f2), but not as a windows build. I made numerous tests to ensure I wasn't using
the old .NET.dll and emailed Phidgets to get them to confirm the same thing happened for them. Obviously they fixed the editor bug and
didn't think to test a build at the time.

When you call a managed function from native thread function, the first time mono stores that thread id in its internal list,
but mono doesn't know where that thread is created, when mono shutdowns it goes through that list and waits for all threads to finish,
it also waits for that specific thread to finish

The thread is actually being correctly destroyed by the native plugin, but mono never notices that...
and doesn't remove the thread id from its internal list.
....it could probably check if the thread with specific id exist at all... don't know if it's a bug, or just by design.

In any case, I suggested a workaround for Phidget developer, to destroy that thread from managed land instead of native land,
that way mono will catch it, and remove that thread from the list, and won't stall when shutting down.

And the next guy got exactly the problem I'm having because I pass managed delegates to BASS_ASIO_ChannelEnable:
I've been following this discussion with interest because I've come across a similar issue. I have a callback function on the managed side
which just calls Debug.Log (a simple debug message callback). My native plugin calls the callback from two different threads within the plugin.
(I understand Debug.Log is one of the few thread-safe Unity functions.)

Everything works fine until I try to shut down the editor, at which time the editor locks up. I know the plugin is gracefully shutting down all threads,
however it seems this mono quirk is once again to blame.

You suggest destroying the thread from the managed side. What technique should I use for this?

I've tried saving a reference to the thread using Thread.CurrentThread. However calling Abort() on this has no effect,
presumably because the managed side knows it's an OS thread.

I've tried aborting the thread using kernel32's TerminateThread() function. This successfully kills the thread,
but of course I've bypassed mono here and the lock up problem remains.

And the last solution proposal from the thread:
there's also another solution, you could pass special SECURITY_ATTRIBUTES when calling CreateThread,
because when mono scans threads it wants to kill with OpenThread (THREAD_ALL_ACCESS, TRUE, threadID),
that means if you would create a thread with DELETE restriction, mono woudn't touch that thread while shutdowning.

Hope it will help to nail down the bug.
ReplyReply Reply with quoteQuote
7  Developments / BASS / Re: Unity3d app using BASS_ASIO freezes on quit. on: 11 Jul '12 - 14:00
I'll send you a debug version to try to find out where it's getting stuck.

Cool! Use the address I got in the profile.
Also I should have mentioned that unity runs Mono. Which is kind of old in 3.5. Maybe it's a problem of Mono because as I said it works fine in a simple .NET app.
ReplyReply Reply with quoteQuote
8  Developments / BASS / Unity3d app using BASS_ASIO freezes on quit. on: 11 Jul '12 - 11:34
UPDATE: This issue seems to be fixed in the latest Unity 4 beta.

Hi.

I got Unity3d app which uses unmanaged bass.dll and bassasio.dll.
But when I quit my app it freezes until you manually kill it. I narrowed the problem to this code:
BASS_ASIO_ChannelEnable(true, 0, asioDelegate, IntPtr.Zero);
BASS_ASIO_ChannelEnable(false, 0, asioDelegate, IntPtr.Zero);

If I don't enable channels and start ASIO everything is fine (though of no use).

When I quit the app I do the following:
Debug.Log("Destroying... ");
BASS_ASIO_Stop();
Debug.Log(BASS_ASIO_ErrorGetCode());
BASS_ASIO_ChannelEnable(true, 0, null, IntPtr.Zero);
Debug.Log(BASS_ASIO_ErrorGetCode());
BASS_ASIO_ChannelEnable(false, 0, null, IntPtr.Zero);
Debug.Log(BASS_ASIO_ErrorGetCode());
BASS_ASIO_Free();
Debug.Log(BASS_ASIO_ErrorGetCode());
BASS_Free();
Debug.Log(BASS_ErrorGetCode());

All BASS_ASIO_ErrorGetCode calls return BASS_OK so it seems that everything is getting freed.

Anyone has an idea why this happens? I don't get any crash or anything useful from logs either.
Or maybe someone knows a way to debug it?
ReplyReply Reply with quoteQuote
9  Developments / BASS / Re: Why BASS.NET requires System.Windows.Forms? on: 7 Jul '12 - 21:37
This is what I got at Unity3d forum:
http://forum.unity3d.com/threads/142663-quot-The-dll-is-not-allowed-to-be-included-or-could-not-be-found-quot-while-building.?p=975752#post975752
Quote
I'm surprised this worked at all, even from the editor; the Windows Forms dll makes extensive use of the Windows 32 API and as such is not supported, which means you can't use whatever Bass dll you're using. Seeing that Bass is a audio library, you should look into using their lib dlls that don't reference UI modules such as windows forms.

I don't really get why it's not supported as this person says. But I couldn't make it work anyhow...
I guess I'll have to write my own wrapper over BASS to use in Unity3d.
ReplyReply Reply with quoteQuote
10  Developments / BASS / Re: FFT with live ASIO data on: 6 Jul '12 - 19:43
EDIT: as in this post http://www.un4seen.com/forum/?topic=13433.0 I had issues with garbage collector. Crashes solved. Thanks again!

Thanks, I think I understand now how this library works.
I am getting some non-zero data and I was going to check what was there but I started getting weird crashes.
ReplyReply Reply with quoteQuote
11  Developments / BASS / Why BASS.NET requires System.Windows.Forms? on: 6 Jul '12 - 16:20
I'm trying to use BASS.NET in Unity3d with Mono and while exporting build I'm getting this error:

ArgumentException: The Assembly System.Windows.Forms is referenced by Bass.Net. But the dll is not allowed to be included or could not be found.

Why BASS.NET requires that? And is it possible to fix?
ReplyReply Reply with quoteQuote
12  Developments / BASS / Re: FFT with live ASIO data on: 6 Jul '12 - 11:43
That doesn't look quite right - you need to create a delegate for your StreamCallback (see docs for an example), like this:

I believe starting from some c# version you can pass delegates like this. My code for asio stream works fine. I'm getting audio data in the very same code.
ReplyReply Reply with quoteQuote
13  Developments / BASS / Re: FFT with live ASIO data on: 6 Jul '12 - 10:30
Thank you, I did the following:
stream = Bass.BASS_StreamCreate((int)BassAsio.BASS_ASIO_GetRate(), 2, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE, StreamCallback, IntPtr.Zero);
private static int StreamCallback(int handle, IntPtr buffer, int length, IntPtr user) {
  Console.WriteLine(length);
  return length;
}

But the callback is never called. Should I start the stream or something?

Also, where do I call BASS_ChannelGetData(bufstream, fft, BASS_DATA_FFT1024)? In some kind of a timer callback?
ReplyReply Reply with quoteQuote
14  Developments / BASS / Re: FFT with live ASIO data on: 5 Jul '12 - 12:56
Anyone?
I got this data in the buffer, I just want to use some channel where I can get FFT data from.
ReplyReply Reply with quoteQuote
15  Developments / BASS / [Solved] FFT with live ASIO data on: 4 Jul '12 - 17:45
Hi.

I'm trying to visualize audio data from a live source with BASS .NET.
I wanted to modify "livefx" demo, it's playing fine right now.
But I can't figure out how to get FFT data from BASS_ChannelGetData.
With ASIO I don't really have any streams. Audio data seems to be magically coming and going somewhere else.

This is the delegate called by ASIO.

       private static int AsioCallback(bool input, int channel, IntPtr buffer, int length, IntPtr user)
        {
            if (input) {
                Marshal.Copy(buffer, data, 0, length/4);
                return 0;
            } else {
                Marshal.Copy(data, 0, buffer, length/4);
                Bass.BASS_ChannelGetData(channel, buffer, length);
                return length;
            }
        }

I even have all the data in the buffer. Where do I get a channel to put it to? o.O
Can anyone point me the way how to get FFT data here?
ReplyReply Reply with quoteQuote
Pages: [1]
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines