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

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.3
« Reply #525 on: 9 Sep '08 - 15:52 »
OK ;-)

ken

  • Posts: 739
Re: BASS.NET API 2.4.1.3
« Reply #526 on: 9 Sep '08 - 17:57 »
Bernd, maybe you know.

Does my C# app conume more memory if I load a audiofile into a MemoryStream and play it with "Bass.BASS_StreamCreateFileUser", compared to just play the audiofile with regualr "Bass.BASS_StreamCreateFile".

I'm experimenting with encrypt my audiofiles (wish works fine) and therefore I need to use "Bass.BASS_StreamCreateFileUser", otherwise I have to decrypt my audio to disk first an then hole idėa is lost... With "Bass.BASS_StreamCreateFileUser" I can decrypt the audio a memorystream.

/Ken

ken

  • Posts: 739
Re: BASS.NET API 2.4.1.3
« Reply #527 on: 9 Sep '08 - 18:37 »
I run into a dilema with my audio in a MemoryStream.

How do I draw I WaveForm. (normaly I do it before I encrypt my audio, but sometimes I need to redraw the WaveForm)

Code: [Select]
WF2 = new WaveForm(FileName, new WAVEFORMPROC(MyWaveFormCallback), null);

/Ken


radio42

  • Posts: 4574
Re: BASS.NET API 2.4.1.3
« Reply #528 on: 9 Sep '08 - 20:26 »
So I guess a MemoryStreams almost consumes as many bytes more than a regular stream as the size of the memory block needed to keep the file in memory ;-)
However, I guess unless you have to load many streams into memory in parallel this shouldn't be a huge problem.

Regarding the WaveForm:
As you have already loaded the file into memory, you might create a second decoding stream handle.
You can then simply use an empty filename in the constructor and the call the RenderStart method, which takes an already prepared decoding stream handle to render the waveform.

ken

  • Posts: 739
Re: BASS.NET API 2.4.1.3
« Reply #529 on: 9 Sep '08 - 21:57 »
Regarding the WaveForm:
As you have already loaded the file into memory, you might create a second decoding stream handle.
You can then simply use an empty filename in the constructor and the call the RenderStart method, which takes an already prepared decoding stream handle to render the waveform.

I hade to make a new "BASS_StreamCreateFileUser" with decode, then it worked just fine.

Thanks!

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.2.0
« Reply #530 on: 10 Sep '08 - 12:56 »
10.09.2008: Version 2.4.2.0 is out.

- BASS: updated to support v2.4.2.0
- BASSenc: updated to support v2.4.2.0
- BASS_ADX: added support for v2.4.0.0
- BassVideo: updated to support v2.4.1.2
- General:
  - AddOn.Tags: WAV BEXT tag reading added
  - AddOn.Tags: tagType field added to the TAG_INFO structure

Note: BASS and BASSenc v2.4.2.0 will probably be release next week, so this BASS.NET release already contains these future versions, as I will not be available for the next 4 weeks - as I am on holiday ;-)
That's why I decided to release this BASS.NET version already now.
However, this BASS.NET version should also work just fine with all current versions of BASS and its add-ons!

ken

  • Posts: 739
Re: BASS.NET API 2.4.2.0
« Reply #531 on: 18 Sep '08 - 18:34 »
How can I send a stream (like the LiveFX) eample over a local network with low latency. I don't want to use WMA, Shoutcast or like that. I need lower delay.

sure on the "reciver" I use BASS_StreamCreateFileUser, but how do I get the bytes and safly send them over TCP/IP?


ospring

  • Posts: 2
Re: BASS.NET API 2.4.2.0
« Reply #532 on: 6 Oct '08 - 10:25 »
Hi,

I have a mass storage application that use BASS to recognize sound formats (sample, duration, frequency...) and cuts PCM files in multiples sub files. This application is written in .NET 1.1 and is pretty big. I have used BASS.net 2.3 to use bass 2.3 api. But I have experienced some problems with the 2.3 version on some wave files (with special chunks) that seems to be solved in 2.4 bass lib.
However you have stopped .NET 1.1 support for the 2.4 BASS.NET assembly. So I am stuck and can't easily change to the 2.4 BASS lib.
I cannot reasonably upgrade my application to 2.0 framework because my application is huge and it will take too much time.

Do you have any solution that will help using 2.4 bass lib with .NET 1.1 framework ? I do not use many BASS functions / structures :

BASS_Init
BASS_INFO
BASS_PluginLoad
BASS_StreamCreateFile
BASS_ErrorGetCode()
BASS_ChannelBytes2Seconds
BASS_ChannelSeconds2Bytes
BASS_ChannelIsActive
BASS_ChannelGetData
BASS_ChannelGetLength
BASS_ChannelGetPosition
BASS_ChannelGetData
BASS_CHANNELINFO
BASS_StreamGetFilePosition
BASS_ChannelGetInfo
BASS_ChannelGetAttributes

