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

CalyPhornia

  • Posts: 7
Re: BASS .NET API 2.4.0.0 final
« Reply #350 on: 27 Feb '08 - 13:29 »
sry, but i doesn't can download Lib only: www.un4seen.com/filez/4/Bass24.Net20_beta.zip

http://www.un4seen.com/filez/4/Bass24.Net_beta.zip ^^ i can download

Does the AAC Plugin work under 64 Bit or only WMA ?
« Last Edit: 27 Feb '08 - 13:51 by CalyPhornia »

radio42

  • Posts: 4576
Re: BASS .NET API 2.4.0.0 final
« Reply #351 on: 27 Feb '08 - 15:24 »
Upps, little typo above..pls try again and redownload!

CalyPhornia

  • Posts: 7
Re: BASS .NET API 2.4.0.0 final
« Reply #352 on: 28 Feb '08 - 00:42 »
Does the bass_aac.dll have "64-bit file positioning" or give it at the moment only at bass_wma.dll?

I want to make a player under x64 which can play an aac+ stream

Ian @ un4seen

  • Administrator
  • Posts: 20436
Re: BASS .NET API 2.4.0.0 final
« Reply #353 on: 28 Feb '08 - 15:50 »
All the 2.4 add-ons support 64-bit file positioning (ie. files that are larger than 4GB), but none are currently available in x64 flavour (apart from the BASSWMA test case).

radio42

  • Posts: 4576
Re: BASS .NET API 2.4.0.0 beta
« Reply #354 on: 12 Mar '08 - 10:29 »
11.03.2008: Version 2.4.0.0 beta is out!

Last Changes:
- Support for latest BASSenc added
- BugFix in the Visual class (CreateWaveForm)

Please see the help file (.chm) for a complete list of changes and take a look to the "Upgrading from 2.3" section!
Note, that support for .Net 1.1 has been discontinued. Supported .Net Framework versions include 2.0, 3.0 and 3.5.

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

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

BASS_WADSP:
  www.un4seen.com/filez/4/bass_wadsp24.zip

Note: As BASS is still beta - I decided to reset BASS.NET to beta as well ;-)
However, as far as I can see, there are no further known bugs.
« Last Edit: 12 Mar '08 - 10:32 by radio42 »

Rob Kaandorp

  • Posts: 7
Re: BASS.NET API 2.4.0.0 beta
« Reply #355 on: 12 Mar '08 - 11:59 »
Hi there, I have upgraded a project I am working on to the bass .net 2.4 version but I have a problem with the WaveWriter class. It is very slow, much slower than the 2.3 version, and it looks like it is leaking memory when running. Is this because it is a debug build (the bass library itself) or might there be a bug in the .net WaveWriter implementation?

The code I am using is very similar to the example code in the help file.

Regards, Rob

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.0.0 beta
« Reply #356 on: 12 Mar '08 - 13:08 »
The WaveWriter class haven't even been touched between 2.3 and 2.4 - so I suspect that there must be something else slowing down your stuff.
I also didn't notice any memory leaks - and as the class implementation is pure managed code I even suspect, that there could be any memory leaks ;-)
What OS are you using?

Rob Kaandorp

  • Posts: 7
Re: BASS.NET API 2.4.0.0 beta
« Reply #357 on: 12 Mar '08 - 13:52 »
Thanks for your reply. The software I am writing is a mixer application which mixes a couple of wave files to some intermediate mixer channels, which are finally mixed to a stereo channel. This stereo channel can then be written to disc as a wave file. The application also lets the user play the stereo channel before creating the wave file. VST plugins can be added to the stream at various locations.

With the new bass lib (i also use bassmix24) and bass.net 24 it takes more than 10 minutes to write 8 mono channels to one stereo channel with the WaveWriter class. The audio is about 4 minutes 15 seconds long... The old 2.3 libs worked much faster than real time.

I also noticed some strange things when in playback. Something starts to use 100% cpu sometimes. The application hooks up some DSP_Level dsp's at some points, to monitor output level. Maybe something is wrong there.

Oh, btw, even in managed code it is possible to leak memory... especially when using .net framework classes which use Win32 api or unmanaged calls it is important to use the IDisposable interface so the garbage collector knows what to collect.

