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

ken

  • Posts: 739
Re: BASS.NET API 2.4.0.4
« Reply #450 on: 2 Jun '08 - 08:29 »
Bernd you did it!

Now it works (with bytes and Seconds) and after playback!  I nearly go crazy before...

Thanks again!

/Ken

ken

  • Posts: 739
Re: BASS.NET API 2.4.0.4
« Reply #451 on: 5 Jun '08 - 14:27 »
Bernd I have a new problem...

I alter three streams into a BassMixer, The code works great but my application exe grows all the time, mem leak or my bad code.



I init like this:
Code: [Select]

if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_SPEAKERS, IntPtr.Zero, null))
            {
                // init the winamp DSP plugin
                BassWaDsp.BASS_WADSP_Init(IntPtr.Zero);
            }
            else
            {
                MessageBox.Show(this, "Bass_Init error!");
                this.Close();
                return;

            }
            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 200);
            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 20);

            //Create a mixer
            _mixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_MIXER_NONSTOP);



And Adding stream like this:

Code: [Select]


BassMix.BASS_Mixer_ChannelRemove(_channel1);
            BassMix.BASS_Mixer_ChannelRemoveSync(_channel1, _P1sync1);
            BassMix.BASS_Mixer_ChannelRemoveSync(_channel1, _P1sync2);
            BassMix.BASS_Mixer_ChannelRemoveSync(_channel1, _P1sync3);

            _channel1 = Bass.BASS_StreamCreateFile(filename, 0L, 0L, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);

                BassMix.BASS_Mixer_StreamAddChannel(_mixer, _channel1, BASSFlag.BASS_MIXER_DOWNMIX | BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_MIXER_PAUSE);
                        long _mixPos = Bass.BASS_ChannelSeconds2Bytes(_channel1, _SongsCollection[_curentPlaylistPos].MixCue.TotalSeconds - 0.5);

            _Track1Sync = new SYNCPROC(OnTrackSyncT1);

            _P1sync1 = BassMix.BASS_Mixer_ChannelSetSync(_channel1, BASSSync.BASS_SYNC_POS, _mixPos, _Track1Sync, new IntPtr(0));
            _P1sync2 = BassMix.BASS_Mixer_ChannelSetSync(_channel1, BASSSync.BASS_SYNC_END, 0, _Track1Sync, new IntPtr(1));
            _P1sync3 = BassMix.BASS_Mixer_ChannelSetSync(_channel1, BASSSync.BASS_SYNC_SLIDE, 0, _Track1Sync, new IntPtr(2));



Starting playback by:

Code: [Select]
BassMix.BASS_Mixer_ChannelFlags(_channel1, BASSFlag.BASS_DEFAULT, BASSFlag.BASS_MIXER_PAUSE);

I've tried with 
Code: [Select]
GC.Collect();   but stil grow in mem size.

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.0.4
« Reply #452 on: 5 Jun '08 - 16:05 »
Can you explain a bit more what exactly is growing in size?
a) the memory usage of your application
b) the size of your exe when you compile it

And it is a) - what I assume - where do you see it it growing exactly?
If you are using the Windows Taskmanager to monitor your memory usage - which column in the process view are you using?

Also which parts of your code do you call more than once?
Also the Init part? If yes - that would explain it.
If the Init part is only called once and you just call the 'Add stream to mixer' stuff multiple times - I must assume, that there is something else not being freed.

As in the code you posted there is no real chance for any additional memory leaks - they are all plain BASS functions being called and there is nothing .Net specific in addition which is being called.

So the only thing I can think of would be, that the AUTOFREE flag is not working correctly with the BASS_Mixer_StreamAddChannel function.

You might try to call BASS_ChannelFree(channel1) after you removed it from the mixer manually and see if that solves the problem.

ken

  • Posts: 739
Re: BASS.NET API 2.4.0.4
« Reply #453 on: 5 Jun '08 - 17:18 »
Bernd ,

It looks like my app "eats" memory, I got message "out of memory" after a few hours playing.

