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

radio42

  • Posts: 4573
Re: BASS.NET API 2.4.12.5
« Reply #1450 on: 4 Jan '17 - 13:08 »
@aaronwalwyn:
Then it seems not Bass.Net related!
Mabye Ian has an idea?!

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS.NET API 2.4.12.5
« Reply #1451 on: 4 Jan '17 - 15:54 »
Basically every time the recording is stopped it crashes on Android. Below is the stacktrace output from the adb.

Code: [Select]
01-04 10:55:35.526   253   253 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-04 10:55:35.526   253   253 F DEBUG   : CM Version: '13.1.2-ZNH2KAS3P0-bacon'
01-04 10:55:35.526   253   253 F DEBUG   : Build fingerprint: 'oneplus/bacon/A0001:6.0.1/MHC19Q/ZNH2KAS3P0:user/release-keys'
01-04 10:55:35.526   253   253 F DEBUG   : Revision: '0'
01-04 10:55:35.527   253   253 F DEBUG   : ABI: 'arm'
01-04 10:55:35.527   253   253 F DEBUG   : pid: 26157, tid: 26171, name: UnityMain  >>> com.SpeechGraphics.SG_Com_Unity <<<
01-04 10:55:35.527   253   253 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x88cc0528
01-04 10:55:35.554   253   253 F DEBUG   :     r0 88cc0528  r1 88cc1000  r2 fffffe8c  r3 88cc1000
01-04 10:55:35.554   253   253 F DEBUG   :     r4 88cc0528  r5 00000001  r6 88cc0ffc  r7 aed7e000
01-04 10:55:35.554   253   253 F DEBUG   :     r8 847cc1e0  r9 972fdc90  sl 9fb838f0  fp aef44bd4
01-04 10:55:35.554   253   253 F DEBUG   :     ip b399fed8  sp aef44ba8  lr b38c142c  pc b38c139c  cpsr 80010010
01-04 10:55:35.561   253   253 F DEBUG   :
01-04 10:55:35.561   253   253 F DEBUG   : backtrace:
01-04 10:55:35.562   253   253 F DEBUG   :     #00 pc 002b439c  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.562   253   253 F DEBUG   :     #01 pc 002b4428  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so (GC_push_all_stack+72)
01-04 10:55:35.562   253   253 F DEBUG   :     #02 pc 002bd0a8  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.562   253   253 F DEBUG   :     #03 pc 002bd178  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.562   253   253 F DEBUG   :     #04 pc 002b8ee4  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.562   253   253 F DEBUG   :     #05 pc 002b5ed8  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.562   253   253 F DEBUG   :     #06 pc 002b27d8  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.562   253   253 F DEBUG   :     #07 pc 002ac8ac  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.562   253   253 F DEBUG   :     #08 pc 002ac390  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.562   253   253 F DEBUG   :     #09 pc 002ad154  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.563   253   253 F DEBUG   :     #10 pc 002ad1f4  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.563   253   253 F DEBUG   :     #11 pc 00139c6c  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so (mono_gc_collect+40)
01-04 10:55:35.563   253   253 F DEBUG   :     #12 pc 00171fb4  /data/app/com.SpeechGraphics.SG_Com_Unity-2/lib/arm/libmono.so
01-04 10:55:35.563   253   253 F DEBUG   :     #13 pc 00007744  <unknown>

That shows the crash is happening in Mono (libmono), and perhaps it's related to garbage collection (mono_gc_collect)? To help narrow down what's causing the crash, does it still happen if your MyRecording function just returns the "continueRecording" value?

Code: [Select]
    private bool MyRecording(int handle, IntPtr buffer, int length, IntPtr user) {
        return continueRecording;
    }

aaronwalwyn

  • Posts: 7
Re: BASS.NET API 2.4.12.5
« Reply #1452 on: 4 Jan '17 - 17:10 »

That shows the crash is happening in Mono (libmono), and perhaps it's related to garbage collection (mono_gc_collect)? To help narrow down what's causing the crash, does it still happen if your MyRecording function just returns the "continueRecording" value?

Code: [Select]
    private bool MyRecording(int handle, IntPtr buffer, int length, IntPtr user) {
        return continueRecording;
    }

Hi Ian, just tried it with the MyRecording function just returning the continueRecording variable as above and a crash still occurs when the recording is stopped.

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS.NET API 2.4.12.5
« Reply #1453 on: 4 Jan '17 - 17:49 »
Is there anything else that you can remove from your code, ie. just keep the BASS_RecordInit/Start calls and the "continueRecording" stuff or BASS_ChannelStop? If it still crashes then, to confirm that the crash is something specific to Mono, please see if you can reproduce it with the Java RECTEST example that's included in the Android BASS package.

aaronwalwyn

  • Posts: 7
Re: BASS.NET API 2.4.12.5
« Reply #1454 on: 4 Jan '17 - 18:59 »
@Ian