Oh, btw 2, I am using Windows XP Pro, VS2005 and VS2008, both .net 2.0 and 3.5.


Regards,

Rob

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.0.0 beta
« Reply #358 on: 12 Mar '08 - 14:28 »
As you can see the "WaveWriter" uses IDisposable. And the only unmanaged resources being used in the class is a BinrayWriter and a BufferedStream - which are disposed savely. Any other managed resources can not lead to memory leaks.

In my little tests I can not experiance such slow processing. So I am affraid, that without any sample I can not find any issues.
Can you may be strip of a little C# sample showing the 'slow' behaviour - and send that to me:
bn [AT] radio42 [DOT] com

Rob Kaandorp

  • Posts: 7
Re: BASS.NET API 2.4.0.0 beta
« Reply #359 on: 12 Mar '08 - 15:37 »
I have been playing a bit further with the problem and seems related to the DSP_StreamCopy dsp. Accidentaly there where some clones of the mixer streams active still when writing the wave file. I disabled the use of these clones and this boosts writing the file to warp 1. :) Also, the memory use is very consistent now.

I will let you know if I find out more about this.

Thanks! Regards, Rob

Invisioner

  • Posts: 1
BASS_FX Mixer
« Reply #360 on: 12 Mar '08 - 16:29 »
Hi folks,

just tried to playing with Tempo / Pitch / Mixing posibilities in BassFX; all works fine in VB6 so lets go on with .net ... but when i try to "downmix" a stereo channel to the left channel in vb.net as follows:

PlyChan = Bass.BASS_StreamCreateFile(Filename, 0, 0, BASSFlag.BASS_DEFAULT)
MixChan = Bass.BASS_ChannelSetFX(PlyChan, BASSFXType.BASS_FX_BFX_MIX, 0)
Mixer = New BASS_BFX_MIX(BASSFXChan.BASS_BFX_CHANALL, BASSFXChan.BASS_BFX_CHANNONE)
If Not Bass.BASS_FXSetParameters(MixChan, Mixer) Then
  Debug.Print(Now.ToString & " BASS_FXSetParameters returned Error " & Bass.BASS_ErrorGetCode.ToString)
End If

this brings me up:

12.03.2008 17:13:12 BASS_FXSetParameters returned Error BASS_ERROR_ILLPARAM

 ??? why the *...?!!  -  please help...

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.0.0 beta
« Reply #361 on: 12 Mar '08 - 16:46 »
Which BASS.NET 2.4 beta version are you using?
Are you sure to use the latest BASS.NET 2.4 beta version?
If not, please try to (re)download it.

Graham

  • Posts: 5
Re: BASS.NET API 2.4.0.0 beta
« Reply #362 on: 18 Mar '08 - 19:56 »
Hi,

Is there a problem with BASS_ChannelGetLevel() when using multi sound devices

Using C# Express 2008, Bass Net 2.4 and Bass 2.4

Psuedo code


Bass.BASS_Init(1, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle, null);

Bass.BASS_Init(2, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle, null);

...

Bass.BASS_SetDevice(1);

int stream = Bass.BASS_StreamCreateFile("afile.mp3", 0, 0, BASSFlag.BASS_DEFAULT);
Bass.BASS_ChannelPlay(stream, false);

float[] level = new float[2];
if (Bass.BASS_ChannelGetLevel(channel, level))
{
  float left  = level[0];
  float right = level[1];
}

...
// move the channel to device 2
Bass.BASS_ChannelSetDevice(stream, 2);

float[] level = new float[2];
if (Bass.BASS_ChannelGetLevel(channel, level))
{
  float left  = level[0];
  float right = level[1];
}

At this point the following exeption is thrown on Bass.BASS_ChannelGetLevel()

System.AccessViolationException was unhandled
 Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Is it just me or is there a problem ?

Regards

Graham.

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.0.0 beta
« Reply #363 on: 18 Mar '08 - 21:31 »
What is "channel" in your code - as you are assigning it before to "stream".
So shouldn't it be:
Bass.BASS_ChannelGetLevel(stream, level) ?

Plus can you try a regular BASS_ChannelGetLevel call as well (the other overload, which only takes the channel handle)?!
« Last Edit: 18 Mar '08 - 21:45 by radio42 »

Graham

  • Posts: 5