I e-mailed you a stripped down but working application/code (don't want to post it here). The playback is the same as in my full app.

/Ken

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.0.4
« Reply #454 on: 7 Jun '08 - 12:36 »
@All,

the memory leak bug Ken reported seemd to b related to the ".Net Framework 3.5 SP1 Beta" only.
So it's not a BASS or BASS.NET related thing. Under .Net 2.0, 3.0 or 3.5 final all is fine.

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.0
« Reply #455 on: 11 Jun '08 - 17:39 »
11.06.2008: Version 2.4.1.0 is out!

BASS: updated to support v2.4.1.1
BASSenc: updated to support v2.4.0.1
BassVideo: updated to support v2.4.0.9
BASSvis: updated to support v2.4.0.4
BASSASIO: updated to support final v1.0.0.0
General:
  - !Breaking Change!: ArrayList and Hashtable changed to generics using List and Dictionary
      e.g. for BASS_PluginLoadDirectory or for WaveForm.Wave.marker and WaveForm.Wave.beats
  - WaveForm: GainFactor property added a bug-fix with the AddMarker overloads added supporting seconds

ken

  • Posts: 739
Re: BASS.NET API 2.4.1.0
« Reply #456 on: 19 Jun '08 - 13:43 »
I use BroadCast / UpdateTitle in the streaming part of my app. And I wonder is there a limit size of the string that is send to "UpdateTitle" ?

Casue in WMA there is no problem, but MP3/Shoutcast my string gets truncated when I look at it in WinAmp. The string is aprox 300 char long.


radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.0
« Reply #457 on: 19 Jun '08 - 13:46 »
The limit does not exist in BASS.NET, but probably in SHOUTcast itself truncating them.
I guess the limit was 256 chars for SHOUTcast.
The same will happen with the "genre" setting, which I guess was limiuted to 56 chars on the SHOUTcast side.

ken

  • Posts: 739
Re: BASS.NET API 2.4.1.0
« Reply #458 on: 19 Jun '08 - 13:55 »
I did't think the limit was in BASS.NET, just maby you know... There is no note on it in Bassenc documentation, and I get no errors back.


ken

  • Posts: 739
Re: BASS.NET API 2.4.1.0
« Reply #459 on: 19 Jun '08 - 14:39 »
this strange... I get a 160 chars string truncated after 83 chars.

And I tested a app that uses BASS that not trunkate the string at all (EdCast, http://www.oddsock.org/tools/edcast/)

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.0
« Reply #460 on: 19 Jun '08 - 14:58 »
Are you maybe using and 'funny' Unicode characters in your title? - since the native BASS_Encode_CastSetTitle only takes an ANSI string as a parameter those might be stripped?
For anything else I don't see anything which truncates a string in BASS.NET

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.1
« Reply #461 on: 26 Jun '08 - 14:07 »
26.06.2008: Version 2.4.1.1 is out!

BASSenc: updated to support v2.4.1.1
BASSCD: updated to support v2.4.1.0
BASS_WV: updated to support v2.4.1.0
BASSvis: updated to support v2.4.0.5
General: "Utils.UI_CreateDelegate" removed to make BASS.NET compatible with the .Net compact framework
     

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

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


ken

  • Posts: 739
Re: BASS.NET API 2.4.1.1
« Reply #462 on: 26 Jun '08 - 16:01 »
What did you update for "BASSenc v2.4.1.1", new features ?

/Ken

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.1
« Reply #463 on: 26 Jun '08 - 16:15 »
Nothing - but the version number of BASSenc has changed to 2.4.1.1...so as I always mention the latest supported BASS/add-on versions - I listed them here.
Same goes with BASSCD and BASS_WV....no API changes here.

Knight_Rider

  • Posts: 131
Re: BASS.NET API 2.4.1.1
« Reply #464 on: 5 Jul '08 - 11:11 »
//EDIT: sorry, wrong thread
« Last Edit: 5 Jul '08 - 11:49 by Knight_Rider »

www.fullmm.com

  • Posts: 141
Re: BASS.NET API 2.4.1.1
« Reply #465 on: 8 Jul '08 - 09:57 »
hello radio42

1. when bass_video wich have video encoder and audio extractor api in bass.net arrive

2 do you know enc_aacplus.dll and enc_aacplus.exe is free for commercial or no when i can not find anythink about this

3. do you know how many money i must give to tomson for individual license
isend mail but do not response me yet.

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.1
« Reply #466 on: 8 Jul '08 - 10:36 »
to 1.: in the next days...I am currently implementing the new Bass_Video API

to 2: enc_aacplus.exe is free for commercial use.
enc_aacplus.dll is provided with Winamp and it is not allowed to deliver this lib directly with your app. But this is not my limitation, but a limitation by NullSoft.

to 3: as far as I know it is always a couple of thousand euro/dollar - but I am completly unsure, as they sometimes have individual offers for small projects...so maybe you'll be lucky and pay only a couple of hundred dollars - I absolutly don't know.

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.2
« Reply #467 on: 9 Jul '08 - 16:03 »
09.07.2008: Version 2.4.1.2 is out!

BASSMIDI: updated to support v2.4.1.0
BASSvideo: updated to support v2.4.1.0

That's all ;-)

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

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

ken

  • Posts: 739
Re: BASS.NET API 2.4.1.2
« Reply #468 on: 14 Jul '08 - 15:22 »
I'm trying run my app on Vista 64bit.

When init bass, I get this error:
Quote
"BadImageFormatExeption was unhandled", An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

my init code, I get the messagebox on Bass.BASS_Init row:
Code: [Select]

             BassNet.Registration("blabla", "blabla");

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, null))
            {
                // init the winamp DSP plugin
                //BassWaDsp.BASS_WADSP_Init(IntPtr.Zero);
            }
            else
            {
                MessageBox.Show(this, "Bass_Init error!");
                this.Close();
                return;

            }