So I've minimized the code for recording so now it looks like this:
Code: [Select]
public override bool Initialise() {
        BassNet.Registration("------------------@--------.com", "-------------------");
        _myRecProc = new RECORDPROC(MyRecording);
        Bass.BASS_RecordInit(-1);
        if (handle == 0) handle = Bass.BASS_RecordStart(recordFrequency, 1, BASSFlag.BASS_RECORD_PAUSE | BASSFlag.BASS_SAMPLE_MONO, 10, _myRecProc, IntPtr.Zero);

        _recbuffer = null;
        continueRecording = true;
        return Bass.BASS_ChannelPlay(handle, true);

        init = true;
        return true;
    }

    public override bool StopInput() {
        continueRecording = false;
        return true;
    }

    private bool MyRecording(int handle, IntPtr buffer, int length, IntPtr user) {
        return continueRecording;
    }

However the application still crashes when the recording is stopped. I've also done another build where the callback function for the recording is set to null so that MyRecording is not called at all and this time when stopped it does not crash!!!
« Last Edit: 5 Jan '17 - 12:59 by aaronwalwyn »

azur3

  • Posts: 4
Re: BASS.NET API 2.4.12.5
« Reply #1455 on: 4 Jan '17 - 22:18 »
@azur3: I guess the build process did not include the latest version in the zip. I corrected that.
So please re-download the latest version and try again!
Sorry for any inconvenience.

Now it works! Thank you for the quick replies, and for creating this great library. :)

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS.NET API 2.4.12.5
« Reply #1456 on: 5 Jan '17 - 17:33 »
So I've minimized the code for recording so now it looks like this:
Code: [Select]
public override bool Initialise() {
        BassNet.Registration("------------------@--------.com", "-------------------");
        _myRecProc = new RECORDPROC(MyRecording);
        Bass.BASS_RecordInit(-1);
        if (handle == 0) handle = Bass.BASS_RecordStart(recordFrequency, 1, BASSFlag.BASS_RECORD_PAUSE | BASSFlag.BASS_SAMPLE_MONO, 10, _myRecProc, IntPtr.Zero);

        _recbuffer = null;
        continueRecording = true;
        return Bass.BASS_ChannelPlay(handle, true);

        init = true;
        return true;
    }

    public override bool StopInput() {
        continueRecording = false;
        return true;
    }

    private bool MyRecording(int handle, IntPtr buffer, int length, IntPtr user) {
        return continueRecording;
    }

However the application still crashes when the recording is stopped. I've also done another build where the callback function for the recording is set to null so that MyRecording is not called at all and this time when stopped it does not crash!!!

Did that other build call BASS_ChannelStop instead of setting "continueRecording" in the StopInput function? If not, what happens when you try that? Does the crash also happen if you re-enable the RECORDPROC and call BASS_ChannelStop instead of setting "continueRecording"? Also, is the crash still exactly the same as in the previous log you posted?

aaronwalwyn

  • Posts: 7
Re: BASS.NET API 2.4.12.5
« Reply #1457 on: 5 Jan '17 - 17:46 »
Did that other build call BASS_ChannelStop instead of setting "continueRecording" in the StopInput function? If not, what happens when you try that? Does the crash also happen if you re-enable the RECORDPROC and call BASS_ChannelStop instead of setting "continueRecording"? Also, is the crash still exactly the same as in the previous log you posted?

Same crash happens whether setting continueRecording to false or using BASS_ChannelStop, again only if the RECORDPROC is enabled. Yes the crash log is the same as posted previously.

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS.NET API 2.4.12.5
« Reply #1458 on: 5 Jan '17 - 18:03 »
OK. To confirm whether the problem is something specific to Mono/.Net, please check if you can reproduce the crash with the Java RECTEST example that's included in the Android BASS package.

aaronwalwyn

  • Posts: 7
Re: BASS.NET API 2.4.12.5
« Reply #1459 on: 5 Jan '17 - 18:55 »
OK. To confirm whether the problem is something specific to Mono/.Net, please check if you can reproduce the crash with the Java RECTEST example that's included in the Android BASS package.

Sorry but by that do you mean re-create the RECTEST using unity/mono/.Net or do you mean run the Java RECTEST and see if the same crash happens?

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS.NET API 2.4.12.5
« Reply #1460 on: 6 Jan '17 - 16:46 »
I meant to run the Java example. That will tell us if the crashing may be something specific to Mono/.Net and narrow down where to look for the problem. Here's a pre-compiled version:

   www.un4seen.com/stuff/rectest.apk

aaronwalwyn

  • Posts: 7
Re: BASS.NET API 2.4.12.5
« Reply #1461 on: 6 Jan '17 - 19:40 »
I meant to run the Java example. That will tell us if the crashing may be something specific to Mono/.Net and narrow down where to look for the problem. Here's a pre-compiled version:

   www.un4seen.com/stuff/rectest.apk

So I've tested that .apk on all the same devices as before and can confirm that there is no crash at any point

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS.NET API 2.4.12.5
« Reply #1462 on: 9 Jan '17 - 14:42 »
OK. The next thing to check is whether other BASS callback functions are working. Have you already used other BASS callback functions in your app? If not, please give that a try, eg. you could set a DSPPROC function (that simply returns) on a stream via BASS_ChannelSetDSP.

