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

mcooper

  • Posts: 38
Re: BASS.NET API 2.4.11.1
« Reply #1350 on: 27 Jul '15 - 16:19 »
Thank you, that works perfectly.  With BASS_DATA_FLOAT I could get the level for a time span. There isn't any way to do this with an FFT function is there?

Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: BASS.NET API 2.4.11.1
« Reply #1351 on: 27 Jul '15 - 17:45 »
The requested FFT size will determine the time span of the processed data. For example, a 512 sample FFT with a sample rate of 44100 Hz is 11.6ms (512/44100).

mcooper

  • Posts: 38
Re: BASS.NET API 2.4.11.1
« Reply #1352 on: 28 Jul '15 - 17:20 »
Thank you.  I've found that with these peak values, low > mid > high in most cases.  There are many more values in the high range, so if I sum the values in each range, I usually get the opposite result.

I'm trying display a visualisation showing the different amplitudes, but it doesn't look quite right using the peak values (or the sum).

Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: BASS.NET API 2.4.11.1
« Reply #1353 on: 29 Jul '15 - 17:28 »
There will usually be more energy in the low frequencies than the high ones. To confirm that the display is behaving as expected, you could try playing a sine sweep (turn the volume down to save your speakers/ears) and check that the peak level is the same in each band.

mrRdo

  • Posts: 15
Re: BASS.NET API 2.4.11.1
« Reply #1354 on: 11 Aug '15 - 14:35 »
Hi,

I have been having a problem with a streaming project.  In short, we have a decoding mixer which is consumed by an encoder.  This feeds an icecast server.  This works very well.

Decoding channels are added to the mixer and play one after each other.  For each track added to the mixer we also add a sync to trigger the next item.

We have noticed that the syncs are being fired earlier than we expect.  Normally between .2 and .3 of a second.

All streams are decoding ones and syncs are therefore have BASS_SYNC_MIXTIME applied.

What could cause the syncs to fire early?

We tried to implement BASS_Mixer_ChannelSetSyncEx, thinking maybe the offset could be useful.  But we just get an exception at the point that the sync would be raised. (using SYNCPROCEX)

Changing the sync back to BASS_Mixer_ChannelSetSync and SYNCPROC works.

The event log shows the following:
Faulting module name: bassmix.dll, version: 2.4.8.0, time stamp: 0x55115d9c
Exception code: 0xc0000005
Fault offset: 0x000017bd
Faulting process id: 0x372c


Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: BASS.NET API 2.4.11.1
« Reply #1355 on: 11 Aug '15 - 17:06 »
It sounds like you want the mixer to process sources gaplessly one after another? If so, you should use a BASS_SYNC_END sync on the mixer (not the source), to have the sync triggered when the mixer reaches the end. You don't want the sync triggered when the source reaches the end because that will be slightly before the mixer does, ie. the mixer hasn't processed the source's final data yet, so there would be some overlap if you add the next source to the mix then.

It could look something like this:

Code: [Select]
BASS_ChannelSetSync(mixer, BASS_SYNC_END|BASS_SYNC_MIXTIME, 0, EndSyncProc, 0); // set a mixtime END sync on the mixer

...

void CALLBACK EndSyncProc(HSYNC handle, DWORD channel, DWORD data, void *user)
{
if (nextsource) { // got another source to play
BASS_Mixer_StreamAddChannel(mixer, nextsource, 0); // add it to the mixer
BASS_ChannelSetPosition(mixer, 0, BASS_POS_BYTE); // reset the mixer to continue (it's currently ended)
}
}

Note that in order for the BASS_SYNC_END sync to be triggered when the mixer reaches the end of its sources, the BASS_MIXER_END flag needs to be used in the BASS_Mixer_StreamCreate call.

mrRdo

  • Posts: 15
Re: BASS.NET API 2.4.11.1
« Reply #1356 on: 11 Aug '15 - 18:18 »
Hi Ian,

I'm not after gapless playback, as much as we use a position sync to overlap tracks.  The position we set for each track is different.  The sync is always called, and the whole thing works nearly exactly as we want.

The sync callback launches a new thread which in turn adds the next track into the mixer, etc, etc, etc.

We have noticed that the sync occurs slightly early.  I've tested this by playing some audio that is 5 seconds long, with a sync set at exactly 3 seconds.  We add into the mixer.  It plays.  The sync callback happens at about 2.8 or 2.9 seconds, not 3 seconds.

As I say, our mixer is a non-stop and decoding.

Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: BASS.NET API 2.4.11.1
« Reply #1357 on: 12 Aug '15 - 16:34 »
Oh, OK. Are you setting the BASS_SYNC_POS sync on the source or the mixer? It should be the mixer, for the same reason as above with the BASS_SYNC_END sync. You could do it something like this:

Code: [Select]
double synctime=BASS_ChannelBytes2Seconds(source, syncpos); // convert source sync pos to seconds
syncpos=BASS_ChannelSeconds2Bytes(mixer, synctime) // convert it to mixer bytes
+BASS_ChannelGetPosition(mixer, BASS_POS_BYTE|BASS_POS_DECODE); // add mixer's current position
BASS_ChannelSetSync(mixer, BASS_SYNC_POS|BASS_SYNC_MIXTIME, syncpoc, PosSyncProc, 0); // set the sync on the mixer