Bass it self (C examples) works just fine.

BASS.NET version 2.4.1.0 and the latest version of BASS

Any ideas?
« Last Edit: 14 Jul '08 - 15:24 by ken »

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.2
« Reply #469 on: 14 Jul '08 - 17:04 »
You would have to use the x64 version of the BASS.dll !
So I guess you are using the standard 32-bit (x86) version of the bass.dll

ken

  • Posts: 739
Re: BASS.NET API 2.4.1.2
« Reply #470 on: 14 Jul '08 - 17:51 »
Is there a special version of BASS 64bit? Where can I get that one?

But tell me, why did the BASS examples work on my Vista64, I just downloaded the "regular" BASS lib?

/Ken

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.2
« Reply #471 on: 14 Jul '08 - 17:58 »
The x64 versions must be obtained from Ian...I don't know if he placed them here somewhere?

The native BASS examples are written in native C/C++ and such contain a native x86 .exe header. And such the app is directly known to be a 32-bit version and such execute as a 32-bit app.
BASS.NET is compiled for "Any CPU" which means the .Net runtime service detects both header versions x86 and x64 and executes them dependend on the OS and such on 64-bit Windows it will execute as a plain 64-bit executable. Unfortunately you can not mit 64-bit and 32-bit exe's and dll's.

ken

  • Posts: 739
Re: BASS.NET API 2.4.1.2
« Reply #472 on: 14 Jul '08 - 20:38 »
OK, Thanks Bernd!


Another question regarding ASIO.

I'm trying to add a input from my ASIO soundcard (from a microphone needing low latency) as a channel on a BASSmixer. But When adding my input channel I only get hum/noice.  (recording with your ASIO recording example works fine, so the input source works...)

Here is how I init Bass and the mixer.

Code: [Select]

private BassAsioHandler asio;
private BassAsioHandler asioInput;


/////////


Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 0);
           
            if (Bass.BASS_Init(0, 48000, 0, IntPtr.Zero, null))
            {
                // init the winamp DSP plugin
                BassWaDsp.BASS_WADSP_Init(IntPtr.Zero);
            }
            else
            {
                MessageBox.Show(this, "Bass_Init error!");
                return;

            }


//Mixer
           _mixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_MIXER_NONSTOP);
            if (_mixer == 0)
            {
                MessageBox.Show(this, "Could not create mixer!");
                Bass.BASS_Free();
                return;
            }


//Asio
              if (_mixer != 0)
                   asio = new BassAsioHandler(0, 0, _mixer);


//Add ASIO input

           asioInput = new BassAsioHandler(true, 0, 0, 2, BASSASIOFormat.BASS_ASIO_FORMAT_16BIT, 44100);

            _inputChannel1 = asioInput.InputChannel;


//Start ASIO

             BassAsio.BASS_ASIO_Start(0);





and I "switching" on/off the inputchannel from the mixer like this:

Code: [Select]

private void checkBox1_Click(object sender, RoutedEventArgs e)
        {
            if (checkBox1.IsChecked.Value)
            {
                BassMix.BASS_Mixer_ChannelRemove(_inputChannel1);
                BassMix.BASS_Mixer_StreamAddChannel(_mixer, _inputChannel1,  BASSFlag.BASS_MIXER_DOWNMIX);
            }
            else
            {
                BassMix.BASS_Mixer_ChannelRemove(_inputChannel1);
            }
        }



First is it possible, if it is, what do I wrong?

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.2
« Reply #473 on: 14 Jul '08 - 21:07 »
I'm not really sure what you are trying to do.
Your mixer channel is also a decoding channel, so what do you do with this one?
And why are you using 2 AsioHandler (asio and asioInput)?

If you want to use the ASIO input and 'route' that to another ASIO output device for full-duplex monitoring, you should use the following in addition to your code:
Code: [Select]
_asioInput.SetFullDuplex(0, BASSFlag.BASS_STREAM_DECODE, false);
BassMix.BASS_Mixer_StreamAddChannel(mixer, inputChannel1, BASSFlag.BASS_MIXER_DOWNMIX);

ken

  • Posts: 739
Re: BASS.NET API 2.4.1.2
« Reply #474 on: 14 Jul '08 - 22:10 »
Yes "rote" is maby the term, here is a gfx...

-- MP3 --- (StreamAddChannel)--\
-- MP3 ----(StreamAddChannel)---- DSP --- Stream
-- INPUT --(StreamAddChannel)-- /

"Input" is lineIn on my ASIO soundcard. And I want that as a chellen in the mixer so it will be processed by my DSP and sendt to the streamer/encoder also.

I don't know why I hade 2 asio handlers... If I only use asio (the first handler in my code) then adding MP3 is working fine. Is just how I add a input channel to the mixer I can't get right.

Sorry but ASIO is a bit complicated. And i'm not sure how to init the input on ASIO and get it working with the mixer. SetDuplex did not worked for me now.