Hello, people.

Previous topic - Next topic

MrTAToad

It is - but you need to use IMPORT or DECLARE in order to get access to the BASS API.  Its quite simple really.

com_1

I tried to connect "Bass.dll" and GLBasic, but nothing.

> DLL - Funktionen ansprechen

> Von Hand laden:
> // Lädt die Funktion "foo" aus my.dll in den Zeiger: foo
> void (__stdcall* foo)(int, char); // Deklaration
> void LoadDllFunction()
> {
>    DLLCALL("my.dll", "foo", (void**) &foo);
> }


How it can be understood ?

> Automatisch laden lassen:

> // ausserhalb von Funktionen:
> // DECLARE(name, "dll", (parameter), rückgabetyp)
> DECLARE(foo, "my.dll", (int, char), void);

> // DECLARE_ALIAS(name, "dll", "echter_name", (parameter), rückgabewert)
> DECLARE_ALIAS(foo, "my.dll", "foo@4", (int, char), void);


How it can be understood ?

> Wenn die Funktion eine __cdecl Funktion ist (also kein __stdcall), hängt man an DECLARE ein _C an:

> DECLARE_C(foo, "my.dll", (int, char), void);
> DECLARE_C_ALIAS(foo, "my.dll", "foo@4", (int, char), void);


How it can be understood ?


I need a simple working - "Inline" code.

Please, help.

MrTAToad

Most people here use FMOD (as it supports more operating systems), and there is a small sample program on using FMOD in the samples directory.

Put simply the DECLARE statement allows the GLBasic program to access a DLL by defining the function name, parameters it takes and the return value (if any)

com_1

Gernot - a question ?

"Include" - is that possible on GLBasic ?
If yes then - how ? (example, please)

And thanks for GLBasic (SDK version) - Gernot.

Kitty Hello

include works in inline. You must, however, get the headerpack. But I fear you won't like to link libraries as they must match the compiler. What are you trying to wrap? FMOD?

Please post a link to the FMOD API. I'll make you an example wrapper.

com_1

Gernot - I just want to build "Media Player" on GLBasic.

I have no time, no desire, to learn "C++" and "DLL" in GLBasic. (I thought that would include easier and faster.)
I need only Tutorials. (How does one reconcile FMOD with GLBasic)

Only Tutorials - Gernot. (maybe this can help)
http://www.genesis3d.com/~wog/tutorials/prog_gtestfmodsound/gtestfmodsound.htm



Gernot - Wir möchten nur "Media Player" auf GLBasic bauen.

Wir haben keine zeit und lust ("C++" und "GLBasic DLL" structure) lernen.
Wir haben gedacht - "include" wird besser und schneller.
Wir brauchen nur Tutorials. (wie kann man FMOD in GLBasic einfügen)

Nur Tutorials - Gernot. (Vielleicht das kann helfen)
http://www.genesis3d.com/~wog/tutorials/prog_gtestfmodsound/gtestfmodsound.htm

MrTAToad

Have a look at the FMOD gbas file...

Kitty Hello

Yes. Why aren't you trying the FMOd wrapper:

Samples/_Projects_/fmod_player was it.

com_1

Er(com_1) hat schon "FMOD - beispiel" gesehen.
Versucht was umbenennen oder überschreiben aber .....

GLBasic - ist seine(com_1) erste sprache.

Er spricht kein "C++".
Wie kann man was schreiben, wenn wir verstehen nichts.

Wir brauchen nur antwort von Ihnen.
Haben Sie lust " (FMOD in GLBasic) Tutorial (seit 0)" schreiben oder nicht ?

If "keine lust" then
print "Das ist die letzte FMOD frage"
endif


Sonst, er(com_1) macht nächste "kub" version.(erscheinungstermin: hoffentlich bis sommer)

Schranz0r

Take a look at this topic ;) -> http://www.glbasic.com/forum/index.php?topic=2678.msg19891#msg19891

I can help you a bit. If you have some problems, let me know that on a PM ;)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Kitty Hello

com_1: Schau das Beispiel "fmod_player" an. Bitte schließe die Datei "fmod.gbas", das ist die Bibliothek dazu. Diese Datei muss nur im Projekt sein. Die andere Datei "player_interface" ist ein Beispiel wie man FMOD startet:
Code (glbasic) Select

snd$ = "rb_1.it"
good = FMod_Load(snd$)
FMod_Play()
FMod_SetMasterVolume(1.0) // full volume / Volle Lautstärke


WHILE TRUE
PRINT "PLAY: "+snd$ + " returns: "+good, 100,100
PRINT "IsFinished: " + FMod_IsFinished(), 100, 120

PRINT "click mouse to stop", 100,140
IF MOUSEAXIS(3) THEN BREAK
SHOWSCREEN
WEND

FMod_Stop()


Schranz0r

Ja das mag gehen Gernot, nur hast du keinen MP3 Support mit drin ;)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Kitty Hello

hat FMod kein MP3?
Ja... blöd.

Welche DLL hat denn MP3? Kann mir bitte einer so eine DLL mit SDK zeigen, dass wir das kurz wrappen?


Kitty Hello

OK, read this tutoral here:
http://www.glbasic.com/forum/index.php?topic=2129.0

I'll wrap one function for you, so you get the point.

1. Open the file BASS/VB/Bass.bas <-- visual basic wrapper for BASS.dll
2. See the function declaration
Code (glbasic) Select

Declare Function BASS_Init Lib "bass.dll" (ByVal device As Long, ByVal freq As Long, ByVal flags As Long, ByVal win As Long, ByVal clsid As Long) As Long


3. Start a new gbas file (the wrapper)
4. Type:
Code (glbasic) Select

INLINE
DECLARE_C(BASS_Init, "bass.dll", (long device, long freq, long flags, long win, long clsid), long)

ENDINLINE

FUNCTION GLB_BASS_Init%: device%, freq%, flags%, win%, clsid%
INLINE
return BASS_Init(device, freq, flags, win, clsid);
ENDINLINE
ENDFUNCTION



That's the wrapping of one function. It would be cool to extend IMPORT so it can make use of DLLs...
But for now, you have to do it manually as said.

If the visualBasic wrapper says "ByVal", the value is passes as in GLBasic.