BASS_ChannelGetAttributes(handle,NULL,vol,NULL);
In this example "handle" is undefined because you are calling the BASS_ChannelGetAttributes function within your TForm.Create method, and "handle" will correspond to your TForm.handle once it is created. Do not use "handle" to represent a Bass Channel, Stream, etc.
Try this...
function TForm1.GetVolulme : Integer;
var freq, volume : DWORD; Pan : Integer;
begin
BASS_ChannelGetAttributes(fChannel, freq, volume, Pan);
result := volume;
end;
so I am doing as the docs say to do and I am getting the error ... so if it was simple then it would work as documented.
Yes, you are doing as the (
Bass) Doc's specify, however, Delphi with its strict type checking is preventing you from doing something that the compiler (Delphi) doesn't expect. The Delphi flavor of the Bass header files have declared the BASS_ChannelGetAttributes function as follows...
BASS_ChannelGetAttributes = function (handle: DWORD;
var freq, volume: DWORD;
var pan: Integer): BOOL; stdcall;
In this declaration "var" is actually a memory location where Bass (the DLL) can write a (return) value. Delphi will not allow you to use a "var" named "null". If the function was declared as follows...
BASS_ChannelGetAttributes = function (handle: DWORD; freq, volume:
pDWORD; pan:
pInteger): BOOL; stdcall;
...then you would be able to declare unused parameters as "nil." However, this second declaration will not work as expected because Bass is expecting a memory location, not a pointer to a memory location. And, for what its worth, pointers to variables are a bitch to work with for folks with little experience using pointers.
Guess I should just stick with what I know and forget about programming in delphi all together.
I don't know crap abount PHP but I can assure you that hunkering down and learning Delphi will not dissapoint you in the long run.
One of the suggestions that Ian posted was to use Global volumes...
function TForm1.GetGainVolume : Integer;
var MVol, SVol, STVol : DWORD;
begin
BASS_GetGlobalVolumes(MVol, SVol, STVol);
result := MVol;
end;
To summarize, live with Bass retrieving/returning all values when calling BASS_ChannelGetAttributes or use the other functions that are more specific, such as BASS_SetGlobalVolumes.