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

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.11.0
« Reply #1300 on: 19 Jan '15 - 15:35 »
19.01.2015: Version 2.4.11.0 is out!

BASS: added support for v2.4.11.0
BASSDSD: added support for v2.4.0.0
BASS_FX: added support for v2.4.11.1
BASSASIO: added support for v1.3.1.0
BASSMIDI: added support for v2.4.9.1
General update to all latest versions!

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

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


Simulator88

  • Guest
Re: BASS.NET API 2.4.11.0
« Reply #1301 on: 27 Jan '15 - 16:25 »
Gonna try the new version out.

Can some1 help me with this code? I want to convert mp2 files to mp3. Whats wrong with it?

Code: [Select]
Dim stream As Integer = Bass.BASS_StreamCreateFile(CurrentSongFileName, 0, 0,
                                 BASSFlag.BASS_STREAM_DECODE)

                Debug.Print(Bass.BASS_ErrorGetCode.ToString)

                BassEnc.BASS_Encode_Start(stream, "lame --alt-preset standard - " & savePath,
                        0, Nothing, IntPtr.Zero)
                ' start the channel playing & encoding

                While Bass.BASS_ChannelIsActive(stream) And BassEnc.BASS_Encode_IsActive(stream)

                    Dim buff(40000) As Byte

                    Bass.BASS_ChannelGetData(stream, buff, Marshal.SizeOf(buff))
                    Debug.Print(Bass.BASS_ErrorGetCode.ToString)

                End While

Ian @ un4seen

  • Administrator
  • Posts: 20426
Re: BASS.NET API 2.4.11.0
« Reply #1302 on: 27 Jan '15 - 17:10 »
That code looks fine, except that there should be a BASS_Encode_Stop call (and BASS_StreamFree) after leaving the loop. Are the BASS_StreamCreateFile and BASS_Encode_Start calls reporting success or failure in their return values, and if failure, what is the error code from BASS_ErrorGetCode? If those calls are fine, one modification you could try is this..

Code: [Select]
                While Bass.BASS_ChannelIsActive(stream)<>BASSActive.BASS_ACTIVE_STOPPED And BassEnc.BASS_Encode_IsActive(stream)<>BASSActive.BASS_ACTIVE_STOPPED

Simulator88

  • Guest
Re: BASS.NET API 2.4.11.0
« Reply #1303 on: 28 Jan '15 - 09:20 »
There's an error with this line after modifying my code with your suggestion:

Code: [Select]
Bass.BASS_ChannelGetData(stream, buff, Marshal.SizeOf(buff))
System.ArgumentException: Type 'System.Byte[]' cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed

Ian @ un4seen

  • Administrator
  • Posts: 20426
Re: BASS.NET API 2.4.11.0
« Reply #1304 on: 28 Jan '15 - 16:09 »
I think that line should look like this...

Code: [Select]
Bass.BASS_ChannelGetData(stream, buff, buff.Length)

ken

  • Posts: 739
Re: BASS.NET API 2.4.11.0
« Reply #1305 on: 6 Feb '15 - 08:36 »
Hi,

When using the iOS version with Xamarin Studio, I get some (or actually a lot) of building errors. Looks lite it on all the functions that I don't use in my project. I do my own dll call to BASS the I get no errors.

Here is one of the errors from Xamarin Studio.

Code: [Select]

error MT5214: Native linking failed, undefined symbol: _BASS_APE_StreamCreateFile. This symbol was referenced the managed member Un4seen.Bass.AddOn.Ape.BassApe.BASS_APE_StreamCreateFileMemory. Please verify that all the necessary frameworks have been referenced and native libraries linked.



Any suggestions?


radio42

  • Posts: 4576
Re: BASS.NET API 2.4.11.0
« Reply #1306 on: 6 Feb '15 - 10:23 »
What version of Xamarin are you using?

