Author Topic: BASSASIO beta  (Read 128655 times)

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASSASIO beta
« Reply #25 on: 28 Apr '05 - 14:34 »
I've put an ASIO version of the BASS multi example in the BASSASIO download. Also, for convenience, BASS_ASIO_ChannelEnable now provides a "reset all channels" option.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASSASIO beta
« Reply #26 on: 29 Apr '05 - 14:28 »
please try a liitle demo without Format Float (i have tested it under 3 diffrent Asio Drivers
the effekt will be MickmouseSound
(if Im using Format Float all will working fine,but if Im trying a 16Bit Format i will hear a absolute wrong sampling Freq

I stumbled upon this bug myself today... it's sorted now :)

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #27 on: 30 Apr '05 - 12:50 »
Hi
Great Fix Ian.....
With some drivers the Error will behavior ...but after the fix
16 Bit Channels will working fine with all Drivers....

A little Question ..or two hehehe

1:) How do I implement more then 1 HStream.....
because 2 Streams to put in the AsioProc will make no sense (because Asio_Start/AsioStop will only start / stop the complete Asio Stuff

2.) i have dedected the following (I`m not shure if that is a  Driver or  a bassasio Problem)

little example
Code: [Select]
var
  MaxOutputChans : DWORD;
  Asio_info: Bass_Asio_Info;
  AsioChanInfo : Bass_ASIO_ChannelInfo;   
  Stream : HStream;

procedure TForm1.FormCreate(Sender: TObject);
var
 i : integer;
begin
  BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 0);
  BASS_Init(0, 48000, 0, 0, nil);
  if not BASS_ASIO_Init(0) then
  begin
    BASS_Free();
    MessageBox(0, 'Error', 'Can''t initialize ASIO', 0);
    Halt;
  end;
   Bass_Asio_GetInfo(Asio_Info);
   OutputChans := Asio_Info.outputs;  // Checking how many Outputs are available
 
   for i := 0 to OutputChans do  // putting all OutputNames in a Combobox
    begin
      Bass_Asio_ChannelGetInfo(false,i,AsioChanInfo);
      cbChanNr.Items.Add(AsioChanInfo.name);
    end;
    if cbChanNr.Items.Count < 0 then
       cbChanNr.ItemIndex := 0;      // Putting the Combo to the first Item (Channel 0)                                               
end;
----------------------------------------
Code: [Select]
procedure TForm1.Open_ButtonClick(Sender: TObject); 
var
 ChanIndex : DWORD;
begin
  ChanIndex := cbChanNr.ItemIndex;
   if ChanIndex < 0 then
    ChanIndex := 0;
  Bass_Asio_Stop;
  Bass_StreamFree(Stream);
   BASS_ASIO_ChannelEnable(false,DWORD(-1),nil,0);// Disabled all Output Channels
   BASS_ASIO_ChannelEnable(false,  ChanIndex, @AsioProc, 0); // enabled the selected OutputChan
   BASS_ASIO_ChannelJoin(false,  ChanIndex +1,  ChanIndex);
   
  // creating a Decoded Channel
  Stream := BASS_StreamCreateFile(false, PChar('C:\blah.mp3'), 0, 0, BASS_STREAM_DECODE or Bass_Sample_Float);
  if Stream <> 0 then
   begin
    Bass_Asio_Start(0);
   // do some other Stuff .....
  end; 
end;
Now to the Problem....
 if i`m in the Bass_Asio_ChannelEnabled/Bass_Asio_ChannelJoin will use the 1 OutputChannel
   all will working
 // 0 the first ChanOutput will using AsioOutputChan 0 and AsioOutputChan 1
  but if I am using the next Out put pair
   AsioOutputChan 2 and AsioOutputChan 3 (or a other free Output pair   then there are big Sound Problems
   // 16 Bit Streams will have the absolut wrong Sampling Freq
  // 32 Bit Float Streams will have a big distortion Sound....

if possible please try it self (and enabled not the first pair of channels enabled the second pair...)

by the way i `m not shure if that is a Driver Problem or a bassasio bug....


Greets Chris
   

« Last Edit: 30 Apr '05 - 21:51 by Chris »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASSASIO beta
« Reply #28 on: 1 May '05 - 12:30 »
1:) How do I implement more then 1 HStream.....
because 2 Streams to put in the AsioProc will make no sense (because Asio_Start/AsioStop will only start / stop the complete Asio Stuff

You can fill an ASIO channel with silence (0s) when there's nothing playing on it.

2.) i have dedected the following (I`m not shure if that is a  Driver or  a bassasio Problem)...
 if i`m in the Bass_Asio_ChannelEnabled/Bass_Asio_ChannelJoin will use the 1 OutputChannel
   all will working
 // 0 the first ChanOutput will using AsioOutputChan 0 and AsioOutputChan 1
  but if I am using the next Out put pair
   AsioOutputChan 2 and AsioOutputChan 3 (or a other free Output pair   then there are big Sound Problems
   // 16 Bit Streams will have the absolut wrong Sampling Freq
  // 32 Bit Float Streams will have a big distortion Sound....

if possible please try it self (and enabled not the first pair of channels enabled the second pair...)

I've put an ASIO version of the SPEAKERS example in the BASSASIO download now. It seems to work fine here. I tried it with 16-bit and floating-point channels, and with 16-bit and 32-bit output ASIO drivers. Let me know how it goes there.

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #29 on: 1 May '05 - 13:05 »
Hi
wow will working fine
tested with

Orginal Creative Drivers = OKAY
Asio4all Driver = OKAY
KX-Driver = Crash....
(with the bassasio.dll (BuildDate 19. April 2005, 15:03:56, DllSize 9,57 KB (9.800 Bytes)
 also it will working with the KX-Drivers)
(by the way every example will crash if I`m using the KX-Driver and the current bassasio.dll)
a Dr Watson Log about the Crash(if using KX-Drivers) 
you can downloading
here

(i will also  try to translate it  to delphi.....)

But by the way great working
Greets Chris
« Last Edit: 1 May '05 - 13:13 by Chris »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASSASIO beta
« Reply #30 on: 1 May '05 - 16:04 »
Unfortunately, the Dr Watson log doesn't give any definitive answers (the crash is outside any loaded modules), but I guess it's probably to do with the multi-device/callback stuff. I've put an updated DLL to try in the BASSASIO download.

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #31 on: 1 May '05 - 21:17 »
Hi
wow the crash (if using KX-Driver)   is history
Now it will working fine under the follwing tested Drivers

Creative Asio Driver (Creative Audigy2 Card)
KX-Drivers (Creative Audigy2 Card,Creative Soundblaster Live 5.01)
Asio4all  (Creative Soundblaster Live 5.01, AC97)
Asio2KS (Creative Soundblaster Live 5.01, AC97)

all 4 Drivers without any Problems !!!!!

Greets Chris

« Last Edit: 1 May '05 - 21:30 by Chris »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASSASIO beta
« Reply #32 on: 2 May '05 - 16:05 »
Jolly good. Btw, for any VB users, a VB version of the MULTI example is now in the download.

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #33 on: 2 May '05 - 18:59 »
Hi
here is now an Delphi Speaker Example icl compiled Application
Also you can set Pause/Play unaffected for every Channel seperat
@ Ian may be you can have a look on the Source I`m not shure if there is a other way possible
to add Pause/play to a seperate channel.
http://www.cst-development.de/bass_samples/asio_speaker.zip
Greets Chris


Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASSASIO beta
« Reply #34 on: 2 May '05 - 19:23 »
Looks good, but you shouldn't need to bother with the "OldPos" stuff. The decoding channel will already be at the position that it was "stopped" at.

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #35 on: 2 May '05 - 20:10 »
Looks good, but you shouldn't need to bother with the "OldPos" stuff. The decoding channel will already be at the position that it was "stopped" at.

Yup thats right i have updated the example (removing the OldPos Stuff)
will working fine
(The Download-Link is aslo now updated)

and tomorrow i will post also some more delphi asio  examples (contest,List,Multi,livefx)

Greets Chris
« Last Edit: 2 May '05 - 20:20 by Chris »

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #36 on: 2 May '05 - 23:34 »
Hi
 I have here an little converting Problem in the contest.c Code
(Portions of c i can convert but not all)

C Code

Code: [Select]
  { // wind the frequency down...
                int a=BASS_ASIO_ChannelGetRate(0,0),b=(a-1000)/25;
                for (;a>=1000;a-=b) {
                        BASS_ASIO_ChannelSetRate(0,0,a);
                        Sleep(20);
                }
        }

does this mean in Delphi
Code: [Select]
var
 a,b : float;
   a := (Bass_Asio_ChannelGetRate(false,0) ;
   b := (a - 1000) / 25;
   if a >= 1000 then
     a := a - b;
   BASS_ASIO_ChannelSetRate(false,0,a);
   Sleep(20);
   

Greets Chris
« Last Edit: 2 May '05 - 23:51 by Chris »

Irrational86

  • Posts: 960
Re: BASSASIO beta
« Reply #37 on: 3 May '05 - 13:36 »
Code: [Select]
// wind the frequency down...
var
  a, b: Integer;
begin
  a := BASS_ASIO_ChannelGetRate(0,0);
  b := (a - 1000) div 25;
  while (a >= 1000) do
  begin
    BASS_ASIO_ChannelSetRate(0,0,a);
    Sleep(20);
    a := a - b;
  end;
end;

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #38 on: 3 May '05 - 16:30 »
ahhhhh  fine
Many Thanks

se

  • Posts: 22
Re: BASSASIO beta
« Reply #39 on: 3 May '05 - 16:31 »
I downloaded all the samples. working in Delphi5. no problems of compilation.

Just to be sure:
to download the latest version, do I have to use this link:
http://www.un4seen.com/bassasio.zip?
it seems that all the samples are not inside.

Basic question:
I don't see no Play function for Asio. does that mean that the Start(x) function is doing this by playing 000 for silence and data for sound?

VST plugins:
How can I load a VST plugin and use it from the Bassasio library? in the callback ASIOproc? Or is that out of the focus of the library?
I found a VSThost program on the Net, but I'm not sure I understand how to merge the 2 piece of software....

thank you for your feedback and your great work, and sorry for my basic questions.

Salomon

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASSASIO beta
« Reply #40 on: 3 May '05 - 16:36 »
Yup thats right i have updated the example (removing the OldPos Stuff)
will working fine

I think there might be a little problem here...

Code: [Select]
  if (Bass_channelGetData(Chan[User], buffer, Length) = DWORD(-1)) or Paused [User] then
    FillChar(buffer^, Length, 0); // set Paused  so fill with silence

I don't know about in Delphi, but in C/C++ that will try to decode some data before it checks the "Paused" status. If it's the same in Delphi, you probably want it to be like this instead...

Code: [Select]
  if Paused [User] or (Bass_channelGetData(Chan[User], buffer, Length) = DWORD(-1)) then
    FillChar(buffer^, Length, 0); // set Paused  so fill with silence

Btw, I'll probably split the ASIOPROC into separate input/output functions, so that an output function can return how many bytes it has written (eg. 0 = nothing/silence). That way BASSASIO can avoid wasting time processing the channel's data when it's just silence. It'll require a bit of modification to the existing example code, but nothing too drastic :)

How can I load a VST plugin and use it from the Bassasio library? in the callback ASIOproc? Or is that out of the focus of the library?

Yep, BASSASIO just does ASIO output (and input). What you feed into it is up to you :)

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #41 on: 3 May '05 - 18:00 »
I think there might be a little problem here...

yep.... I have dedected that now the Play/pause will work now much faster

The Delphi Speaker Example is now Updated .....


Btw, I'll probably split the ASIOPROC into separate input/output functions, so that an output function can return how many bytes it has written (eg. 0 = nothing/silence). That way BASSASIO can avoid wasting time processing the channel's data when it's just silence. It'll require a bit of modification to the existing example code, but nothing too drastic :)

Can you please Show that in a little AsioProc example ??

I downloaded all the samples. working in Delphi5. no problems of compilation.

it seems that all the samples are not inside.

Basic question:
I don't see no Play function for Asio. does that mean that the Start(x) function is doing this by playing 000 for silence and data for sound?

VST plugins:
How can I load a VST plugin and use it from the Bassasio library? in the callback ASIOproc? Or is that out of the focus of the library?
I found a VSThost program on the Net, but I'm not sure I understand how to merge the 2 piece of software....

thank you for your feedback and your great work, and sorry for my basic questions.

Salomon


About the Play/Pause

Bass_Asio_Start/Stop   will Starting/Stopping ALL  Channels that you enabled with
Bass_Asio_ChannelEnable .......
if you want to paused/play Channels separate then  take a look at this Delphi Speaker Example

about the delphi examples wait a little bit
if the delphi Examples are Bug Free then they will be inside the packages

Here is the updated Delphi Speaker Example
http://www.cst-development.de/bass_samples/asio_speaker.zip

Greets Chris


-----------edit----------

Here is also an Contest Asio Delphi Example
http://www.cst-development.de/bass_samples/asio_contest.zip
« Last Edit: 3 May '05 - 18:20 by Chris »

Irrational86

  • Posts: 960
Re: BASSASIO beta
« Reply #42 on: 3 May '05 - 18:57 »
Code: [Select]
  if Paused [User] or (Bass_channelGetData(Chan[User], buffer, Length) = DWORD(-1)) then
    FillChar(buffer^, Length, 0); // set Paused  so fill with silence
For this to work correctly make sure you do not have "Complete boolean eval" in the options marked, otherwise the data will still be retrieved. To be sure of this you might want to split that into two separate if's (and maybe some comment explaining this too) because not everyone will read this, and not everyone will make their code different from yours.

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #43 on: 3 May '05 - 19:42 »
Thanks for the Info...I have add a lttle Info about the "Complete boolean eval"
(but Standard in Delphi the "Complete boolean eval" are off)
Greets Chris

se

  • Posts: 22
Re: BASSASIO beta; delphi sample Tempo
« Reply #44 on: 4 May '05 - 11:22 »
Thank you for the updated samples....

A question on the sample tempo in delphi5, Asio4all.

inside the ASIO callback procedure we are calling the function BASS_ChannelGetData (chan, ....);

procedure AsioProc(input: BOOL; channel: DWORD; buffer: Pointer; length, user:
  DWORD); stdcall;
begin
  Bass_ChannelGetData(chan, buffer, length);
....

the chan variable is a global one.
I tried to change it to channel, variable declared as a parameter of the procedure.
it doesn't work (silence).
I remember that with BASS regular callback, we can use (and we need to use) the channel variable declared in the parameter.

Any idea on this?

thank you

Salomon

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #45 on: 4 May '05 - 12:47 »
Hi
take a look at the procedure 
Bass_Asio_ChannelEnable(false, a * 2, @AsioProc, a);
you will see you don`t have any Reference to the Decoded Stream

you will tell the AsioDriver that you will enable (in the tempo example) an Output Channel

Now in the AsioProc Call self you must of cource send the Decoded Data to the Asio Channel
and that can you only with a Global Varibale in this example the Varibale Chan...

That what was declared as Channel in the AsioProc    is a  ASIO[/b] Output/Input Channel


Maybe its an goot idea to rename in the AsioWrapper all what was named as Channel to AsioChannel 
will look a little bit more clear....
Greets Chris



« Last Edit: 4 May '05 - 12:50 by Chris »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASSASIO beta
« Reply #46 on: 4 May '05 - 15:11 »
Btw, I'll probably split the ASIOPROC into separate input/output functions, so that an output function can return how many bytes it has written (eg. 0 = nothing/silence). That way BASSASIO can avoid wasting time processing the channel's data when it's just silence. It'll require a bit of modification to the existing example code, but nothing too drastic :)