HelloMeow

  • Guest
Re: BASS.NET API 2.4.12.5
« Reply #1463 on: 5 Feb '17 - 07:12 »
Recently I noticed that the popup isn't showing up anymore in the newest versions. Has it been removed?

radio42

  • Posts: 4573
Re: BASS.NET API 2.4.12.6
« Reply #1464 on: 16 May '17 - 14:12 »
16.05.2017: Version 2.4.12.6 is out!

Note:
   - Support for BASSmidi v2.4.11.0 added

Full Install:
 www.un4seen.com/filez/4/Bass24.Net.zip

Lib only:
 www.un4seen.com/filez/4/Bass24.Net_update.zip

IMPORTANT NOTE:
With this release I do NOT provide any setup.exe tool anymore!
This means, the full install is a plain zip file (just like for the native bass lib).
Just extract it to any new folder of your choice.

ken

  • Posts: 739
Re: BASS.NET API 2.4.12.6
« Reply #1465 on: 18 Jun '17 - 10:15 »
How do I use the "BassWasapiHandler.WasapiInputCallback", docs says it's WASAPIPROC callback procedure. But I can't seam to get the code right.

This don't work..
Code: [Select]
_BassWasapiHandlerIn.WasapiInputCallback = new WASAPIPROC(audioInputCallback);

Have any C# examples?

Thanks!

radio42

  • Posts: 4573
Re: BASS.NET API 2.4.12.6
« Reply #1466 on: 19 Jun '17 - 07:19 »
Of course this doesn't work, as the "WasapiInputCallback" is a method and not a property, so you cannot assign a value to it!
See here: http://www.bass.radio42.com/help/html/e42db4b6-95fc-cd4c-319b-5778ca757502.htm

The "WasapiInputCallback" is a virtual method, as such you might overwrite it in your own implementation (if you derive your own WasapiHandler class implementation).
There is no sample provided for a derived class, as this depends on what you want to implement in it.
Note, that the default implementation is used internally when dealing with an input device.
A sample for this is given here:
http://www.bass.radio42.com/help/html/3cc63e6e-272a-36dc-cedb-248d52eeeaf3.htm
(see 'Automatic use of the BassWasapiHandler (Wasapi recording input)')

ken

  • Posts: 739
Re: BASS.NET API 2.4.12.6
« Reply #1467 on: 19 Jun '17 - 07:44 »

A sample for this is given here:
http://www.bass.radio42.com/help/html/3cc63e6e-272a-36dc-cedb-248d52eeeaf3.htm
(see 'Automatic use of the BassWasapiHandler (Wasapi recording input)')

Yes, built my code based on that example. So how do I use the callback there? I need to get a callback every time Wasapi have data from the sound card, and get the data.

Sorry for not understanding...

Code: [Select]

private BassWasapiHandler _wasapi;
...
// not playing anything via BASS, so don't need an update thread
Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 0);
// setup BASS - "no sound" device
Bass.BASS_Init(0, 48000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
...
// assign WASAPI input in shared-mode
_wasapi = new BassWasapiHandler(-2, false, 48000, 2, 0f, 0f);
// init and start WASAPI
_wasapi.Init();

int recordStream = _wasapi.InputChannel;

// double check, that the device is not muted externally
if (_wasapi.DeviceMute)
    _wasapi.DeviceMute = false;
_wasapi.Start();


// now you can use recordStream to setup any DSP/FX etc.




radio42

  • Posts: 4573
Re: BASS.NET API 2.4.12.6
« Reply #1468 on: 19 Jun '17 - 08:50 »
As said, the callback is used internally in the WasapiHandler!
If you want to use your own callback, you need to inherit your own class from the WasapiHandler class and overwrite the WasapiInputCallback!

If you have no idea on how to do this, you may be don't want to use the WasapiHandler helper class at all, but better use the Wasapi methods 'manually' yourself?!

ken

  • Posts: 739
Re: BASS.NET API 2.4.12.6
« Reply #1469 on: 19 Jun '17 - 08:53 »
Ah, okay I get it so I have to override the hole callback that you have internally in WasapiHandler, not just "get" the callback when your callback is fired.

Thanks!

serkanp

  • Posts: 64
Re: BASS.NET API 2.4.12.6
« Reply #1470 on: 2 Aug '17 - 14:59 »
are there any support for .net core 2.0 preview-2?

radio42

  • Posts: 4573
Re: BASS.NET API 2.4.12.6
« Reply #1471 on: 2 Aug '17 - 16:04 »
No, not yet.
And i will probably need wait a bit, as I am til End of August on holiday ;-)

Have you tried the current build with it? Isn't that working?

radio42

  • Posts: 4573
Re: BASS.NET API 2.4.12.7
« Reply #1472 on: 31 Aug '17 - 11:14 »
31.08.2017: Version 2.4.12.7 is out!

Note:
   - Support for BASSmix v2.4.9.0 added
   - Support for BASSflac v2.4.4.0 added

Full Install:
 www.un4seen.com/filez/4/Bass24.Net.zip

Lib only:
 www.un4seen.com/filez/4/Bass24.Net_update.zip