Re: BASS.NET API 2.4.0.0 beta
« Reply #364 on: 18 Mar '08 - 22:51 »
radio42,

Yes channel should have been stream in the example, as I said that was just my poor example of pseudo code. I just copied the examples from your help file to try and make the problem easy to understand and missed that. Sorry !

So getting it right this time -

Bass.BASS_Init(1, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle, null);

Bass.BASS_Init(2, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle, null);

...

Bass.BASS_SetDevice(1);

int stream = Bass.BASS_StreamCreateFile("afile.mp3", 0, 0, BASSFlag.BASS_DEFAULT);
Bass.BASS_ChannelPlay(stream, false);

float[] level = new float[2];
if (Bass.BASS_ChannelGetLevel(stream, level))
{
  float left  = level[0];
  float right = level[1];
}

Bass.BASS_ChannelStop(stream);
...
// move the channel to device 2
Bass.BASS_ChannelSetDevice(stream, 2);

float[] level = new float[2];
if (Bass.BASS_ChannelGetLevel(stream, level))
{
  float left  = level[0];
  float right = level[1];
}

At this point the following exception is thrown on Bass.BASS_ChannelGetLevel()

System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

The problem seems to be that after you change a channels device with Bass.BASS_ChannelSetDevice and then consequentially try to use either of the
Bass.BASS_GetChannelLevel calls the above exception occurs.

Sorry for not making things clear in the first post.

Regards

Graham.

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.0.0 beta
« Reply #365 on: 18 Mar '08 - 22:57 »
No problem!

I just tested it myself and spotted the same.
So I guess there is a little bug in the BASS.dll - I'll infom Ian about it.

Graham

  • Posts: 5
Re: BASS.NET API 2.4.0.0 beta
« Reply #366 on: 18 Mar '08 - 23:05 »
Thanks radio42  :)

Ian @ un4seen

  • Administrator
  • Posts: 20436
Re: BASS.NET API 2.4.0.0 beta
« Reply #367 on: 19 Mar '08 - 16:40 »
Yep, this is a BASS 2.4 (Windows) bug. It has been fixed (after another user reported it), but I didn't immediately post an update as I figured the 2.4 final would be released any day. But more stuff to look into subsequently came up. I have now posted the latest version on the 2.4 beta thread.

Rob Kaandorp

  • Posts: 7
Re: BASS.NET API 2.4.0.0 beta
« Reply #368 on: 19 Mar '08 - 17:08 »
Hi there, I've run into a problem encoding wma files. I have tried it following the example from the EncoderWMA helpfile with the call to

Code: [Select]
// encode all the data right away
Utils.DecodeAllData(stream, true);

but this hangs indefinitely (I am writing out a mixing stream).

It works when I do it like this:

Code: [Select]
float[] data = new float[32768];

int length = 0;
while ( outStream.IsActivePlaying )
{
    length = Bass.BASS_ChannelGetData( outStream.InternalStream, data, data.Length );

    if ( length <= 0 )  // end of stream
        break;
}

Note the length <= 0 test, which is necessary to break out of the while loop. Might there be bug somewhere in ChannelGetData, not detecting end of stream or am I missing something?

Regards, Rob
« Last Edit: 19 Mar '08 - 18:22 by Rob Kaandorp »

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.0.0 beta
« Reply #369 on: 20 Mar '08 - 10:09 »
Yep, that might be the case. But to be sure, can you post your code related to the mixer creation from which you are decoding?!

