PDA

View Full Version : BASS, Compile Issues



DarknessX
01-06-2007, 12:01 AM
Operating System: WindowsXP
Libraries: BASS, slightly modified (to make the Result work)
Compiler: PURE FPC

Ok, well, I've been trying out different types of audio setups, and so far, this is what I've done, in BASS:

{$mode delphi}
program BassTest;
uses bass, crt;

var
x : integer;
error : ansistring;
volume : integer;

begin
error := '';
writeln('Stage 1: Initilization.');
BASS_Init(-1,22040,BASS_DEVICE_SPEAKERS,0,nil);
error := BASS_ErrorGetCode;
if error <> '' then writeln(error) else writeln('Initlization Completed Successfully!');
readkey;
writeln;
writeln('Stage 2: Check Volume.');
volume := BASS_GetVolume;
error := Bass_ErrorGetCode;
if error <> '' then writeln(error) else writeln('Volume Check completed successfully.');
readkey;
writeln;
Writeln('Stage 3: Set Volume.');
writeln('Type a number between 1 and 100 to set the volume. 0 mutes it.');
readln(x);
Bass_SetVolume(x);
error := bass_errorgetcode;
if error <> '' then writeln(error) else begin volume := bass_getvolume; writeln('Set Volume Successfully! Volume is now at: ',volume); end;
readkey;
writeln;
writeln('Stage 4: Load Music File');
bass_musicload(false,'D:\Music\If I Cant.mp3',0,0,BASS_MUSIC_AUTOFREE,0);
error := bass_errorgetcode;
if error <> '' then writeln(error) else writeln('Music loaded successfully!');
readkey;
writeln;
bass_free;
end.


So, my problem being...



...
Parameters
mem TRUE = load the MOD music from memory.
file Filename (mem = FALSE) or a memory location (mem = TRUE).
offset File offset to load the MOD music from (only used if mem = FALSE).
length Data length... 0 = use all data up to the end of file. If length over-runs the end of the file, it'll automatically be lowered to the end of the file.
...

{The code in question is in Stage 4, loading music files, BASS_MusicLoad}
So, as you can see in my code, I have the parameter mem = FALSE. However, I get this annoying error message while trying to compile, yelling at me that the parameter #2 (file) must be a pointer, not an ansistring... So, I tried setting it true. No difference. I'm positive it's looking for something like...
$wholebunchofnumbers ($0040928234)
Maybe not, but is there some way to make it work? I can edit the BASS file, if needed....

jasonf
01-06-2007, 12:33 AM
I've never used BASS personally, but this looks like it might be what you're looking for.

Procedure TBass.load(name:string;num:integer);
var
p : PChar;
Begin
p := PChar(name);

stream[num] :=BASS_StreamCreateFile(FALSE,p,0,0,0);
if (stream[num] = 0) then begin end;
End;

DarknessX
01-06-2007, 12:43 AM
Ahah! Thanks, Jason! Exactly what I needed, I never thought of using a Pchar :D

Well, now just to figure out how to load .mp3's, and not mod files :(

It seems that particular function won't load a basic mp3.

Well, just figured that one out too :P Need to load a sample, not a MOD.

Robert Kosek
01-06-2007, 12:50 AM
MUSIC functions are for modules, STREAM functions are for MP3s. They store the same type of result (a handle) so it isn't hard to store them and have a binary flag to indicate which is what.

DarknessX
01-06-2007, 12:52 AM
Yeah, I just figured that out as you replied :P Thanks anyways though.