Hi,
Im succesffuly working with Bass.dll.
Now i can do almost everything but find a trouble to work with this kind of procedure (its in VB).
I receive a buffer and the length of the buffer in the parameters and need to read it word by word or float by float (i preffer word but its not important) do something with it and rite it back into memory.
See the example (parts in red are giving troubles)
Code: Select all
Public Sub Rotate(ByVal handle As Long, ByVal channel As Long, ByVal buffer As Long, ByVal length As Long, ByVal user As Long)
Dim d() As Single, a As Long
ReDim d(length / 4) As Single
Call CopyMemory(d(0), ByVal buffer, length)
For a = 0 To (length / 4) - 1 Step 2
d(a) = d(a) * CSng(Abs(Sin(rotpos)))
d(a + 1) = d(a + 1) * CSng(Abs(Cos(rotpos)))
rotpos = fmod(rotpos + 0.00003, PI)
Next a
Call CopyMemory(ByVal buffer, d(0), length)
End Sub
If OpenLibrary(1,"kernel32")
*CopyMemory = IsFunction(1,"RtlMoveMemory")
EndIf
And inside the procedure:
*Memory = AllocateMemory(0,length,0)
If *Memory
If CallFunctionFast(*CopyMemory,*Memory, buffer, length)
FreeMemory(0)
EndIf
EndIf
But crashes.. i tried CallFunctionFast(*CopyMemory,*Memory, @buffer, length) and crashes too.
I tried another way:
For i = 0 To length Step 4
ChD.w = PeekW(buffer + i)
ChI.w = PeekW(buffer + i + 2)
... do something
PokeW(buffer + i,ChD)
PokeW(buffer + i + 2,ChI)
Next i
Its dont crash but its like im not doing nothing... i dont heard anychanges.
Any idea?
Best Regards
Ricardo
Dont cry anymore...
