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

ken

  • Posts: 739
Re: BASS.NET API 2.4.10.3
« Reply #1275 on: 4 Jun '14 - 15:33 »
Ok, I have missed "DetectBeats" ... 

If I want more accurate beats, like every 8th or 32th. Then I have to use BassFX, correct?

/Ken


radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.3
« Reply #1276 on: 17 Jun '14 - 08:02 »
Yes, correct.

aybe

  • Posts: 145
Re: BASS.NET API 2.4.10.3
« Reply #1277 on: 22 Jul '14 - 00:19 »
Hi Aybe,

thanks for effort.
I guess we also need to discuss this with Ian, as BASs is of course HIS baby, while Bass.Net is mine.
Typically I follow Ian, as he is maintaining BASS and is kind of the master of all.
so I'll discuss that with him...

Greets,
Bernd


Hello radio42 !

I'd like to know if you had a chance to take a look at the Nuget package and (hopefully) approve it ? :D

Thank you.

coczero

  • Posts: 6
Re: BASS.NET API 2.4.10.3
« Reply #1278 on: 5 Aug '14 - 08:31 »
Hello, I am very new to bass.
I use bass.net on my Ubuntu Virtual Machine.
I registrated it successfully and now want to play an mp3.
But when I play it it doesnt sound very good, it stuttering like hell and distorted. This is my code.

Code: [Select]
BassNet.Registration ("xx", "xx");

if (Bass.BASS_Init (-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)) {
MessageBox.Show ("Bass initialized");
int stream = Bass.BASS_StreamCreateFile ("Godking.mp3", 0, 0, BASSFlag.BASS_DEFAULT);
if (stream != 0)
Bass.BASS_ChannelPlay (stream, false);
} else
MessageBox.Show ("Stream error: ");

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.3
« Reply #1279 on: 5 Aug '14 - 10:51 »
That sounds like either a soundcard issue or an incredibly slow device from which you are playing the "godking.mp3".

However, nothing related to Bass.Net ...

iancast

  • Posts: 42
Re: BASS.NET API 2.4.10.3
« Reply #1280 on: 11 Aug '14 - 00:30 »
Hello Bernd,

I have some strange issues loading any audio files using the plugins (FLAC, APE, etc.) using MonoMac. When I try to create a decoding stream, I get a handle with the zero value, but there are no errors to get (i.e. BASS_ErrorGetCode == 0). However, the next call returns the BASS_ERROR_HANDLE error. This error is undocumented for this method. The plugins load fine without any error (i.e. the plugin handle is higher than 0).

What's really strange is that I have a console version of my app, also on OSX, using the same player code and the exact same initialization routine and it works like a charm. I use the Bass.Net.OSX.dll assembly in both cases. Using the same player code, I can successfully load FLAC files on iOS, Android, Windows and Linux.

I'm guessing it has to do with the application bundle on OSX (i.e. .app folder), but that worked before but I'm not sure when it broke (maybe when I upgraded to Mavericks a while ago?). I can reproduce the issue with a "Hello World" MonoMac sample app on multiple Macs. In any case, the app does have access to the plugin files because they are located inside the app bundle. I also tried loading the plugins outside the bundle and I have the same issue (BASS_PluginLoad works fine, BASS_StreamCreateFile fails).

Here is an example of the code:

Code: [Select]
           // Build flags; add base flags
            BASSFlag flags = BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_STREAM_PRESCAN;
            if (useFloatingPoint)
                flags |= BASSFlag.BASS_SAMPLE_FLOAT;

            // Create file stream
            int handle = Bass.BASS_StreamCreateFile(filePath, 0, 0, flags);
            if (handle == 0)
                Base.CheckForError();

Do you have any idea why this is happening? Thanks and keep up the good work as usual.
« Last Edit: 11 Aug '14 - 00:51 by iancast »

iancast

  • Posts: 42
Re: BASS.NET API 2.4.10.3
« Reply #1281 on: 11 Aug '14 - 00:47 »
Hello Bernd,

Just another thing, Xamarin has updated its linker behavior recently for Xamarin.iOS; they now check the existence of every P/Invoke method in the static library. Your build of BASS.Net for iOS contains 40 methods that aren't found in the iOS version of BASS.