Can you please Show that in a little AsioProc example ??

Yep, I've updated the MULTI and SPEAKERS examples to use the new stuff. But I decided not to make the change mentioned above, because it would've been no benefit to input channels. Instead, I've added a BASS_ASIO_ChannelPause function. I've also added a BASS_ASIO_ChannelReset function, which replaces (and improves upon) the "reset all channels" option in BASS_ASIO_ChannelEnable.

inside the ASIO callback procedure we are calling the function BASS_ChannelGetData (chan, ....);

procedure AsioProc(input: BOOL; channel: DWORD; buffer: Pointer; length, user:
  DWORD); stdcall;
begin
  Bass_ChannelGetData(chan, buffer, length);
....

the chan variable is a global one.
I tried to change it to channel, variable declared as a parameter of the procedure.
it doesn't work (silence).

As Chris mentioned, the "channel" is an ASIO channel number, not a BASS channel handle. But you don't absolutely have to use a global variable - you could pass a channel handle in the "user" parameter, as some of the BASSASIO examples do.

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #47 on: 4 May '05 - 21:20 »
Wow   ....
BASS_ASIO_ChannelPause/BASS_ASIO_ChannelReset/ and the overworked Bass_Asio_ChannelIsactive...
Great Working !!!!!

I have tested it, will working fine without any Problems......

Also here the Updated Delphi Speaker Example..
(removing all the Paused Stuff from the Asioproc and was replaced with the new Bass_Asio Functions from above
http://www.cst-development.de/bass_samples/asio_speaker.zip

Greets Chris

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASSASIO beta
« Reply #48 on: 5 May '05 - 12:53 »
Thanks. The updated example is now in the BASSASIO download. An updated DLL is also in there (I had left some debugging stuff in the last update :)).

Chris

  • Posts: 1810
Re: BASSASIO beta
« Reply #49 on: 21 May '05 - 00:48 »
@ Ian
try please the follwing
open 2 examples  of the speakers or dsp Examples (of course in different dirs)
how will you now dedected if one of the output channels is in use ??
BASS_ASIO_INFO.Output will show on BOTH Applications the same Free Outputs...
regular must the second Application have less Output CHannels......
or is the BASS_ASIO_INFO limited on bassasio self ???


Greets Chris