The BASS_ChannelSetPosition call isn't needed in the SYNCPROC in this case, as the mixer hasn't ended.

jasona

  • Posts: 35
Re: BASS.NET API 2.4.11.1
« Reply #1358 on: 19 Aug '15 - 01:54 »
Hello,

I've been having trouble using the ShoutCAST class with UseBass = false. I am trying to connect to a ShoutCAST v2 server with a Username and Password. With UseBass = true, this logs in correctly. With UseBass = false, the login fails with 'incorrect username and password'. Decompiling the assembly I can see that the Username field is used when passed to BASS_Encode_CastInit internally (for UseBass = true), but seems to never be used when using UseBass = false. SID also seems to be ignored.

This sounds like a bug, or am I using it wrong?

Any help here would be appreciated.

Thanks,
Jason

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.11.1
« Reply #1359 on: 19 Aug '15 - 08:34 »
No, SHOUTcast v2 isn't supported internally (with "UseBass = false").

The "UseBass" option is there for backward compatibility reasons and should actually be always left to true!

Dickal91

  • Guest
Re: BASS.NET API 2.4.11.1
« Reply #1360 on: 10 Dec '15 - 12:55 »
Hello.
Help please.
How I can play ogg files from bass?
What add-ons need?
if you may give code on c#, example.

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.11.1
« Reply #1361 on: 10 Dec '15 - 14:37 »
No add-on is needed, the native bass.dll already supports OGG.

Take a look to the "My First BASS" example given in the documentation...
http://www.bass.radio42.com/help/html/b8b8a713-7af4-465e-a612-1acd769d4639.htm#Using


Dickal91

  • Guest
Re: BASS.NET API 2.4.11.1
« Reply #1362 on: 10 Dec '15 - 14:53 »
I had played some ogg's.
But one ogg has 3 audio tracks in itself.
How can I choose audio track?

Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: BASS.NET API 2.4.11.1
« Reply #1363 on: 16 Dec '15 - 16:59 »
You can use the BASS_POS_OGG option with BASS_ChannelSetPosition to seek to a particular bitstream in a chained OGG file (0=first). For example:

Code: [Select]
Bass.BASS_ChannelSetPosition(ogghandle, 1, BASSMode.BASS_POS_OGG); // seek to 2nd bitstream

By default, BASS will play all of the bitstreams in sequence. If you want playback to stop at the end of a bitstream, you can use a "mixtime" BASS_SYNC_OGG_CHANGE sync to do that, by calling BASS_ChannelStop in the SYNCPROC callback. It could look something like this:

Code: [Select]
_mySync = new SYNCPROC(OggChangeSync);
Bass.BASS_ChannelSetSync(ogghandle, BASSSync.BASS_SYNC_OGG_CHANGE|BASSSync.BASS_SYNC_MIXTIME, 0, _mySync, IntPtr.Zero);

...

private void OggChangeSync(int handle, int channel, int data, IntPtr user)
{
Bass.BASS_ChannelStop(channel); // end the OGG stream
}

Please see the documentation for details on the aforementioned functions/options.

Dickal

  • Posts: 7
Re: BASS.NET API 2.4.11.1
« Reply #1364 on: 22 Dec '15 - 13:46 »
Hello.
I have got a code:
Stream = Bass.BASS_SampleLoad(minusbytes, 0, minusbytes.Length, 2, BASSFlag.BASS_STREAM_DECODE);
Stream = Bass.BASS_SampleGetChannel(Stream,true);
And make Bass.Channel_Play(Stream); It works

But I need use BassFx for change BASS_ATTRIB_TEMPO and BASS_ATTRIB_TEMPO_PITCH

StreamFx = BassFx.BASS_FX_TempoCreate(Stream, BASSFlag.BASS_DEFAULT);


With mp3 file on disk it works:
Stream = Bass.BASS_StreamCreateFile(Mp3Path, 0, 0, BASSFlag.BASS_STREAM_DECODE);
StreamFx = BassFx.BASS_FX_TempoCreate(Stream, BASSFlag.BASS_FX_FREESOURCE);

Tell me please how use BASS_SampleLoad with BassFx.

Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: BASS.NET API 2.4.11.1
« Reply #1365 on: 22 Dec '15 - 17:21 »
It isn't currently possible to apply DSP/FX to samples, so BASS_FX can't be used with them. You will need to create streams for that instead, eg. use BASS_StreamCreateFile instead of BASS_SampleLoad.

Dickal

  • Posts: 7
Re: BASS.NET API 2.4.11.1
« Reply #1366 on: 22 Dec '15 - 20:23 »
So if I have a byte array, I need save them on disk, then use BASS_StreamCreateFile only?
There is no way to use BassFX with byte array?

Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: BASS.NET API 2.4.11.1
« Reply #1367 on: 23 Dec '15 - 17:33 »
A file in memory can also be passed to BASS_StreamCreateFile (like BASS_SampleLoad). Here's the relevant page in the BASS.Net documentation, including an example code snippet:

   www.bass.radio42.com/help/html/0b998163-5a56-a1c3-bf93-e0ad2204c8cc.htm