Please check this documentation from Xamarin: http://forums.xamarin.com/discussion/16489/new-type-registrar-in-xamarin-ios-7-2-1-errors-mt5210-and-mt5211

In order for the build to work with Xamarin.iOS 7.2+, I needed to create a native library which contains the missing symbols and add it to the linker arguments. It's a bit annoying but at least it works. Here's the code needed to build the native library:

Code: [Select]
// Compile: clang -arch i386 -arch x86_64 -arch armv7 -arch armv7s -arch arm64 -c bass_missing_defs.c -o bass_missing_defs.o

void *BASS_AAC_StreamCreateFile = 0;
void *BASS_AAC_StreamCreateFileUser = 0;
void *BASS_AAC_StreamCreateURL = 0;
void *BASS_GetDSoundObject = 0;
void *BASS_MIDI_FontCompact = 0;
void *BASS_MIDI_FontFree = 0;
void *BASS_MIDI_FontGetInfo = 0;
void *BASS_MIDI_FontGetPreset = 0;
void *BASS_MIDI_FontGetVolume = 0;
void *BASS_MIDI_FontInit = 0;
void *BASS_MIDI_FontLoad = 0;
void *BASS_MIDI_FontPack = 0;
void *BASS_MIDI_FontSetVolume = 0;
void *BASS_MIDI_FontUnload = 0;
void *BASS_MIDI_FontUnpack = 0;
void *BASS_MIDI_InFree = 0;
void *BASS_MIDI_InGetDeviceInfo = 0;
void *BASS_MIDI_InInit = 0;
void *BASS_MIDI_InStart = 0;
void *BASS_MIDI_InStop = 0;
void *BASS_MIDI_StreamCreate = 0;
void *BASS_MIDI_StreamCreateEvents = 0;
void *BASS_MIDI_StreamCreateFile = 0;
void *BASS_MIDI_StreamCreateFileUser = 0;
void *BASS_MIDI_StreamCreateURL = 0;
void *BASS_MIDI_StreamEvent = 0;
void *BASS_MIDI_StreamEvents = 0;
void *BASS_MIDI_StreamGetChannel = 0;
void *BASS_MIDI_StreamGetEvent = 0;
void *BASS_MIDI_StreamGetEvents = 0;
void *BASS_MIDI_StreamGetFonts = 0;
void *BASS_MIDI_StreamGetMark = 0;
void *BASS_MIDI_StreamLoadSamples = 0;
void *BASS_MIDI_StreamSetFonts = 0;
void *BASS_MP4_StreamCreateFile = 0;
void *BASS_MP4_StreamCreateFileUser = 0;
void *BASS_Mixer_ChannelSetMatrixEx = 0;
void *BASS_OPUS_StreamCreateFile = 0;
void *BASS_OPUS_StreamCreateFileUser = 0;
void *BASS_OPUS_StreamCreateURL = 0;

Keep this in mind when you release the next version of Bass.Net for iOS! Hope that helps you and anyone that runs into this problem.

Gorath

  • Posts: 72
Re: BASS.NET API 2.4.10.3
« Reply #1282 on: 19 Sep '14 - 08:17 »
Hi,

tried to install new bass.net 2.4.10.3 and got this error during installation:


After pressing OK, installation is cancelled. Any idea how to install this version?

G

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.3
« Reply #1283 on: 19 Sep '14 - 14:00 »
The error is almost self explained.

"...This assembly is built by a runtime newer than the current loaded runtime..."

runtime = .Net Framework
v4.0 is the one the installer is using and build against...

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.4
« Reply #1284 on: 10 Oct '14 - 10:56 »
10.10.2014: Version 2.4.10.4 is out!

Support for all latest versions added!
(e.g. BASSenc, BASSmix, BASS_FX, BASSCD, etc.)

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

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

MikaelS

  • Posts: 198
Re: BASS.NET API 2.4.10.4
« Reply #1285 on: 18 Oct '14 - 11:51 »
Hello,