If you are using the 'lastest' ios 8 Xamarin version please take a look here:
http://forums.xamarin.com/discussion/16489/new-type-registrar-in-xamarin-ios-7-2-1-errors-mt5210-and-mt5211

So have you tried the mentioned workaround by using the "--registarar:legacy" linker option?!

The issue seems, that Xamarin now try to resolve ALL methods at once.
Meaning any external method defined within Bass.Net must physically exist (in the corresponding native BASS/add-on lib).
E.g. if you would include ALL referenced libs (like e.g. libbasswv.a, libbassopus.a, libbassmidi.a etc. etc.) then it should link/compile fine!
Can you confirm this?!

If not, please tell me which methods are exactly missing in case you really link against ALL native libs!
The problem is, that Bass.Net is ONE assembly, which defines ALL methods off ALL available native libs, bass AND any add-on.
If I read the new Xamarin docs correctly, they now check (by default), if all those defined external methods do actually exist.
This would mean, you MUST link against ALL native libs (bass and ALL add-ons).
If that is true, I can only say: how stupid is that! So you should contact Xamarin and file an issue with them.
It is not easy to change Bass.Net is that respect, as I would need to create for every native lib one related .net wrapper lib.
And this is in some cases not really possible right now!

So I think, we need to throw this issue back to Xamarin to find a solution.
I hope they have a switch/workaround for that.
Else, I am afraid, that you must really link against ALL native libs!
If all that also fails, I guess should 'ship' a sample application as a non-working example to the Xamarin support!

ken

  • Posts: 739
Re: BASS.NET API 2.4.11.0
« Reply #1307 on: 18 Feb '15 - 07:26 »
What version of Xamarin are you using?
...


Hi,

I'm using the latest Xamarin (5.7). I hade the problem with linking the external libs (*.a) but that is solved thanks to Xamarin with some new "additional arguments". I use these now:

Code: [Select]
-cxx -gcc_flags "-L${ProjectDir} -lbass -lbassmix -lbass_fx -lbassopus -force_load ${ProjectDir}/libbass.a ${ProjectDir}/libbassmix.a ${ProjectDir}/libbass_fx.a ${ProjectDir}/libbassopus.a"
The problem is when I use your dll BASS.net, then I get the errors. If I make my own "Dllimport" class with just some functions (like Init, create stream and play) then I can compile the app just fine.

I can use other external .NET components (from Xamarin store) and the are added same way as Bass.Net (under References)

/Ken

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.11.0
« Reply #1308 on: 18 Feb '15 - 09:27 »
The detailed explanation is as in my post above !
Xamarin in its latest version now check for availability of ALL native methods as declared in a library.
Beforehand they just checked for those being used by your app.
If the above mentioned "--registarar:legacy" linker option is not working correctly please file this as a bug to Xamarin!

BASS.NET is a complete .Net wrapper for Bass AND its add-ons - as such BASS.NET has to declares all available Bass AND add-on methods.
As a result by Xamarin will now by default check for availability for ALL native methods.
In order to only check the used methods by your application the above mentioned linker option should be used.
Again, if that is not working, please send this as a bug to Xamarin!

ken

  • Posts: 739
Re: BASS.NET API 2.4.11.0
« Reply #1309 on: 18 Feb '15 - 13:43 »
The detailed explanation is as in my post above !
Xamarin in its latest version now check for availability of ALL native methods as declared in a library.
Beforehand they just checked for those being used by your app.
If the above mentioned "--registarar:legacy" linker option is not working correctly please file this as a bug to Xamarin!

BASS.NET is a complete .Net wrapper for Bass AND its add-ons - as such BASS.NET has to declares all available Bass AND add-on methods.
As a result by Xamarin will now by default check for availability for ALL native methods.
In order to only check the used methods by your application the above mentioned linker option should be used.
Again, if that is not working, please send this as a bug to Xamarin!


Hi,

The "--registrar:legacy" did not fix the problem. I have to send your dll to Xamarin so they test it can fix the bug in Xamarin Studio.

