Recent

Author Topic: UN4Seen BASS library error  (Read 3073 times)

morknot

  • New Member
  • *
  • Posts: 44
  • still learning
UN4Seen BASS library error
« on: March 22, 2017, 01:22:37 pm »
I have successfully used the Un4Seen Bass library to make a basic 'DJ' application with which I can play mp3 files and make use of microphone input. The microphone input has quite bad latency problems (down to Windows) and so I thought I would try the ASIO approach and that is where I have run into problems.

The Bass library includes Delphi units which means I have had to find workarounds on occasions and they have all worked out well.

When using the bassasio library I have been unable to resolve an error.

To start microphone input, the BASS command..

 BASS_ASIO_ChannelEnable(True,iput,@XAsioProc,nil);
{where true=input;iput=channel;XAsioProc=user defined function;nil=unused procedure;}

the XAsioProc user defined function takes the form of.....

 function XASIOProc(input:bool;channel:DWORD;buffer:Pointer;length:DWORD;user:Pointer):DWORD;stdcall;

which swaps the input to the output and returns length.

The BASS library definitions are:

function BASS_ASIO_ChannelEnable(input:BOOL; channel:DWORD; proc:ASIOPROC; user:Pointer): BOOL;stdcall; external bassasiodll;

and

ASIOPROC = function(input:BOOL; channel:DWORD; buffer:Pointer; length:DWORD; user:Pointer): DWORD; stdcall;   

On compiling, the error generated is:

Error: Incompatible type for arg no. 3: Got "<procedure variable type of function(LongBool;LongWord;Pointer;LongWord;Pointer):DWord of object;StdCall>", expected "<procedure variable type of function(LongBool;LongWord;Pointer;LongWord;Pointer):DWord;StdCall>"

bassasio.pas(138,10) Hint: Found declaration: BASS_ASIO_ChannelEnable(LongBool;LongWord;ASIOPROC;Pointer):LongBool; StdCall;

I can't see where the error is unless it's down to the "DWORD of object" instead of just "DWORD". The error occurs using both the unconverted and converted bassasio units.

Is anyone able to tell me if this is likely to be the incompatibility in the XAsioproc call?

Sorry about the length and I hope there is enough info. Lazarus 1.6, Windows 10.

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: UN4Seen BASS library error
« Reply #1 on: March 22, 2017, 02:12:57 pm »
You can't use class method  for an callback function. Use regular function.

morknot

  • New Member
  • *
  • Posts: 44
  • still learning
Re: UN4Seen BASS library error
« Reply #2 on: March 22, 2017, 03:36:07 pm »
Thank you for your reply, Cyrax.

I am a bit of novice but I think you mean that I have to remove the @XAsioProc call from  BASS_ASIO_ChannelEnable(True,iput,@XAsioProc,nil) and substitute it with a previously made standard function call. I am not sure how I would pass the parameters.

Please could you explain a little more. Thanks.

 

TinyPortal © 2005-2018