23 May '13 - 10:25
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Search
Login
Register
Un4seen Developments Forum
>
Developments
>
BASS
> Topic:
BASS_ChannelGetData hangs in .Net 4 wpf application
Pages: [
1
]
« previous
|
next »
Reply
|
Print
Author
Topic: BASS_ChannelGetData hangs in .Net 4 wpf application (Read 498 times)
unippl
Posts: 1
BASS_ChannelGetData hangs in .Net 4 wpf application
«
on:
5 Sep '12 - 14:12 »
Quote
I have been struggling all day with a problem regarding the BASS_ChannelGetData which hangs while I make the call, so that the function gets called but never returns, or throws any error. The result is the application freezes.
The background is that in our wpf application we are recording data and streaming it to a backend audio processor in the form of a WCF service which lies on a server. I am trying to display the recording in a spectrum analyzer on the UI and it's in the UI that the BASS_ChannelGetData call hangs.
Now the funny thing is that if the WCF I am pointing to is running locally, everything works fine, but as soon as I point to an external service the BASS_ChannelGetData call hangs and sometimes finishes executing after a minute or two only to hang again on subsequent calls.
My suspision is that the stream which is being recorded and sent is locking up or something causing the BASS_ChannelGetData to wait for a chance analyze it. But there are no errors anywhere except the usual windows program unexpectedly quit when I use task manager to kill the process.
This is how I calling the BASS_ChannelGetData (function gets called on a timer tick event and I have tried to play around with timer intervals from 10 milliseconds to 1000 milliseconds-still hangs)
maxFFT = (int)(BASSData.BASS_DATA_AVAILABLE | BASSData.BASS_DATA_FFT2048);:
public bool GetFFTData(float[] fftDataBuffer)
{
try
{
return (Bass.BASS_ChannelGetData(m_Stream, fftDataBuffer, maxFFT)) > 0;
}
catch
{
return false;
}
}
If anyone has experienced this problem or a similiar problem, please let me know.
Logged
Ian @ un4seen
Administrator
Posts: 15269
Re: BASS_ChannelGetData hangs in .Net 4 wpf application
«
Reply #1 on:
5 Sep '12 - 15:56 »
Quote
It sounds like another thread has a lock on the channel, which is preventing the BASS_ChannelGetData call from advancing. Are you using BASS_ChannelLock at all? Another possibility is that there is a deadlock between the BASS_ChannelGetData thread and a callback function, eg. a callback function may be waiting for the main thread to do something, while the main thread is waiting for the BASS_ChannelGetData call to return. Do you have any callback functions (eg. a RECORDPROC) that require synchronisation with the main thread, eg. for UI stuff? If so, you could have the callback function just post a message to the main thread, and do the processing in the message handler.
Logged
fmcoder
Posts: 386
Re: BASS_ChannelGetData hangs in .Net 4 wpf application
«
Reply #2 on:
6 Sep '12 - 09:29 »
Quote
I've faced the similar problem...
The solution is simple: call BASS_ChannelGetData in another thread to avoid lock ups.
Logged
ken
Posts: 630
Re: BASS_ChannelGetData hangs in .Net 4 wpf application
«
Reply #3 on:
9 Sep '12 - 15:15 »
Quote
Try this code for avoid thread lockups in .NET WPF.
Dispatcher.Invoke(DispatcherPriority.Background, (Action)delegate()
{
//Do your stuff here...
});
Logged
Pages: [
1
]
Reply
|
Print
Un4seen Developments Forum
>
Developments
>
BASS
> Topic:
BASS_ChannelGetData hangs in .Net 4 wpf application
« previous
|
next »
Jump to:
Please select a destination:
-----------------------------
Developments
-----------------------------
=> BASS
=> XMPlay
=> MO3
-----------------------------
Off Topic
-----------------------------
=> General Discussion
Loading...