Author Topic: bass headache  (Read 3924 times)

fusion

  • Guest
bass headache
« on: 14 Jun '03 - 04:47 »
I am trying to use bass to stream a mp3 using the following code and it's not working and I have no idea why not. ( btw I am using delphi6 and bass1.8 )

procedure TForm1.Button1Click(Sender: TObject);
var
song : Hstream;
begin
song:= bass_streamcreatefile(false,'pill.mp3',0,0,0);
bass_streamplay(song,false,0);
end;

when I run the above code delphi spits out an error saying incompatable types string and pointer.

I tried amending the above so it looks like this and the error goes away but I don't hear anything.

procedure TForm1.Button1Click(Sender: TObject);
var
song : Hstream;
begin
song:= bass_streamcreatefile(false,PChar('pill.mp3'),0,0,0);
bass_streamplay(song,false,0);
end;

DanaPaul

  • Posts: 335
Re: bass headache
« Reply #1 on: 14 Jun '03 - 05:41 »

Quote
I tried amending the above so it looks like this and the error goes away but I don't hear anything.


Try this...

procedure TForm1.Button1Click(Sender: TObject);
 var
   song : Hstream;
   s: string
 begin
   s := 'pill.mp3' + #0;
   song:= bass_streamcreatefile(false,PChar(s),0,0,0);
   bass_streamplay(song,false,0);
   end;


bigjim

  • Posts: 232
Re: bass headache
« Reply #2 on: 14 Jun '03 - 12:22 »
Make sure bass dll is in system or your project dir- and also phil.mp3 is in your project dir too.

Code: [Select]

var
 file_handle : DWORD;
begin
 BASS_Init(-1, 44100, 0, form1.handle);
 BASS_Start;
 file_handle := BASS_StreamCreateFile(FALSE,pChar('phil.mp3'),0,0,0);
 BASS_StreamPlay(file_handle,FALSE,0);
end;


fusion

  • Guest
Re: bass headache
« Reply #3 on: 14 Jun '03 - 16:47 »
The first method did not work until I added the bass_start(); function to it and I am just wondering what is the purpose of the bass_Start() function ?

I read the docs and it said it "Starts (or resumes) the digital output." and while this makes sense when resuming a song it does not make sense when there is no song playing.

Here is an example to help show what I am talking about

Lets just say that the bass.dll file is like a stereo system and the Bass_Init() function is like turning on the power to the stereo (this part I understand)

Now that the power is on we want to hear the music so we tune to a station or use the comobnation of the Bass_StreamCreateFile and Bass_streamplay() functions to tune into our station and begin playback of the music. (again this part I understand)

What I don't understand is what the Bass_Start() function actually does during this process I mean the Bass_Init() function powers on the stereo and the Bass_StreamCreateFile and Bass_StreamPlay() functions tune in the station and plays the song what is the purpose of the Bass_Start() function

Thanks for any and all replies.

Ian @ un4seen

  • Administrator
  • Posts: 24940
Re: bass headache
« Reply #4 on: 14 Jun '03 - 17:32 »
Using the same "stereo system" analogy...

BASS_Init = choosing which hi-fi to use, and plugging it in the power socket
BASS_Start = switching it on
BASS_StreamCreateFile = putting CD/tape/etc in
BASS_StreamPlay = pressing play button
BASS_ChannelStop = pressing stop button
BASS_StreamFree = taking CD/tape/etc out
BASS_Stop = switching the hi-fi off
BASS_Free = pulling the plug out ;D

fusion

  • Guest
Re: bass headache
« Reply #5 on: 14 Jun '03 - 21:28 »
Thanks Ian,

Some of us need alil more of a visual explanation and thats helps clear alot of things up.