/Ken

Simulator

  • Posts: 32
Re: BASS.NET API 2.4.11.0
« Reply #1310 on: 5 Mar '15 - 09:35 »
Hey guys,

I have the following code to convert my mp2 files to mp3 with lame encoder. How to get the percentage of this progress?

Code: [Select]
   Dim savePath As String = """" & Path.GetDirectoryName(sf.FileName) & "/" & dummyFileName & """"

                Dim stream As Integer = Bass.BASS_StreamCreateFile(CurrentSongFileName, 0, 0,
                                 BASSFlag.BASS_STREAM_DECODE)

                BassEnc.BASS_Encode_Start(stream, "lame --alt-preset cbr 320 - " & savePath,
                        BASSEncode.BASS_ENCODE_AUTOFREE, Nothing, IntPtr.Zero)
                ' start the channel playing & encoding

                Dim length As Integer = CInt(Bass.BASS_ChannelGetLength(stream))

                Dim data(length / 4 - 1) As Single

                Bass.BASS_ChannelGetData(stream, data, length)

  If Bass.BASS_ErrorGetCode.ToString = "BASS_OK" Then

'Show OK!

End If


radio42

  • Posts: 4576
Re: BASS.NET API 2.4.11.0
« Reply #1311 on: 5 Mar '15 - 11:35 »
In the way you do it no, you can not get any progress, as you get all the sample data in one single BASS_ChannelGetData call.
As such once BASS_ChannelGetData returns all the data has already been decoded and processed by the lame encoder (DSP).
To calculate the percentage process the data in smaller chunks (e.g. blocks of 8K data) and then report/calc the progress accordingly.

Simulator

  • Posts: 32
Re: BASS.NET API 2.4.11.0
« Reply #1312 on: 7 Mar '15 - 10:50 »
Can you give me some sample please? :)

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.11.0
« Reply #1313 on: 7 Mar '15 - 14:50 »
Code: [Select]
long bytesTotal = Bass.BASS_ChannelGetLength(stream);
long bytesDone = 0L;
byte[] encBuffer = new byte[65536]; // our dummy encoder buffer
while (Bass.BASS_ChannelIsActive(stream) == BASSActive.BASS_ACTIVE_PLAYING)
{
    // getting sample data will automatically feed the encoder
    bytesDone += Bass.BASS_ChannelGetData(_stream, encBuffer, encBuffer.Length);

    // here you have bytesDone and bytesTotal
    // the percentage calculation should be easy?!
    Console.WriteLine ("{0}", (double)bytesDone / (double)bytesTotal);
}

robertr

  • Posts: 18
Bass.Tags and MP4
« Reply #1314 on: 17 Apr '15 - 09:52 »
Using BASS.NET with Xamarin on iOS:

I am using BASS_TAG_GetFromFile(String) to extract metadata from a variety of files.
This works great on most formats, but on MP4(.m4a) no metadata is found, Tagtype = BASS_TAG_UNKNOWN.

This seem to be an issue with BASS.NET, since if I use Bass.BASS_ChannelGetTagsMP4(handle) on the same file, it returns an array of correct metadata.

Any idea how to solve this?

BTW, the tags functionality in the BASS.NET is fantastic except for this little issue.

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.11.0
« Reply #1315 on: 17 Apr '15 - 11:34 »
As written in the docs, Bass.Net uses the internal plugin system within BASS_TAG_GetFromFile.
Meaning internally Bass.Net simply calls "Bass.BASS_StreamCreateFile" to create a stream handle.
Only if that stream handle was successfully created it would detect the TAGs.

So I suspect, that in your case the internal "Bass.BASS_StreamCreateFile" call fails.

How do you create the stream handle when calling BASS_ChannelGetTagsMP4?
(as this requires an already created stream handle)
And what BASSChannelType did you get when creating your stream handle manually?

robertr

  • Posts: 18
