21 May '13 - 20:37 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: 1 ... 24 25 [26] 27 28 ... 60
  Reply  |  Print  
Author Topic: BASS.NET API 2.4.10.1  (Read 368520 times)
radio42
Posts: 4012


« Reply #500 on: 27 Jul '08 - 21:17 »
Reply with quoteQuote

So then it is definity not related the any GC stuff - when it also happens with the natibe BASSASIO example.
It sounds like a problem with the ASIO driver itself then...really strange.
As of today I also would have no idea what this can cause, but I'll think about it...
Logged
ken
Posts: 630


« Reply #501 on: 27 Jul '08 - 21:28 »
Reply with quoteQuote

My idea also not an BASS isue. I will order me a new soundcard. I was looking at this one: http://www.esi-audio.com/products/esu1808/  or maybe this: http://www.m-audio.com/products/en_us/Delta1010LT-main.html

Bernd, what ASIO card do you use, and have you the "pop" issu when open folder in windows explorer?
« Last Edit: 27 Jul '08 - 21:32 by ken » Logged
radio42
Posts: 4012


« Reply #502 on: 28 Jul '08 - 09:41 »
Reply with quoteQuote

No, I don't have these issue and haven't discovered them so far.
I'm using the following soundcards:
1) M-Audio Delta-1010 (excellent): http://www.m-audio.com/products/en_us/Delta1010-main.html
2) Echo Indigo (for Laptops): http://www.echoaudio.com/Products/CardBus/IndigoDJ/index.php
3) an older Soundblaster Audigy
4) different onboard soundcards
Logged
Bello
Posts: 20


« Reply #503 on: 29 Jul '08 - 09:46 »
Reply with quoteQuote

Bernd,

I found some information on c++ CLR assemblies on MSDN, but how to uses this in a managed c# application with a C# proxy holding function pointers (I guess) is still not clear to me.
Would you be willing to provide us with a sample application?

I'm sure I wouldn't be the only one on this forum that would find this highly educational.

Thanks,
Bello.
Logged
radio42
Posts: 4012


« Reply #504 on: 29 Jul '08 - 11:55 »
Reply with quoteQuote

Oki here comes a little example on how to create "Mixed Mode" assemblies:

Preliminary:
To write a "Mixed Mode" assembly you need to create a Visual C++ assembly (a dynamic link libraray, dll)!
The trick is to write managed C++ code (.Net code) and unmanged C++ code (native).
The managed code can then be accessed by any other .Net language, like C# or VB.Net.

a) You create a new Visual C++ project as a new class library (dll)
    - make sure to set the "Common Language Runtime Support" (/clr) switch in the general configuration properties
    - so this will be your mixed mode assembly

b) add the BASS header file(s) to your new Visual C++ project (just drag & drop e.g. the bass.h file to the 'Header Files' section of your new project'

c) Now you create two .cpp files: e.g. "BassManagedWrapper.cpp" and "BassUnmanaged.cpp"
    - the content of these files will be shown later (see below)

d) compile everything and you are done
    - now you can use this new library as a normal assembly within your standard .Net application
    - just add it as a new reference

Now to the content of the two files mentioned:

1) BassUnmanaged.cpp
#pragma once
#include "Stdafx.h"

#pragma unmanaged
#include <math.h>
#include <malloc.h>
#include <stdio.h>
#include <process.h>
#include "bass.h"
#using <mscorlib.dll>

#ifndef UNMANAGED
#define UNMANAGED

class EasyRecord
{
private:
    HRECORD _recordHandle;
    HSTREAM _streamCopy;

    /* The actual recording callback */
    static BOOL CALLBACK RecordingCallback(HRECORD handle, const void *buffer, DWORD length, void *user)
    {
        EasyRecord* easy = (EasyRecord*)user;

        if (easy->_streamCopy != 0 && length > 0)
            BASS_StreamPutData(easy->_streamCopy, buffer, length);

        // always continue recording
        return TRUE;
    }

public:
    /* Constructor */
    EasyRecord(void)
    {
        this->_recordHandle = 0;
        this->_streamCopy = 0;
    }

    /* Gets the recording handle */
    DWORD GetRecordHandle(void)
    {
        return this->_recordHandle;
    }

    /* Gets the stream copy handle */
    DWORD GetStreamCopy(void)
    {
        return this->_streamCopy;
    }

    /* Sets the stream copy handle */
    void GetStreamCopy(HSTREAM streamCopy)
    {
        this->_streamCopy = streamCopy;
    }

    /* Clears the recording buffer */
    void ClearRecordingBuffer(void)
    {
        BASS_ChannelGetData(this->_recordHandle, NULL, BASS_ChannelGetData(this->_recordHandle, NULL, BASS_DATA_AVAILABLE));
    }

    /* Creates a recording clone */
    void CreateClone(DWORD flags)
    {
        BASS_CHANNELINFO info;
        BASS_ChannelGetInfo(this->_recordHandle, &info);
        flags |= info.flags;
        flags &= ~BASS_STREAM_AUTOFREE;

        this->_streamCopy = BASS_StreamCreate(info.freq, info.chans, flags, STREAMPROC_PUSH, 0);

        if (this->_streamCopy != 0)
        {
            BASS_ChannelPause(this->_recordHandle);
            this->ClearRecordingBuffer();
            BASS_ChannelPlay(this->_recordHandle, TRUE);
        }
    }

