Author Topic: BASS.NET API 2.4.17.5  (Read 1126540 times)

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.7 !
« Reply #250 on: 26 Aug '07 - 21:53 »
Great!

ASIO is fun... specialy your "BassAsioHandler" that makes life so easier... I did use a BassMixerand DSP_StreamCopy and acomplish what i wanted (cueing chanels on a different device), and in ASIO "StreamCopy" is realy perfect cloning of a channel, it plays identic on the other channel even true BassMixer, that comparing to DirectSound is some differens i sync!  I like!

Thanks!


radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.7 !
« Reply #251 on: 26 Aug '07 - 22:05 »
You're welcome - THX!

P.S.: You might also play with the new "DSP_BufferStream" - which also generates a 'clone' of a decoding stream.
That DSP is even a little bit more efficient and faster as the DSP_StreamCopy.
The limitation is, that the "DSP_BufferStream" does not support multiple readers.
Note: If using the "DSP_BufferStream" take care of the "IsOutputBuffered" property - e.g. for Asio this one needs to be set to FALSE.

radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.8 !
« Reply #252 on: 26 Aug '07 - 22:33 »
26.08.2007: Version 2.3.1.8 is out!

AddOn.Tags:
    - bug-fix reading non zero-terminated ID3v1 tags
Misc:
    - EncoderOGG: supporting new oggenc2.84 version (which now accepts 32bit float input from STDIN)
    - EncoderFAAC: now using BASS_ENCODE_FP_24BIT when using 32bit float input from STDIN
      (currently FAAC doesn't like 32bit float input from STDIN)
WaveForm: new volume curve options (e.g. see AddVolumePoint)
                and DrawWave type WAVEFORMDRAWTYPE.HalfMono added
BASSasio: Upgrade supporting final BASSASIO v1.0.0.0
              (ASIOPROC signature change: must now return the number of bytes written)
BASS_VIS: support for version 2.3.2.1 added

jeroenp

  • Posts: 93
Re: BASS .NET API 2.3.1.8 !
« Reply #253 on: 28 Aug '07 - 12:46 »
26.08.2007: Version 2.3.1.8 is out!
...
BASSasio: Upgrade supporting final BASSASIO v1.0.0.0
              (ASIOPROC signature change: must now return the number of bytes written)

It seemed that after an uninstall of 2.3.1.7 and an install of 2.3.1.8, the GAC still contains the 2.3.1.7 assembly.
Actually, thas was my fault, as I forgot Bass.Net.dll is not put into the GAC by default.

This resulted in me not noticing the ASIOPROC breaking change didn't show up after a recompile (and in fact no new functionality was seen at all).

So: can you install it into the GAC by default? and uninstall from GAC upon uninstallation?


Oh, and thanks for fixing the BASS_ASIO_GetDeviceCount() and BASS_ASIO_GetDeviceDescriptions() issues!

Regards,

--jeroen


radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.8 !
« Reply #254 on: 28 Aug '07 - 12:57 »
The install doesn't put anything into the GAC (as you mentioned) - so there would also be no need to remove it ;-)
So what's the point in ´putting it also into the GAC at all?

jeroenp

  • Posts: 93
Re: BASS .NET API 2.3.1.8 !
« Reply #255 on: 28 Aug '07 - 19:20 »
Signed libraries should go into the GAC, applications should go into their own directory.

--jeroen

radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.8 !
« Reply #256 on: 28 Aug '07 - 19:54 »
That's just a recommendation - but it doesn't gain anything.
Many libs don't place theirself to the GAC.
So the question stays: what is the real advantage of having a lib in the GAC - since that would anyhow only have an effect to the development side of the world - but for me no real bennefit.

BassPassion

  • Posts: 36
Re: BASS .NET API 2.3.1.8 !
« Reply #257 on: 28 Aug '07 - 22:42 »
That's just a recommendation - but it doesn't gain anything.
Many libs don't place theirself to the GAC.
So the question stays: what is the real advantage of having a lib in the GAC - since that would anyhow only have an effect to the development side of the world - but for me no real bennefit.

There are scenarios where it is preferably to have an assembly in the GAC.
For instance, if you are compiling the assemblies with NGen, they should be placed in the GAC.
Otherwise the CLR loader has to verify the assembly; compute the hash and compare the assembly's signature at load-time.
These steps are not neccessary for the CLR-loader if the assemby is in the GAC.

Albeit the gain is small in today's fast CPU's/HD's, but it does exist.

/Magnus

radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.8 !
« Reply #258 on: 28 Aug '07 - 22:58 »
Yes, but everyone can install BASS.NET in the GAC if he wants to do so.

By the default installation process I don't do so, since that would require Admin rights - which I can not always ensure, e.g. on Vista.

So I still think it is better to leave the descission to place BASS.NET in the GAC to the developer in question.
So everyone who needs/wants BASS.NET in the GAC ... feel free to do so...

BassPassion

  • Posts: 36
Re: BASS .NET API 2.3.1.8 !
« Reply #259 on: 28 Aug '07 - 23:08 »
Yes, but everyone can install BASS.NET in the GAC if he wants to do so.

By the default installation process I don't do so, since that would require Admin rights - which I can not always ensure, e.g. on Vista.

So I still think it is better to leave the descission to place BASS.NET in the GAC to the developer in question.
So everyone who needs/wants BASS.NET in the GAC ... feel free to do so...

Yes, I forgot to mention that also.
I agree that this is a decision that each developer has to make, wether their assemblies, including the Bass.Net assembly, should be placed in the GAC or not.
I think the Bass.Net installation doesn't need a change in this matter.

Thanks for the good work on the Bass.Net product.

/Magnus

jeroenp

  • Posts: 93
Re: BASS .NET API 2.3.1.8 !
« Reply #260 on: 30 Aug '07 - 09:34 »
So the question stays: what is the real advantage of having a lib in the GAC - since that would anyhow only have an effect to the development side of the world - but for me no real bennefit.

Less overhead, NGENable, easier to maintain.

It would be very nice if this could be an option in the installation.
I know it can be done by hand, but I prefer automatic ways.

--jeroen

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.8 !
« Reply #261 on: 19 Sep '07 - 14:58 »
Recording in Mono?

What is the easyest whay to record in mono?  I got me a great USB microphone "Rode Podcaster" (http://www.rodepodcaster.com/page2.html)

It's acts as a own device but only have give me sound on one channel (L) . So how can I easy dublicate this channel  with sound (L) to stereo (L+R).

Thanks!

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.8 !
« Reply #262 on: 19 Sep '07 - 15:01 »
 ??? Me not thinking... Sorry!   ::)

Well it was too easy...

Changing X from 2 to 1 solved me dilema.

Code: [Select]
Bass.BASS_RecordStart(44100, X, BASSRecord.BASS_DEFAULT, _recProc, 0);

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.8 !
« Reply #263 on: 20 Sep '07 - 13:28 »
I'm back...   8)

Well another question.  I try to add an BASS_FX_DSPPEAKEQ to my "recorder"

I have a simple recorder that save to MP2/MP3 "on the fly" and I want to add an EQ and a compressor that prosess the signal before file.

I use Same code for playback and EQ works there. How do I do EQ on recording channel?

Some snippets...

Code: [Select]
public void StartRecording(int soundcardIndex, string filename, int bitRate, AudioFormat audioFormat, bool recordMono)
        {
            _IsRecordingMonitor = false;

            _recordingAudioFormat = audioFormat;

            if (_IsRecording)
                StopRecording();

            if (!Bass.BASS_RecordInit(soundcardIndex))
                Console.WriteLine("Rec: Bass_RecordInit error!");

            _recProc = new RECORDPROC(RecordingHandler);

            if (recordMono)
                _recHandle2 = Bass.BASS_RecordStart(44100, 1, BASSRecord.BASS_DEFAULT, _recProc, 0);
            else
                _recHandle2 = Bass.BASS_RecordStart(44100, 2, BASSRecord.BASS_DEFAULT, _recProc, 0);


            if (_recHandle2 == Bass.FALSE)
                Console.WriteLine("Rec: BASS_RecordStart error!");


            // set up a ready-made DSP (here the PeakLevelMeter)
            _plm = new DSP_PeakLevelMeter(_recHandle2, 1);
           

            _monBuffer.Clear();

            switch (audioFormat)
            {
                case AudioFormat.MP2:
                    lameTooLame = new EncoderTooLAME(_recHandle2);
                    lameTooLame.InputFile = null;
                    lameTooLame.OutputFile = filename + ".MP2";
                    lameTooLame.TOO_Bitrate = bitRate;
                    lameTooLame.Start(null, 0);

                    _fileName = filename + ".MP2";

                    if (!lameTooLame.EncoderExists)
                    {
                        //Console.WriteLine("Rec: tooLAME.EXE can not be found...");

                    }
                    break;

......



RecHanler:
Code: [Select]
private bool RecordingHandler(int handle, IntPtr buffer, int length, int user)
        {
            // user will contain our encoding handle
            if (length > 0 && buffer != IntPtr.Zero)
            {
                if (_IsMonitorRecorder)
                {
                    _monBuffer.Write(buffer, length);
                }
            }
           
            return true;
        }

Add EQ:
Code: [Select]
public void AddEQ()
        {
            _eq1 = new BASS_FX_DSPPEAKEQ();

            BASS_FX_DSPPEAKEQ _DSPeq1 = new BASS_FX_DSPPEAKEQ(0, 125, 18, 0, 1, 0);
            BASS_FX_DSPPEAKEQ _DSPeq2 = new BASS_FX_DSPPEAKEQ(1, 1000, 18, 0, 1, 0);
            BASS_FX_DSPPEAKEQ _DSPeq3 = new BASS_FX_DSPPEAKEQ(2, 8000, 18, 0, 1, 0);

            _EqHandleL1 = Bass.BASS_ChannelSetFX(_recHandle2, BASSFXType.BASS_FX_PARAMEQ, 10);
            _EqHandleL2 = Bass.BASS_ChannelSetFX(_recHandle2, BASSFXType.BASS_FX_PARAMEQ, 10);
            _EqHandleL3 = Bass.BASS_ChannelSetFX(_recHandle2, BASSFXType.BASS_FX_PARAMEQ, 10);

            Bass.BASS_FXSetParameters(_EqHandleL1, _DSPeq1);
            Bass.BASS_FXSetParameters(_EqHandleL2, _DSPeq2);
            Bass.BASS_FXSetParameters(_EqHandleL3, _DSPeq3);
        }


Change EQ:
Code: [Select]
public void SetEQ(float lowGain, float mid, float high)
        {
         

                    BASS_FX_DSPPEAKEQ _DSPeq1 = new BASS_FX_DSPPEAKEQ(0, 125, 18, 0, 1, lowGain);
                    BASS_FX_DSPPEAKEQ _DSPeq2 = new BASS_FX_DSPPEAKEQ(1, 1000, 18, 0, 1, mid);
                    BASS_FX_DSPPEAKEQ _DSPeq3 = new BASS_FX_DSPPEAKEQ(2, 8000, 18, 0, 1, high);

                    _EqHandleL1 = Bass.BASS_ChannelSetFX(_recHandle2, BASSFXType.BASS_FX_PARAMEQ, 10);
                    _EqHandleL2 = Bass.BASS_ChannelSetFX(_recHandle2, BASSFXType.BASS_FX_PARAMEQ, 10);
                    _EqHandleL3 = Bass.BASS_ChannelSetFX(_recHandle2, BASSFXType.BASS_FX_PARAMEQ, 10);

                    Bass.BASS_FXSetParameters(_EqHandleL1, _DSPeq1);
                    Bass.BASS_FXSetParameters(_EqHandleL2, _DSPeq2);
                    Bass.BASS_FXSetParameters(_EqHandleL3, _DSPeq3);


                    _eq1.lBand = 0;
                    _eq1.fBandwidth = 18F;
                    _eq1.fGain = lowGain;
                    _eq1.fCenter = 120;
                    BassFx.BASS_FX_DSP_SetParameters(_recHandle2, _eq1);

                    _eq1.lBand = 1;
                    _eq1.fBandwidth = 18F;
                    _eq1.fGain = mid;
                    _eq1.fCenter = 1000;
                    BassFx.BASS_FX_DSP_SetParameters(_recHandle2, _eq1);

                    _eq1.lBand = 2;
                    _eq1.fBandwidth = 18F;
                    _eq1.fGain = high;
                    _eq1.fCenter = 8000;
                    BassFx.BASS_FX_DSP_SetParameters(_recHandle2, _eq1);
     

        }
« Last Edit: 20 Sep '07 - 13:30 by ken »

radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.8 !
« Reply #264 on: 20 Sep '07 - 14:11 »
Hi Ken,

what is actually not working with your code?
It looks okay so far!

Just one thing. You might want to make the "SetEQ" methof a little simpler ;-)
Code: [Select]
public void SetEQ(float lowGain, float mid, float high)
{
    BASS_FXPARAMEQ eq = new BASS_FXPARAMEQ();
    if (Bass.BASS_FXGetParameters(_EqHandleL1, eq))
    {
        eq.fGain = lowGain;
        Bass.BASS_FXSetParameters(_EqHandleL1, eq);
    }
    if (Bass.BASS_FXGetParameters(_EqHandleL2, eq))
    {
        eq.fGain = mid;
        Bass.BASS_FXSetParameters(_EqHandleL2, eq);
    }
    if (Bass.BASS_FXGetParameters(_EqHandleL3, eq))
    {
        eq.fGain = high;
        Bass.BASS_FXSetParameters(_EqHandleL3, eq);
    }
}

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.8 !
« Reply #265 on: 20 Sep '07 - 17:20 »
Ok, When recording I get now effect from the EQ, the EQ is not working. So I wonder is this the correct way to add an DSP (EQ or compressor) to a recording channel?

radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.8 !
« Reply #266 on: 20 Sep '07 - 21:42 »
Hi Ken,

I just made a quick test and here all is working fine.
I also tested other DSP effects, like the DX8 compressor and also BASS_VST - those DSPs work fine too.
« Last Edit: 22 Sep '07 - 23:52 by radio42 »

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.8 !
« Reply #267 on: 21 Sep '07 - 10:26 »
Ah, so Bass.dll own FX works on recording, great. 

Bass.dll own crompessor also have more settings so I think it will do the jobb I want.

I fidle a bit with Bass (DX8) but did't get it working. Any chance you have a code snippet showing how?

radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.8 !
« Reply #268 on: 21 Sep '07 - 12:43 »
Quote
Ah, so Bass.dll own FX works on recording, great
BASS and BASS_FX work fine on recording channels!

Here is some code on how to setup effects, like the EQ or Compressor on a recording channel:
Code: [Select]
private RECORDPROC _recordingProc = null;
private int[] _eq = new int[4]; // 4-band eq
private int _compressor = 0;
...
_recordingProc = new RECORDPROC(RecordingCallback);
Bass.BASS_RecordSetDevice(_device);
// enable the selected input
for (int i = 0; Bass.BASS_RecordSetInput(i, BASSInput.BASS_INPUT_OFF); i++); // 1st disable all inputs, then...
Bass.BASS_RecordSetInput(_config.Input, BASSInput.BASS_INPUT_ON); // enable the selected
_recordStream = Bass.BASS_RecordStart(44100, 2, BASSRecord.BASS_SAMPLE_FLOAT, _recordingProc, 0);


// setup 4 a EQ bands
BASS_FXPARAMEQ eq = new BASS_FXPARAMEQ();
_eq[0] = Bass.BASS_ChannelSetFX(_recordStream, BASSFXType.BASS_FX_PARAMEQ, 10);
_eq[1] = Bass.BASS_ChannelSetFX(_recordStream, BASSFXType.BASS_FX_PARAMEQ, 10);
_eq[2] = Bass.BASS_ChannelSetFX(_recordStream, BASSFXType.BASS_FX_PARAMEQ, 10);
_eq[3] = Bass.BASS_ChannelSetFX(_recordStream, BASSFXType.BASS_FX_PARAMEQ, 10);

eq.fGain = 0f;
eq.fBandwidth = 18f;
eq.fCenter = 100f;
Bass.BASS_FXSetParameters(_eq[0], eq);
eq.fCenter = 1000f;
Bass.BASS_FXSetParameters(_eq[1], eq);
eq.fCenter = 5000f;
Bass.BASS_FXSetParameters(_eq[2], eq);
eq.fCenter = 10000f;
Bass.BASS_FXSetParameters(_eq[3], eq);

// setup a compressor
_compressor = Bass.BASS_ChannelSetFX(_recordStream, BASSFXType.BASS_FX_COMPRESSOR, 5);

...

private bool RecordingCallback(int handle, IntPtr buffer, int length, int user)
{
    return true;
}

private void UpdateEQGain(int band, float gain)
{
    BASS_FXPARAMEQ eq = new BASS_FXPARAMEQ();
    if (Bass.BASS_FXGetParameters(_eq[band], eq))
    {
        eq.fGain = gain;
        Bass.BASS_FXSetParameters(_eq[band], eq);
    }
}

private void UpdateCOMP(float gain, float attack, float release, float threshold, float ratio, float predelay)
{
    if (_compressor == 0)
        return;

    BASS_FXCOMPRESSOR comp = new BASS_FXCOMPRESSOR();
    if (Bass.BASS_FXGetParameters(_compressor, comp))
    {
        comp1.fGain = gain;
        comp1.fAttack = attack;
        comp1.fRelease = release;
        comp1.fThreshold = threshold;
        comp1.fRatio = ratio;
        comp1.fPredelay = predelay;
        Bass.BASS_FXSetParameters(_compressor, comp);
    }
}



P.S.:
Quote
Bass.dll own crompessor also have more settings so I think it will do the jobb I want
Yes, I would recommend to use the BASS DX8 compressor instead of the BASS_FX add-on compressor, since the DX8 compressor is much better!
« Last Edit: 22 Sep '07 - 23:51 by radio42 »

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.8 !
« Reply #269 on: 21 Sep '07 - 13:17 »
Thanks!

EQ works if I "monitor" the recorder stream, but EQ is not on the recorded file.  Hope Ian find something!


radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.8 !
« Reply #270 on: 21 Sep '07 - 13:25 »
How do you "monitor" the recorder stream?

Since when I am using e.g. a user DSP (with a lower prio) and create a user stream to 'clone' the recording stream and then feed this 'clone' to an output...the EQ effect is present!
« Last Edit: 22 Sep '07 - 23:49 by radio42 »

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.8 !
« Reply #271 on: 21 Sep '07 - 14:39 »
I think I took the "monitoring" from your examples.

Code: [Select]

_monProc = new STREAMPROC(MonitoringStream);
_monStream = Bass.BASS_StreamCreate(44100, 2, 0, _monProc, 0); // user = reader#
Bass.BASS_ChannelPlay(_monStream, false);


private int MonitoringStream(int handle, IntPtr buffer, int length, int user)
        {
            return _monBuffer.Read(buffer, length, user);
        }


private bool RecordingHandler(int handle, IntPtr buffer, int length, int user)
        {
            // user will contain our encoding handle
            if (length > 0 && buffer != IntPtr.Zero)
            {
                if (_IsMonitorRecorder)
                {
                    _monBuffer.Write(buffer, length);
                }
            }
           
            return true;
        }


radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.8 !
« Reply #272 on: 21 Sep '07 - 14:47 »
That's rather strange.
I mean yes, that's all correct.

But if the EQ is applied in the "monitor" (and so within the buffer of the RECORDPROC) it is even more strange, why it wouldn't be in the encoder!
« Last Edit: 22 Sep '07 - 23:49 by radio42 »

radio42

  • Posts: 4839
Re: BASS .NET API 2.3.1.8 !
« Reply #273 on: 22 Sep '07 - 23:45 »
Hi Ken,

I must restate my findings!!! There is actually no bug in BASS!
It was a mistake in my test app with caused the issue.
I was triying both the DSP chain as well as encoding - and the EQ is working fine in both!

So it must also be a mistake in your app. In my test app I was not updating a UI correctly resulting in the mistake, that the gain value was always 0 - so any EQ update actually was not performed as I thought.
Maybe this is also your case.

So I corrected the posts above!

ken

  • Posts: 752
Re: BASS .NET API 2.3.1.8 !
« Reply #274 on: 26 Sep '07 - 13:07 »
Parhaps a cool new feature to the waveform class?

Serato (vinyl emulation DJ software...) show waveform i different colors (for bass, mid, high) and I wonder how they do it. But I figure they make one waveform for bass, one for mid, and one for high frequecys, the just put them in "layers" on top of each other.  And you can choose to show all paralell to each other. See pic:



/Ken