Is there any sample available for Xamarin iOS ?
I have used BASS and BASS.NET before but have no idea of how to start a Xamarin project.
I could not find anything related to this in the sample folder (i'm registered btw.)

Any hints are more than welcome.

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.4
« Reply #1286 on: 18 Oct '14 - 16:08 »
No, there is no sample provided.
But I guess there was one located here in this forum - not sure where exactly...

MikaelS

  • Posts: 198
Re: BASS.NET API 2.4.10.4
« Reply #1287 on: 18 Oct '14 - 16:13 »
Iancast: Can you please give me some information about how you solved the linking problems with Xamarin?
I tried to get it working with an iOS project but I was met with errors like:

Error MT5214: Native linking failed, undefined symbol: _BASS_GetDSoundObject. This symbol was referenced the managed member Un4seen.Bass.Bass.BASS_GetDSoundObject. Please verify that all the necessary frameworks have been referenced and native libraries linked. (MT5214)

Error MT5214: Native linking failed, undefined symbol: _BASS_MIDI_FontPack. This symbol was referenced the managed member Un4seen.Bass.AddOn.Midi.BassMidi.BASS_MIDI_FontPackUnicode. Please verify that all the necessary frameworks have been referenced and native libraries linked. (MT5214)

and similar errors... Anyone that can help me out further?

Big thanks in advance!

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.4
« Reply #1288 on: 4 Nov '14 - 08:55 »
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!

MikaelS

  • Posts: 198
Re: BASS.NET API 2.4.10.4
« Reply #1289 on: 4 Nov '14 - 14:08 »
Please see my reply in the thread: https://www.un4seen.com/forum/?topic=16126.0

serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.4
« Reply #1290 on: 19 Dec '14 - 15:53 »
Hi,
i have an interesting issue,
i am continuously playing a playlist files one by one 24 hours and 7 days..
it works well 1-2 days without any problem..
after 2-3 days, OnTrackSync starts not to trigger.. and it stops suddenly.. :)))

to test it better, i put a button on form and when i click to the button, it seeks to the last 20 seconds and music starts to play,
the first 1-2 days , at the end of the music, the tracksync event works and runs..

when the tracksync stops itself to trigger after 2-3 days,when i click the button, music plays, at the end of music,  nothing triggers..


here is a simplified sample code i am using..
where the problem in my code ?


Code: [Select]

 private SYNCPROC _sync;
 private int _stream = 0;
 private int trackSync = 0;

void playNext()
        {
            string filename = "file.mp3";
            if (_stream != 0)
            {
                Bass.BASS_ChannelStop(_stream);
                Bass.BASS_StreamFree(_stream);
            }
            _stream = Bass.BASS_StreamCreateFile(filename, 0, 0, BASSFlag.BASS_STREAM_PRESCAN | BASSFlag.BASS_SAMPLE_FLOAT);
            if (_stream != 0)
            {
                if (Bass.BASS_ChannelPlay(_stream, false))
                {
                    _sync = new SYNCPROC(OnTrackSync);
                    trackSync = Bass.BASS_ChannelSetSync(_stream, BASSSync.BASS_SYNC_END, 0L, _sync, IntPtr.Zero);  

                }
            }
        }

        private void OnTrackSync(int handle, int channel, int data, IntPtr user)
        {
            Bass.BASS_ChannelRemoveSync(_stream, trackSync);
            new Thread(playNext).Start();
        }

« Last Edit: 19 Dec '14 - 16:03 by serkanp »

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.4
« Reply #1291 on: 19 Dec '14 - 16:36 »
I do not really see a reason for the behavior (I am also using Bass.Net and SyncProcs and here they never stall).
Except a possible reason listed under c)!

However a few things in your code might be 'optimized':

a) you are creating the sync callback delegate with each playNext call:
    _sync = new SYNCPROC(OnTrackSync);
This is not needed.
You might create the delegate once and then leave it unchanged!

b) You are removing the sync within its delegate.
As far as I remember this is not recommended (if not even not allowed).
So try moving it into its own thread as well.

c) You only create an END sync, if PLAY was successfully called.
This might lead to a race condition, if play starts, but immediately ends, no end sync would be called.
I would move the BASS_ChannelSetSync call right after the successful stream creation.

Also, what do you do in case BASS_ChannelSetSync or BASS_ChannelPlay fail?
Do you skip your playlist or stop? Might this be the reason?

serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.4
« Reply #1292 on: 22 Dec '14 - 08:55 »
in original code,on channelplay failure i move to the next file..
interesting part is setsync never gives failure or errorcode