Re: BASS.NET API 2.4.11.0
« Reply #1316 on: 17 Apr '15 - 12:28 »
Thank you for the reply,
here is a little demo code. Result is the same when passing either a handle or path to BASS_TAG_GetFromFile.
Same behaviour in both simulator and device.

Code: [Select]

    int handle = Bass.BASS_StreamCreateFile(path,0,0,0);

            if (handle != 0) {

                string [] tags;

                if (path.EndsWith ("m4a")) {
                    tags = Bass.BASS_ChannelGetTagsMP4(handle);
                    // If i look at the tags array here, it is populated with metdata values
                }

                TAG_INFO tagInfo = new TAG_INFO();
                BassTags.BASS_TAG_GetFromFile (handle, tagInfo);

                // tagInfo at this point is empty with TAG_UNKNOWN
            }


radio42

  • Posts: 4576
Re: BASS.NET API 2.4.11.0
« Reply #1317 on: 17 Apr '15 - 12:38 »
And what BASSChannelType did you get when creating your stream handle manually?
(you can get this from Bass.BASS_ChannelGetInfo)

robertr

  • Posts: 18
Re: BASS.NET API 2.4.11.0
« Reply #1318 on: 17 Apr '15 - 15:10 »
Bass.BASS_ChannelGetInfo() returns channel type "BASSChannelType.BASS_CTYPE_STREAM_CA".

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.11.0
« Reply #1319 on: 17 Apr '15 - 15:56 »
OKay, that explains it, as this tag type is currently not supported.
I'll see to add that in the next release.

robertr

  • Posts: 18
Re: BASS.NET API 2.4.11.0
« Reply #1320 on: 17 Apr '15 - 19:09 »
Thank you, appreciate it:)

Valdi

  • Posts: 8
Re: BASS.NET API 2.4.11.0
« Reply #1321 on: 27 Apr '15 - 15:59 »
Hi!

We're currently testing bass.net library in our xamarin solution.
Basically everything is working pretty good, except one thing - BASS_SYNC_STALL.

When I set channel like below
Bass.BASS_ChannelSetSync(_streamHandle, BASSSync.BASS_SYNC_STALL, 0, new SYNCPROC(HandleBuffering), IntPtr.Zero);

and start handle data in HandleBuffering method
void HandleBuffering(int handle, int channel, int data, IntPtr user)
        {
            Dispatcher.Instance.InvokeInMainThread(() =>
                {
                        //0-stalled
                        State = data == 0 ? PlayerState.Buffering : PlayerState.Playing;
                });
        }

after some time I'm getting exceptions is I want to access my data (State property) in the class where HandleBuffering method is defined.
I was trying to dispatch my calls to main thread but that doesn't help me at all.

Any ideas what might be wrong?
I'm using the latest version of bass.net library.


radio42

  • Posts: 4576
Re: BASS.NET API 2.4.11.0
« Reply #1322 on: 27 Apr '15 - 19:09 »
What exact exception do you get and how/where is 'State' defined?

Valdi

  • Posts: 8
Re: BASS.NET API 2.4.11.0
« Reply #1323 on: 28 Apr '15 - 09:13 »
Ok sorted.
For some reason when i introduce SYNCPROC as a variable, everything is starting to work.
_bufferingSync = new SYNCPROC(HandleBuffering);
_bufferingSyncHandle = Bass.BASS_ChannelSetSync(_streamHandle, BASSSync.BASS_SYNC_STALL, 0, _bufferingSync, IntPtr.Zero);


Regarding to Your question anyway I was getting weird nullreferences on State property which is defined as an enum.

mgamache

  • Posts: 3
Re: BASS.NET API 2.4.11.0
« Reply #1324 on: 24 May '15 - 14:30 »
Does bass.net play midi (*.mid) files where the midi data is sent out to external devices (like a synth)?

I need to sync midi data to sound files (kind of like a DAW). What is the recommended approach?

thanks,
mark
« Last Edit: 25 May '15 - 02:15 by mgamache »