So maybe using the bass.net 2.3 source code for .NET 1.1 could be changed to use the new 2.4 API... Any other ideas ?

Thank you for your help

O_Spring



field33P

  • Posts: 17
Re: BASS.NET API 2.4.2.0
« Reply #533 on: 15 Oct '08 - 10:20 »
I have built a program that uses 2 decks, but if deck 1 has played and when I want to play deck 2, it can't play. This also happens when I try it with deck 1.
The error is BASS_ERROR_ALREADY.

my code (VB.NET):
Loading Deck 1:
Code: [Select]
        OpenFileDialog1.ShowDialog()
        If (OpenFileDialog1.FileName = "") Then

        Else
            If Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, Nothing) Then
                ' create a stream channel from a file
                deck1 = Bass.BASS_StreamCreateFile(OpenFileDialog1.FileName, 0, 0, BASSFlag.BASS_DEFAULT)
                Label1.Text = "DECK 1 GELADEN"
            End If
        End If
Loading deck 2:
Code: [Select]
        OpenFileDialog1.ShowDialog()
        If (OpenFileDialog1.FileName = "") Then

        Else
            If Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, Nothing) Then
                ' create a stream channel from a file
                deck2 = Bass.BASS_StreamCreateFile(OpenFileDialog1.FileName, 0, 0, BASSFlag.BASS_DEFAULT)
                Label2.Text = "DECK 2 GELADEN"

            End If
        End If
Play Deck 1:
Code: [Select]
        If deck1 <> 0 Then
            Bass.BASS_ChannelPlay(deck1, False)
            Label1.Text = "DECK 1 ACTIEF"
        Else
            Label1.Text = "DECK 1 KAN NIET AFSPELEN"
        End If
Play Deck 2:
Code: [Select]
        If deck2 <> 0 Then
            Bass.BASS_ChannelPlay(deck2, False)
            Label2.Text = "DECK 2 ACTIEF"
        Else
            Label2.Text = "DECK 2 KAN NIET AFSPELEN"
            MsgBox("BASS retourneerde: " + Bass.BASS_ErrorGetCode().ToString())
        End If
Is there something wrong with my code?

Chris

  • Posts: 1808
Re: BASS.NET API 2.4.2.0
« Reply #534 on: 15 Oct '08 - 10:27 »
Hi
 yep.....there is a error

on formCreate
  Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, Nothing)

onform destroy
  Bass.Bass_Free()

Chris

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.2.0
« Reply #535 on: 15 Oct '08 - 10:47 »
As Chris already mentioned, you should not initialize BASS twice for the same output device.
In your code you are getting the error code, because BASS was already initialized ;-)

field33P

  • Posts: 17
Re: BASS.NET API 2.4.2.0
« Reply #536 on: 15 Oct '08 - 10:59 »
Hi
 yep.....there is a error

on formCreate
  Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, Nothing)

onform destroy
  Bass.Bass_Free()

Chris
Thanks for helping me out. I'm going to patch this.

ken

  • Posts: 739
Re: BASS.NET API 2.4.2.0
« Reply #537 on: 20 Oct '08 - 17:19 »
Bernd,

Is there a way to "GetCuePoints" from a audiofile without rendering the waveform. I need to speed it up and have no need for a waveform in this case.  I just nee "Start" and "End" positions.


/Ken

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.2.0
« Reply #538 on: 20 Oct '08 - 17:35 »
Yepp,
In 2.4.x I added a new methof to the "Utils" namespace called: "DetectCuePoints" - guess that's what you are looking for ;-)

ken

  • Posts: 739
Re: BASS.NET API 2.4.2.0
« Reply #539 on: 20 Oct '08 - 17:50 »
Yepp,
In 2.4.x I added a new methof to the "Utils" namespace called: "DetectCuePoints" - guess that's what you are looking for ;-)

Sweet! Works great, and I get the cue's in seconds, fantastic!


ken

  • Posts: 739
Re: BASS.NET API 2.4.2.0
« Reply #540 on: 24 Oct '08 - 10:06 »

I'm trying the updated title from "BroadCast.Update" method when streaming WMA, but it's not working for me.

Streaming ShoutCast/Icecast the UpdateTitle works fine, but not in WMA.

Here is what I found out. If I listen (in Windows MediaPlayer) on my WMA stream (from your "Streaming" example) and update Title, it shows in MediaPlayer, but in the "big black window"?!. 

But if I use the your "NetRadio" example I can't se e the Titleupdate. (title update works fine on IceCast/Shoutcast streams). 

Any ideas Bernd?

/Ken



radio42

  • Posts: 4574
Re: BASS.NET API 2.4.2.0
« Reply #541 on: 24 Oct '08 - 14:19 »
With WMA internet streams you can only change the "CAPTION" - which are shown in the "big black window" as you found out correctly.
That's what the BroadCast.Update method is doing with a WMAcast instance.

So WMA broadcast streams doesn't contain regular Title updates like SHOUTcast or ICEcast.
So in the NetRadio example I was only using standard META sync. But to also receive WMA meta syncs, you would need to use the BASS_SYNC_WMA_META.