my code depends on onTrackSync, when it fires, i move to the next file.. but when it not fires, music stops..

i'll give you feedback after fixing code as on your suggestions...




serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.4
« Reply #1293 on: 8 Jan '15 - 08:42 »
do you have any suggestion for System.AccessViolationException from BASS_StreamFree command?
my application quits after this exception.. (after 2-3 days of success working)

here is the event viewer message:

Quote
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
   at Un4seen.Bass.Bass.BASS_StreamFree(Int32)
   at smg.monoplayer.Classes.Player.playNext()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.4
« Reply #1294 on: 8 Jan '15 - 09:33 »
BASS_StreamFree is a 1:1 wrapper call directly to BASS - so the AccessViolationException must have been occurred there!
I am afraid Ian needs to take a look at it then...

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS.NET API 2.4.10.4
« Reply #1295 on: 8 Jan '15 - 17:49 »
do you have any suggestion for System.AccessViolationException from BASS_StreamFree command?
my application quits after this exception.. (after 2-3 days of success working)

here is the event viewer message:

Quote
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
   at Un4seen.Bass.Bass.BASS_StreamFree(Int32)
   at smg.monoplayer.Classes.Player.playNext()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

Is it possible to get any native information on the crash, like the address and registers?

serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.4
« Reply #1296 on: 9 Jan '15 - 07:49 »
event viewer only gives this:
Quote
1. System

  - Provider

   [ Name]  .NET Runtime
 
  - EventID 1026

   [ Qualifiers]  0
 
   Level 2
 
   Task 0
 
   Keywords 0x80000000000000
 
  - TimeCreated

   [ SystemTime]  2015-01-09T07:26:32.000000000Z
 
   EventRecordID 2759866
 
   Channel Application
 
   Computer Rory-Pc
 
   Security
 

- EventData

   Application: smgWindowsPlayer.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException Stack: at Un4seen.Bass.Bass.BASS_StreamFree(Int32) at smg.monoplayer.Classes.Player.playNext() at System.Threading.ThreadHelper.ThreadStart_Context(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart() 

 
2. System

  - Provider

   [ Name]  Application Error
 
  - EventID 1000

   [ Qualifiers]  0
 
   Level 2
 
   Task 100
 
   Keywords 0x80000000000000
 
  - TimeCreated

   [ SystemTime]  2015-01-09T07:26:33.000000000Z
 
   EventRecordID 2759867
 
   Channel Application
 
   Computer Rory-Pc
 
   Security
 

- EventData

   smgWindowsPlayer.exe
   7.0.0.32
   54aea56b
   unknown
   0.0.0.0
   00000000
   c0000005
   55ff8b90
   fe4
   01d02b5a2bbc62aa
   C:\Program Files (x86)\SMG\SMG Player 7.0.0.32\smgWindowsPlayer.exe

viet

  • Guest
Re: BASS.NET API 2.4.10.4
« Reply #1297 on: 14 Jan '15 - 04:58 »
how to fix error when change trackbar (position backward):
Quote
A callback was made on a garbage collected delegate of type 'Bass.Net!Un4seen.Bass.SYNCPROC::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.
My project at:
Quote
https://bitbucket.org/congviet/midibass.net-test/src/44bb8ecdb1ece391c8b16f958198af8de9f920a5?at=master
thank to all

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.4
« Reply #1298 on: 14 Jan '15 - 08:47 »
You are probably user number 1 thousand how is running into this issue (which is a simple coding/developer error!).
One of the reason why I added since day one an explicit chapter about it to the Bass.Net docs - which I guess most users simply do not read.

That error message indicates that your callback function delegate was "garbage collected", ie. it no longer exists. To prevent that happening, you need to keep a reference to the delegate. Please see the "Callbacks and Delegates" section of the "Interoperating with Unmanaged Code" page in the BASS.Net documentation for details.

Simulator88

  • Guest
Re: BASS.NET API 2.4.10.4
« Reply #1299 on: 17 Jan '15 - 18:09 »
Hello guys,

I just wonder if it is possible to record and normalize the sound with Bass.Net. Or record it and normalize it before saving. Does anyone has a sample code or some guide?