Here is the code I am currently using (and it doesn't contain):
Code: [Select]
public static long DecodeAllData(int channel, bool autoFree)
{
  long decBytes = 0;
  byte[] buffer = new byte[131072];
  while (Bass.BASS_ChannelIsActive(channel) == BASSActive.BASS_ACTIVE_PLAYING)
  {
    // get the decoded sample data
    decBytes += Bass.BASS_ChannelGetData(channel, buffer, 131072);
  }
  if (autoFree)
    Bass.BASS_StreamFree(channel);
  return decBytes;
}
So I am not checking the len value so far - as BASS_ChannelIsActive should return BASS_ACTIVE_STOPPED once the end is reached.

However, to be sure, I'll change the above method to this in the next release:
Code: [Select]
public static long DecodeAllData(int channel, bool autoFree)
{
  int len;
  long decBytes = 0;
  byte[] buffer = new byte[131072];
  while (Bass.BASS_ChannelIsActive(channel) == BASSActive.BASS_ACTIVE_PLAYING)
  {
    // get the decoded sample data
    len = Bass.BASS_ChannelGetData(channel, buffer, 131072);
    if (len < 0)
      break;
    else
      decBytes += len;
  }
  if (autoFree)
    Bass.BASS_StreamFree(channel);
  return decBytes;
}

Many THX for that spotting!

Ian @ un4seen

  • Administrator
  • Posts: 20436
Re: BASS.NET API 2.4.0.0 beta
« Reply #370 on: 20 Mar '08 - 15:52 »
Hi there, I've run into a problem encoding wma files. I have tried it following the example from the EncoderWMA helpfile with the call to

Code: [Select]
// encode all the data right away
Utils.DecodeAllData(stream, true);

but this hangs indefinitely (I am writing out a mixing stream).

Make sure that you're using the BASS_MIXER_END flag in the mixer creation, so that it ends when its source(s) do.

Rob Kaandorp

  • Posts: 7
Re: BASS.NET API 2.4.0.0 beta
« Reply #371 on: 21 Mar '08 - 09:03 »
Thanks Ian, Radio42, that seems to do the trick!

One other thing I'm thinking about.. I know this has been asked before, but I have not seen a solution yet (I might have missed it)... what is the best way to get more performance out of the bass library on multi-core machines? I've created a mixing application with a number of tracks going into a couple of submix streams, mixing together to a stereo stream, with dsps and vst plugins hooked up at various points, but it will only run on one core, which suggests it would be about twice as fast on a core 2 duo when rendering out to a file.

I use this for the initialization of the mixer stream:

Code: [Select]
mixerStream.InternalStream =
                BassMix.BASS_Mixer_StreamCreate( frequency, 2, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE |
                    BASSFlag.BASS_SAMPLE_SOFTWARE | BASSFlag.BASS_MIXER_FILTER | BASSFlag.BASS_MIXER_END );

And bass init is done like this:

Code: [Select]
if ( !Bass.BASS_Init( -1, frequency, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, null ) )
                    throw new Exception( "Bass init error: " + Bass.BASS_ErrorGetCode() );

I'm thinking about creating a couple of threads (maybe one per mixer channel) and pushing stream data to them through a fifo buffer. But I don't know whether this will work. Is this the way to go? Thanks!


Regards, Rob

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.0.0 beta
« Reply #372 on: 21 Mar '08 - 10:26 »
What's you current overall CPU usgae.

I just made some test with multiple mixers and DSP etc.
And at first I thought to get the same effect like you do - only I CPU was used at all.
However, that was at a CPU load of around 5%.

So I kept on adding DSPs to the different mixers...and all of a sudden (when the CPU was increasing) the second CPU was leveraged.
That happend at a total CPU usage of above 15%.

So might it be, that the multiple cores are just used by the OS once it thinks it is worth doing so ;-)

Anyhow, for sure multiple threads are used within BASS etc. - so I guess it is just the OS which decides when to use which CPU...
...and as BASS is typically not using much CPU, hence most of the times it looks like only one is used ;-)

Could that explain your findings?

Rob Kaandorp

  • Posts: 7
Re: BASS.NET API 2.4.0.0 beta
« Reply #373 on: 21 Mar '08 - 11:39 »
Hi Radio42, I'm seeing a consistent 50% cpu load when rendering a 4 minute song to a stereo file. It takes a minute or so to finish. I do Init the bass library with a default audio device, might that has something to do with it? Or can it be related to the Winforms UI thread? I'll try to run the rendering process on a threadpool thread to see if that helps. Thanks!

Regards, Rob

Rob Kaandorp

  • Posts: 7
Re: BASS.NET API 2.4.0.0 beta
« Reply #374 on: 21 Mar '08 - 11:56 »
Hmm weird, I just succeeded to get it to use 70% cpu, while playing the stereo stream out to my soundcard, but when I render the file, it never gets over 50%, the harddisk is pretty idle, so there is no bottleneck there. I have some stuff in the UI to show peak levels etc. so that might be causing the extra cpu load while playing, but that gets turned of when I click the save button in my app...

regards, Rob