Recent

Author Topic: help with the bass library  (Read 17850 times)

rvk

  • Hero Member
  • *****
  • Posts: 6885
Re: help with the bass library
« Reply #15 on: June 03, 2015, 07:05:06 pm »
I squeezed cut with archive almost all left unit.pas Bass library for Lazarus version 1.4 as I could!
I'm missing the unit1.lfm in your .zip-file.
So please zip the unit1.lfm and attach it here.

rvk

  • Hero Member
  • *****
  • Posts: 6885
Re: help with the bass library
« Reply #16 on: June 03, 2015, 07:42:31 pm »
Without running your code I already found 2 other problems.

The first is your bass.dll (you enclosed in your zip).
It's the 64bit version !!!
You are (probably) creating a 32bit program (with Lazarus).
So you need the 32bit version of the bass.dll.
(It's the one that's about 108Kb in size)

If you are creating a 64bit .exe with 64bit Lazarus then you can ignore the above.

Second is the following statement:
Code: [Select]
Fstream:= Bass_streamcreatefile(false, PChar(s),0,0,BASS_UNICODE or BASS_STREAM_AUTOFREE);

The string-type in Lazarus is not UNICODE but UTF8. UTF8 is for normal characters compatible with Ansistring. But unicode always has 2 (or more) bytes per character. So giving that option to bass.dll it expects a unicode-string while you give a utf8-string.

Change it to:
Code: [Select]
Fstream:= Bass_streamcreatefile(false, PChar(s),0,0,BASS_STREAM_AUTOFREE);
« Last Edit: June 03, 2015, 07:58:09 pm by rvk »

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: help with the bass library
« Reply #17 on: June 03, 2015, 08:50:56 pm »
Into the account how to send the project I didn't understand! and what the version Lazarus, influences the project and a code 32bit and 64bit? I have a version Lazarus both for 64bit and for 32bit! what should I do I won't understand ((as to me to correct errors! you can look at a code! and I didn't understand the project as to send!

rvk

  • Hero Member
  • *****
  • Posts: 6885
Re: help with the bass library
« Reply #18 on: June 03, 2015, 08:57:21 pm »
If you have both 32bit and 64bit Lazarus you probably are compiling for 32bit. So you need the 32bit version of bass.dll.

Secondly... just remove the "BASS_UNICODE or " from that line I showed you.

If you can't read and understand English you might want to converse in you native language. What language is that?

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: help with the bass library
« Reply #19 on: June 03, 2015, 08:59:01 pm »
I sorted not much that you wrote this to you it was necessary we look, the project! in an investment
« Last Edit: June 10, 2015, 04:21:38 pm by Neprofi »

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: help with the bass library
« Reply #20 on: June 03, 2015, 09:00:51 pm »
Русский если вы понимаете мне удобней будет) и выражать свои мнения вопросы , сумею не много лучше)))

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: help with the bass library
« Reply #21 on: June 03, 2015, 09:01:41 pm »
If you understand Russian to me it will be more convenient) and to express the opinions questions, I will manage not much better)))

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: help with the bass library
« Reply #22 on: June 03, 2015, 09:03:34 pm »
and into Lazarus's account at me it is written so the version costs 32/64bit here as that))

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: help with the bass library
« Reply #23 on: June 03, 2015, 09:08:04 pm »
thanks everything turned out you to me very much helped I to you is very grateful))))

rvk

  • Hero Member
  • *****
  • Posts: 6885
Re: help with the bass library
« Reply #24 on: June 03, 2015, 09:10:19 pm »
Well, I don't read/speak russian but I can use Google Translate to see if you understand this better.

<translated>
Ну, я не читаю / говорю русский, но я могу использовать Google Translate, чтобы увидеть, если вы понимаете, это лучше.
</translated>

First try to remove the "BASS_UNICODE or" from this line:
Сначала попробуйте удалить "BASS_UNICODE or" от этой линии:
так:
Code: [Select]
Fstream:= Bass_streamcreatefile(false, PChar(s),0,0,BASS_STREAM_AUTOFREE);

If your code then still doesn't work you need to use the 32 bit version of bass.dll. It's the one with 108Kb in size. It's in the bass.zip you downloaded.

<translated>
Если ваш код тогда еще не работает, вы должны использовать 32-битную версию bass.dll. Это одна с 108Кб размера. Это в bass.zip вы скачали.
</translated>

Edit: It worked. Okay. Great.

<translated>
Изменить: Он работал. Хорошо. Отлично.
</translated>

rvk

  • Hero Member
  • *****
  • Posts: 6885
Re: help with the bass library
« Reply #25 on: June 10, 2015, 12:56:10 pm »
I have a change in the code I gave earlier. (for anybody wanting to use it)

When doing a SendMessage in the EndTrackHandler the Bass-library "pauses" until your event with WM_CHANNEL_END is completed. But in the meantime (because Bass-library is in "pause state") you can't (or must not) interact with it. At least under Linux this will result in strange behavior.

The solution is using a PostMessage. With PostMessage a WM_CHANNEL_END is placed in the message-queue and the Bass-library immediately receives control back. After that your program receives control and can do the WM_CHANNEL_END stuff and interaction with the Bass-library is not a problem anymore.

So:
Code: [Select]
var
  CallingForm: TForm;  // <---- Set this ABOVE EndTrackHandler

procedure EndTrackHandler(handle: HSYNC; channel, Data: DWORD; user: Pointer); {$IFDEF WINDOWS} stdcall {$ELSE} cdecl {$ENDIF};
begin
  // signal callingform that the channel has ended

  // SendMessage(Callingform.Handle, WM_CHANNEL_END, 0, 0);
  // Don't use SendMessage if you're going to communicate with Bass in the WM_CHANNEL_END event
  // under Linux it will do strange things so do a PostMessage

  PostMessage(Callingform.Handle, WM_CHANNEL_END, 0, 0); // <-- use PostMessage. It's safer.
 
end;

 

TinyPortal © 2005-2018