ken

  • Posts: 739
Re: BASS.NET API 2.4.2.0
« Reply #542 on: 24 Oct '08 - 16:00 »

So in the NetRadio example I was only using standard META sync. But to also receive WMA meta syncs, you would need to use the BASS_SYNC_WMA_META.

Thanks! easyis was to do this:
Code: [Select]
foreach (string child in _tagInfo.NativeTags)
                {
                    if (child.StartsWith("CAPTION"))
                    {
                        Console.WriteLine("Title: " + child.Replace("CAPTION=", ""));
                        break;
                    }
                }

Nicolįs

  • Guest
Re: BASS.NET API 2.4.2.0
« Reply #543 on: 27 Oct '08 - 17:07 »

Hi, i need help..

My problem is that i need to play a different audio files (mp3) at the same time for different sound cards!!

A Friend tell me that i can fix my problem with the Bass.Net component, please give me some example or some idea..

Thanks!!

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.2.0
« Reply #544 on: 28 Oct '08 - 08:13 »
Please take a look to the BASS.NET documentation. See the "BASS_SetDevice" method in the Bass namespace this method also contains an example in C# and VB.Net

gbronzer

  • Posts: 1
Re: BASS.NET API 2.4.2.0
« Reply #545 on: 30 Oct '08 - 04:36 »
Hi All,

I'm just getting started with BASS.NET. I'm adapting an existing music player that picks songs on the fly from a database based on various criteria. I want to stream these to an ICECAST server over the net. However, I'm running into trouble tying the reading of the MP3 file to the lame encoder -> broadcast. I can get it to work, but it also plays the stream over the speakers. I gather it's related to using BASS_ChannelPlay, but I'm not sure if there's a simple way around this. Here's the gist of the code:

Code: [Select]
                miStream = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_MIXER_NONSTOP);

                ... code that ties miStream to a broadcast object via a lame encoder and icecast server

                // Add song to the mixer
                int _stream = Bass.BASS_StreamCreateFile(msFilePath, 0L, 0L, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);

                if (!BassMix.BASS_Mixer_StreamAddChannel(miStream, _stream, BASSFlag.BASS_MIXER_DOWNMIX ))
                {
                    MessageBox.Show("Couldn't add mixer channel.");
                    Console.WriteLine(Bass.BASS_ErrorGetCode());
                    Stop();
                    return;
                }

                Bass.BASS_ChannelPlay(miStream, false)

So is there a way to prevent this from playing over the speakers? Do I have to use GetChannelData instead? If so, does anyone have any good examples of feeding the data from a GetChannelData into a mixer channel for output? Don't you lose the AutoFree option in that case, and wouldn't that make it a lot harder to crossfade two files?

Thanks

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.2.0
« Reply #546 on: 30 Oct '08 - 08:26 »
All you said is actually correct.
You would have to make the mixer channel (miStream) a decoding one (add the BASS_DECODE flag when creating the stream).
Instead of playing the mixer stream you would then need to call BASS_ChannelGetData periodically on the mixer. By doing so you also query the data from any sources added to the mixer (so there is no extra need to feed any data from the sources to the mixer).
Decoding streams can not use the AUTOFREE flag, so yes, you would have to do that yourself.

Another more simple option might be to mute the output of the mixer channel via BASS_ChannelSetAttribute using the BASS_ATTRIB_VOL option. This way the mixer output will not be heard, but the broadcasting to the server will still use the original volume.

ken

  • Posts: 739
Re: BASS.NET API 2.4.2.0
« Reply #547 on: 15 Nov '08 - 17:45 »
I try to use  EncoderNeroAAC to stream to ICEcast, but then starting by sound yout studdering !?, EncoderWinampAACplus works just fine

I downloaded the latest "neroAacEnc.exe" (1.3.3.0)

Should I set the NERO parameter different?

Code: [Select]
                EncoderNeroAAC _nero = new EncoderNeroAAC(_audioChannel);
                _nero.InputFile = null;
                _nero.OutputFile = null;
                _nero.NERO_Bitrate = int.Parse(cmbBitrates.Text); //tested with 32,64,96,128
               
                _nero.NERO_UseCBR = false;
                _nero.NERO_2Pass = false;
                _nero.NERO_2PassPeriod = 0;
                _nero.NERO_UseCustomOptionsOnly = false;


                if (_nero.EncoderExists)
                {
                    _encoder = _nero;
                }


radio42

  • Posts: 4574
Re: BASS.NET API 2.4.2.0
« Reply #548 on: 15 Nov '08 - 18:15 »
EncoderNeroAAC can not be use for streaming, as it doesn't support STDOUT.
So EncoderWinampAACplus is the only encoder I know of which can be used for streaming.

ken

  • Posts: 739
Re: BASS.NET API 2.4.2.0
« Reply #549 on: 16 Nov '08 - 02:30 »
OK, thanks Bernd.