Jump to content
Tuts 4 You

Bass.dll


ragdog

Recommended Posts

Posted

Hi

I have download the new bass.dll version 2.4.5

Now compile i my old app hmm this works not

invoke BASS_StreamCreateFile,NULL,addr MusicFile,0,0,BASS_SAMPLE_LOOP

error A2114: INVOKE argument type mismatch : argument : 4

error A2114: INVOKE argument type mismatch : argument : 3

I look in the c/c++ package and find this

BASS_StreamCreateFile(FALSE,file,0,0,BASS_SAMPLE_LOOP

And this works why?unsure.gif

Now have i look in the help file an see:

HSTREAM BASS_StreamCreateFile(

BOOL mem,

void *file,

QWORD offset,

QWORD length,

DWORD flags

);

What make i by QWORD?

greets,

Posted

If an executable statement or a designation between the PROC statement and the INVOKE statement is inserted, the error does not occur. The example code below causes uncommenting the line before you call that the assembler to generate a local label and the code will compile correctly.

; Assemble options needed: none

.MODEL large, C

cPrologue MACRO szProcName, flags,

cbParams, cbLocals,

rgRegs, rgUserParams

LOCAL count

count equ 0

exitm <cbParams>

ENDM

OPTION PROLOGUE: cPrologue

Yak PROTO FAR, :WORD, :WORD, :WORD, :WORD

.CODE

Llama PROC NEAR

; Uncomment following line to remove error

; dummy:

INVOKE Yak, AX, BX, CX, DX

Llama ENDP

END Llama

I hope that help you wight the error.

Posted (edited)

First question i have is, are you trying to use a 64 bit library with your 32 bit project or are you assembling a 64 bit project?

If it is a 32 bit library, i'm not sure why it would be asking for a QWORD, but have you tried prototyping the function with those size parameters?

Also, are you trying to use the old .inc file with the newer .lib file? If there have been changes then you will need a current .inc file as well as a current .lib file wont you?


BASS_StreamCreateFile PROTO _mem:DWORD,_file:DWORD,_offset:QWORD,_length:QWORD,_flags:DWORD;declare a single QWORD in your data section and after ensuring it is NULL, pass that as a parameter:
.data?
qwZero QWORD ?.code
invoke BASS_StreamCreateFile,NULL,addr MusicFile,qwZero,qwZero,BASS_SAMPLE_LOOP

Just as an example of what i mean:


.data?
qwZero QWORD ?.code
SomeFunc PROC qwOne:QWORD,qwTwo:QWORD Ret
SomeFunc EndP
invoke SomeFunc,qwZero,qwZero

This assembled to:


00401070 . FF35 08304000 PUSH DWORD PTR [403008]
00401076 . FF35 04304000 PUSH DWORD PTR [403004]
0040107C . FF35 08304000 PUSH DWORD PTR [403008]
00401082 . FF35 04304000 PUSH DWORD PTR [403004]
00401088 . E8 25000000 CALL 004010B2

As you can see, because it is a 32 bit environment MASM had to split the QWORD into 2 DWORDs and passes each half to the function. Because it is __stdcall by default, the function corrects the stact at return. Although we can pass a QWORD as a parameter, MASM doesn't allow us to arbitrarily pass '0' or 'NULL' for a 64 bit parameter. :(

HR,

Ghandi

Edited by ghandi
Posted

Thanks for the information

I have try it i cannot play with this new bass.dll


ShowOpenFileDialog proc
local qwZero :QWORD ; for 64-bit parameters!!!.data
szFilter db "XM-Files",0,"*.xm",0,0.data?
hBuffer db 512 dup (?)
ofn OPENFILENAME <>.code
invoke RtlZeroMemory,addr hBuffer, 256
mov ofn.lStructSize, SIZEOF ofn
mov ofn.lpstrFilter, offset szFilter
mov ofn.lpstrFile, offset hBuffer
mov ofn.Flags, OFN_EXPLORER + OFN_FILEMUSTEXIST + OFN_PATHMUSTEXIST
mov ofn.nMaxFile,512
invoke GetOpenFileName,addr ofn
.if eax == TRUE
invoke BASS_Init,-1,44100,0,0,NULL
invoke BASS_StreamCreateFile,FALSE,offset hBuffer,qwZero,qwZero,BASS_SAMPLE_LOOP
invoke BASS_MusicLoad,FALSE,offset hBuffer,qwZero,0,BASS_MUSIC_RAMP or BASS_SAMPLE_LOOP,0
invoke BASS_ChannelPlay,eax,FALSE
.endif
ret
ShowOpenFileDialog endp

Have you or any an idea?

Posted (edited)

her is an examble from delphi i thing its easy to convert to asm.

procedure TForm1.FormCreate(Sender: TObject);

var

h: HMUSIC;

begin

BASS_Init(-1, 44100, 0, handle, nil);

h:= BASS_MusicLoad(True, @xm, 0, length(xm), BASS_MUSIC_LOOP or BASS_MUSIC_RAMPS, 0);

BASS_ChannelPlay(h, True);

end;

procedure TForm1.FormDestroy(Sender: TObject);

begin

BASS_Free;

end;

and to this

invoke BASS_StreamCreateFile,FALSE,offset hBuffer,qwZero,qwZero,BASS_SAMPLE_LOOP

invoke BASS_MusicLoad,FALSE,offset hBuffer,qwZero,0,BASS_MUSIC_RAMP or BASS_SAMPLE_LOOP,0 *

invoke BASS_ChannelPlay,eax,FALSE

*change this FALSE to True

you whant make are mod player?

Edited by accede
Posted (edited)

Hmm i think to convert is not this problem

only the new bass.dll with this 64 bit support

it gives different procedurs and parameter from older version to newer

Edited by ragdog
Posted

Ok I have it solved with

local p64 :QWORD ; for 64-bit parameters!!!

mov DWORD PTR [p64], 0

mov DWORD PTR [p64+4], 0

Thanks

Posted

Yes, if you use a LOCAL variable, it will most likely contain junk (its stack memory, remember?), so you must explicitly zero it first, which is why i had it in uninitialized data, because it takes up no disk space but is mapped into the .rdata section and allocated at runtime.

HR,

Ghandi

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...