    /* Removes a recording clone */
    void RemoveClone()
    {
        if (this->_streamCopy != 0)
        {
            BASS_StreamFree(this->_streamCopy);
            this->_streamCopy = 0;
        }
    }

    void Start(DWORD freq, DWORD chans, DWORD flags, DWORD period, BOOL decoding)
    {
        if (period > 0)
            flags = MAKELONG(flags, period);
        if (decoding)
            this->_recordHandle = BASS_RecordStart(freq, chans, flags, NULL, this);
        else
            this->_recordHandle = BASS_RecordStart(freq, chans, flags, &EasyRecord::RecordingCallback, this);
    }

    void Stop(void)
    {
        this->RemoveClone();

        BASS_ChannelStop(this->_recordHandle);
        BASS_StreamFree(this->_recordHandle);
        this->_recordHandle = 0;
    }
};
As you can see this simple unmanaged C++ class has a static callback (to access the related instance members the 'user' param of the callback is used.
The callback itself will be used, if you call the 'Start' method of the class.
Also note the "#pragma unmanaged" line at the top of the file. This switch tells the compiler, that you are now coding in native, unmanaged code!
As this class can not directly be used by any .Net language (as it is native code), we need to write a .Net wrapper class.
This is what we do in the next file...


2) BassManagedWrapper.cpp
#include "Stdafx.h"
#include "BassUnmanaged.cpp"

#pragma managed

using namespace System;
using namespace System::Runtime::InteropServices;

namespace MyBASS
{

public ref class EasyRecording : public IDisposable
{
private:
    /* pInner is used to invoke the exposed methods in the unmanaged class. */
    EasyRecord* pInner;

public:
    // Constructor
    EasyRecording()
    {
        /* define the pInner object */
        pInner = new EasyRecord();
    }
    //destructor
    ~EasyRecording()
    {
        //call finalizer (don't wait for GC)
        this->!EasyRecording();
    }
    //finalizer
    !EasyRecording()
    {     
        delete pInner;
        pInner = NULL;
    }

    // Gets the recording handle
    property int RecordHandle
    {
        int get(void) { return pInner->GetRecordHandle(); }
    }

    // Gets a stream copy handle
    property int StreamCopy
    {
        int get(void) { return pInner->GetStreamCopy(); }
    }

    // Clears the recording buffer
    void ClearRecordingBuffer(void)
    {
        pInner->ClearRecordingBuffer();
    }

    // Creates a stream clone
    void CreateClone(int flags)
    {
        pInner->CreateClone(flags);
    }

    // Remove a stream clone
    void RemoveClone(void)
    {
        pInner->RemoveClone();
    }

    // Starts the Recording
    void Start(int freq, int chans, int flags, int period, bool decoding)
    {
        pInner->Start(freq, chans, flags, period, decoding);
    }

    // Stops the recording
    void Stop(void)
    {
        pInner->Stop();
    }
};

}
The "#pragma managed" line at the top of the file tells the compiler, that we now code in managed C++ (.Net code)!
We use a member called "pInner" which is of the type of our unmanaged class to access the native unmanaged code.
As you can see, we create an instance of it in the constructor and make sure, that we delete it in the finalizer.
This is nessesary, because any instance of an unmanaged class will not be seen by the Gargabe Collector and thus we have to make sure to free any resources here.
For the rest all is easy. We simply invoke the "pInner" members in our wrapper methods.
As a result, we can assess the managed class "EasyRecording" from any .Net language.


So if you add the finally build libraray (as shown above) to your .Net application as a new reference you can use it like this:
private MyBASS.EasyRecording _recordHandler = null;
private int _recordStream = 0;
...
Bass.BASS_RecordSetDevice(0);
for (int i = 0; Bass.BASS_RecordSetInput(i, BASSInput.BASS_INPUT_OFF, -1f); i++); // 1st disable all inputs, then...
                  Bass.BASS_RecordSetInput(0, BASSInput.BASS_INPUT_ON, -1f); // enable the selected

_recordHandler = new MyBASS.EasyRecording();
_recordHandler.Start(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT, 100, false);
_recordStream = _recordHandler.RecordHandle;
...
// from here on you use the '_recordStream' like normal
...
// to stop recording just call
_recordHandler.Stop();
_recordHandler.Dispose();
_recordHandler = null;
...
Logged
Bello
Posts: 20


« Reply #505 on: 29 Jul '08 - 15:04 »
Reply with quoteQuote

Thanks!
I'm going to try this right away!
Logged
www.fullmm.com
Posts: 141


« Reply #506 on: 6 Aug '08 - 10:08 »
Reply with quoteQuote

hello radio 42

when you use bass_video 2.4.2 which convert video .

thanks .

Logged
radio42
Posts: 4012


« Reply #507 on: 10 Aug '08 - 10:26 »
Reply with quoteQuote

It will come in the next days (as I just returned from a short business trip)...
Logged
www.fullmm.com
Posts: 141