Please note that the memory needs to persist until BASS_StreamFree is called.

Dickal

  • Posts: 7
Re: BASS.NET API 2.4.11.1
« Reply #1368 on: 11 Feb '16 - 12:03 »
Hello.
Can I play 2 or 3 same mp3's without robo-voice? How can I play them synchronously, without delay?

Now I init streams, then do:
foreach(var song in songs)
{
   Bass.BASS_ChannelPlay(song.Stream, false);
}

Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: BASS.NET API 2.4.11.1
« Reply #1369 on: 16 Feb '16 - 14:18 »
You can start multiple streams simultaneously by linking them via BASS_ChannelSetLink, something like this:

Code: [Select]
for(int n=1; n<songs.Length; n++)
{
   Bass.BASS_ChannelSetLink(song[0].Stream, song[n].Stream); // link n'th stream to 1st stream
}
Bass.BASS_ChannelPlay(song[0].Stream, false); // start them all

If you're using Windows, then linking the streams isn't actually guaranteed to have them start exactly together (it is guaranteed on other platforms), but it will be closer than calling BASS_ChannelPlay on each of them individually. If you need the streams to be perfectly in sync on Windows, then you could use the BASSmix add-on to achieve that, ie. create a mixer and plug them into that.

malucul

  • Guest
Re: BASS.NET API 2.4.11.1
« Reply #1370 on: 28 Feb '16 - 08:18 »
I am having some trouble with BASS_TAG_GetFromFile. I'm only getting a successful output some of the time. Out of nearly 2000 files, I get a sucessful call to this function about 10% of the time. I've checked several of the files and they do all appear to have valid tag information (mostly MP3s).

Any suggestions?

As an aside, would it be possible to get slightly more return information from this method call in future versions? Just getting a boolean from a black box isn't terribly helpful for troubleshooting.

malucul

  • Guest
Re: BASS.NET API 2.4.11.1
« Reply #1371 on: 28 Feb '16 - 10:26 »
I am having some trouble with BASS_TAG_GetFromFile. I'm only getting a successful output some of the time. Out of nearly 2000 files, I get a sucessful call to this function about 10% of the time. I've checked several of the files and they do all appear to have valid tag information (mostly MP3s).

Any suggestions?

As an aside, would it be possible to get slightly more return information from this method call in future versions? Just getting a boolean from a black box isn't terribly helpful for troubleshooting.

Okay, I did some more digging.

The documentation states the ID3V2 tags will be read before ID3V1 tags, but having looked at a disassembly of Bass.Net.Compact.dll (2.4.11.1) this does not seem to be the case at all...

Code: [Select]
                case BASSTag.BASS_TAG_ID3V2:
                {
                    IntPtr ptr2 = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3);
                    if (ptr2 != IntPtr.Zero)
                    {
                        c(ptr2, tags);
                        tags.a();
                    }
                    IntPtr ptr3 = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_APE);
                    if (ptr3 != IntPtr.Zero)
                    {
                        tags.UpdateFromMETA(ptr3, true, false);
                        if (ReadPictureTAGs)
                        {
                            f(stream, tags);
                        }
                        tags.a();
                    }
                    flag = b(data, tags);
                    break;
                }

As you can see, the code never asks BASS for the ID3V2 tags, it only goes for the ID3V1 tags. This would seem to be at complete odds with what the documentation states.

So which is correct? Should this be supported as per the docs, or should the docs not be making mention of ID3V2? In the latter case, does anyone have a quick workaround?

malucul

  • Guest
Re: BASS.NET API 2.4.11.1
« Reply #1372 on: 28 Feb '16 - 13:39 »
---SNIP---

As you can see, the code never asks BASS for the ID3V2 tags, it only goes for the ID3V1 tags. This would seem to be at complete odds with what the documentation states.

So which is correct? Should this be supported as per the docs, or should the docs not be making mention of ID3V2? In the latter case, does anyone have a quick workaround?

Hmm okay, I take that back. While I'm still not 100% sure I understand how the disassembly works, it seems that setting the broken latin option on BASSNet clears up a lot of my issues.

radio42

  • Posts: 4574
Re: BASS.NET API 2.4.11.1
« Reply #1373 on: 28 Feb '16 - 14:10 »
Beside the fact, that you are not allowed to disassemble the Bass.Net code (without breaking the license and as such losing the right to use it) - yes, you did oversee an important part in the code, which is above the place you looked at, but I am happy, that setting the broken latin option helped out ;-)
So please blame the creator of your MP3 files to not follow the ID3v2 documentaion and incorrectly writing the TAGs ;-)

hwahrmann

  • Posts: 137
Re: BASS.NET API 2.4.11.1
« Reply #1374 on: 29 Feb '16 - 18:58 »
@radio42: do you already have a beta version of Bass.net, which supports the HLS plugin?