« Reply #508 on: 11 Aug '08 - 06:00 »
Reply with quoteQuote

oh . you happy me . very thanks . Cheesy Cheesy Cheesy Cheesy
Logged
radio42
Posts: 4012


« Reply #509 on: 15 Aug '08 - 10:50 »
Reply with quoteQuote

Hi All,

a pre-version of BASS.NET v2.4.1.3 is ready to download here:
www.un4seen.com/filez/4/Bass24.Net_pre.zip

It should now be compatible with:
BASS_video v2.4.1.2
BASS_vis v2.4.1.2
BASS_FX v2.4.1.1

Please report any doggieness, if you found any stuff.

NOTE:
This version already contains support for BASS_FX v2.4.1.1 (which is not yet released).
In BASS_FX v2.4.1.1 the BFX_COMPRESSOR structure has been changed, as Ian and Jobby have implemented a brand new compressor.
So if you are using a BFX_COMPRESSOR in your tests, just let me know and I can provide you with a pre BASS_FX v2.4.1.1. version.

Many Greets
Bernd
Logged
www.fullmm.com
Posts: 141


« Reply #510 on: 16 Aug '08 - 06:09 »
Reply with quoteQuote

Hello Radio42 , I have a emergency question , i am sorry to ask you , please help me :

i wrote a app which works with all of encoder which bass.net can support , but some of them is realized under GPL ,  if i do not include encoder( such as enc_aacplus.dll), and my app can works without this encoder(for example for convert to aacplus need that dll) , can i use my app for commercial use , which Bass.net do(Download files Separately) , i am very sorry for use this forum  Embarrassed, please help me    Undecided Undecided
Logged
radio42
Posts: 4012


« Reply #511 on: 17 Aug '08 - 11:52 »
Reply with quoteQuote

17.08.2008: Version 2.4.1.3 is out!

BASS_FX: updated to support v2.4.2.0
BASSvis: updated to support v2.4.1.2
BassVideo: updated to support v2.4.1.2
General: Utils.GetNormalizationGain made static


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

Lib only:
  www.un4seen.com/filez/4/Bass24.Net_update.zip
Logged
radio42
Posts: 4012


« Reply #512 on: 17 Aug '08 - 12:16 »
Reply with quoteQuote

@ fullmm,
yes - that's what I guess.
Logged
www.fullmm.com
Posts: 141


« Reply #513 on: 18 Aug '08 - 06:03 »
Reply with quoteQuote

Radio42

Very Thanks
Logged
www.fullmm.com
Posts: 141


« Reply #514 on: 30 Aug '08 - 14:22 »
Reply with quoteQuote

Hello Radio42 ,
is it possible for you to create wrapper for spx and ITunes encoder in misc such as lame.exe encoder ? you can download encoders from rareware.org

 
Logged
radio42
Posts: 4012


« Reply #515 on: 30 Aug '08 - 20:43 »
Reply with quoteQuote

iTunes can encoder in AAC and MP3 and there are already 4 class to support these formats:
- EncoderLAME (MP3)
- EncoderFAAC (AAC)
- EncoderNeroAAC (AAC)
- EncoderWinampAACplus (AACplus)
What are you missing here regarding iTunes?

Regarding SPX, you might implement the Speex encoer yourself using the encoder framework.
Simply derive your own encoder class from the "BaseEncoder". See the "BaseEncoder" class in the documentation on how to create your own derived encoder class.
Alternatively you might use the generic "EncoderCMDLN" class with SPX.
Logged
www.fullmm.com
Posts: 141


« Reply #516 on: 31 Aug '08 - 06:28 »
Reply with quoteQuote

Thank you Undecided
Logged
www.fullmm.com
Posts: 141


« Reply #517 on: 7 Sep '08 - 13:08 »
Reply with quoteQuote

Hello radio 42

i got have a problem about twolame.exe encoder :

i use EncoderTwolame and i got true for the encoder but file will never created .i never get any error from BassError  ! Huh
Logged
radio42
Posts: 4012


« Reply #518 on: 8 Sep '08 - 09:37 »
Reply with quoteQuote

So probably some wrong settings or twolame version?
I have no idea what you are doing exactly, and without any sample code I can't help ;-)
Logged
www.fullmm.com
Posts: 141


« Reply #519 on: 8 Sep '08 - 11:17 »
Reply with quoteQuote

I have downloaded twolame.exe and use this code

         
  int EncodeStream = Bass.BASS_StreamCreateFile(@"E:\music\Other Music\01_ Deldari.mp3", 0, 0, BASSFlag.BASS_STREAM_DECODE);

Un4seen.Bass.Misc.EncoderTwoLAME Twolame = new Un4seen.Bass.Misc.EncoderTwoLAME(EncodeStream);
            Twolame.InputFile = null;
            Twolame.OutputFile = "sample.mp2";
            bool ok = Twolame.Start(null, IntPtr.Zero, false);//ok return true !
            Utils.DecodeAllData(EncodeStream, true);
Huh
i think you have forget many source code in Bass.net API , please review again.
Logged
Pages: 1 ... 24 25 [26] 27 28 ... 60
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines