Recent

Author Topic: help trying to use Bass on ubuntu  (Read 8493 times)

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: help trying to use Bass on ubuntu
« Reply #15 on: September 04, 2021, 05:42:19 pm »
Hi!

BASS_STREAM_PRESCAN  is needed for mp3 or ogg but not for wav

Before you start the next question start reading the bass.chm !!!!

Winni

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: help trying to use Bass on ubuntu
« Reply #16 on: September 04, 2021, 09:48:41 pm »
Hi!

I made a  very simple MP3 player with BASS for you:

Load File  / Start  / Stop and a volume trackbar.

For some people that is enough.
But I think this may be the start of your further development.

BassTest in the attchment

Winni

stephanos

  • New Member
  • *
  • Posts: 38
Re: help trying to use Bass on ubuntu
« Reply #17 on: December 02, 2021, 10:39:05 pm »
I faced a similar problem using bass in Lazarus for Windows.  It might be relevant and helpful.  I placed bass.pas, bass.dll and the mp3 file I was working with in the project folder.  There is a comment in this topic about how that differs in Linux.

Code: Pascal  [Select][+][-]
  1. uses
  2.      bass
  3. var
  4.      EC : integer;   H : HSTREAM;  L_Seconds : double;
  5. begin
  6.      BASS_Init(0, 44100, 0, H, NIL);  // Without this code the code below will not work
  7.  
Notice how the fourth parameter is H.  Also, my objective was to extract data so something in the Init code might need to change in order to stream music.  There is lots about how to configure Init here:
http://www.un4seen.com/doc/#bass/BASS_Init.html

This bit of code will not be new to you.  Now you have BASS_Init, in place it should work. 
Code: Pascal  [Select][+][-]
  1. H := BASS_StreamCreateFile(FALSE, pchar(Utf8Encode('BAILE MINHA MADEIRA.mp3')), 0, 0, BASS_STREAM_DECODE);
  2. EC := BASS_ErrorGetCode();  write('Error Code = ', EC); // Expected and got zero
  3. L_Seconds := BASS_ChannelBytes2Seconds(H, L_Bytes); // copy to a variable the size in bytes
  4. // do other things
  5. BASS_StreamFree(H); // close the stream and free the resources

When
Code: Pascal  [Select][+][-]
  1. H := BASS_StreamCreateFile(FALSE, pchar(Utf8Encode('BAILE MINHA MADEIRA.mp3')), 0, 0, BASS_STREAM_DECODE);
fails, H becomes value: zero.  That zero is not to be confused with error code zero.  What it means is H can be tested to see if it worked:
Code: Pascal  [Select][+][-]
  1. if (H <> 0) then
  2.   do something  // because it worked and a stream was opened
  3. else
  4.   do something else // because a stream was not opened

Before I successfully inserted the BASS_Init line, the ‘H :=’ code did no work.  Use of the
Code: Pascal  [Select][+][-]
  1. EC := BASS_ErrorGetCode();  write('Error Code = ', EC); // Expected and got zero
Immediately after the ‘H :=’ code produced an error number of 8.  As you will see from the documentation website, 8 means ‘BASS_ERROR_INIT ’.  So I was being given a great big hint there about what the problem was.  More on error codes here:
http://www.un4seen.com/doc/#bass/BASS_ErrorGetCode.html

After I made the executable and put it on my MP3 player it did not work and asked for bass.dll to be present as well.

Finally, there is a dedicated bass forum, which solved this problem for me
http://www.un4seen.com/

I hope that helped and was not too late.  My problem was solved yesterday

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: help trying to use Bass on ubuntu
« Reply #18 on: December 02, 2021, 11:28:25 pm »
Hi!

I told you to read the bass.chm from the download ....

To help you convert the Bass-Errors to strings I made a string-array long time ago.

Perhaps it helps you for development.

Code: Pascal  [Select][+][-]
  1. // comments from Unit Bass
  2. BassErrors : array[-1..46] of string = (
  3.   {-1}          'some other mystery problem',
  4.   {0}           'all is OK',
  5.   {1}           'memory error',
  6.   {2}           'can''t open the file',
  7.   {3}           'can''t find a free sound driver',
  8.   {4}           'the sample buffer was lost',
  9.   {5}           'invalid handle',
  10.   {6}           'unsupported sample format',
  11.   {7}           'invalid position',
  12.   {8}           'BASS_Init has not been successfully called',
  13.   {9}           'BASS_Start has not been successfully called ',
  14.                 '', '',
  15.   {12}          'no CD in drive', //BASS_CD
  16.   {13}          'invalid track number', //BASS_CD
  17.   {14}          'already initialized/paused/whatever',
  18.                 '', '',
  19.   {17}          'not an audio track', // BASS_CD
  20.   {18}          'can''t get a free channel',
  21.   {19}          'an illegal type was specified',
  22.   {20}          'an illegal parameter was specified',
  23.   {21}          'no 3D support',
  24.   {22}          'no EAX support',
  25.   {23}          'illegal device number',
  26.   {24}          'not playing',
  27.   {25}          'illegal sample rate',
  28.                 '',
  29.   {27}          'the stream is not a file stream',
  30.                 '',
  31.   {29}          'no hardware voices available',
  32.                 '',
  33.   {31}          'the MOD music has no sequence data',
  34.   {32}          'no internet connection could be opened',
  35.   {33}          'couldn''t create the file',
  36.   {34}          'effects are not available',
  37.                 '', '',
  38.   {37}          'requested data is not available',
  39.   {38}          'the channel is/isn''t a "decoding channel"',
  40.   {39}          'a sufficient DirectX version is not installed',
  41.   {40}          'connection timedout',
  42.   {41}          'unsupported file format',
  43.   {42}          'unavailable speaker',
  44.   {43}          'invalid BASS version (used by add-ons)',
  45.   {44}          'codec is not available/supported',
  46.   {45}          'the channel/file has ended',
  47.   {46}          'the device is busy'
  48.   );
  49.  

The empty strings belong to the errors of bass modules that I have not explored.

Winni

stephanos

  • New Member
  • *
  • Posts: 38
Re: help trying to use Bass on ubuntu
« Reply #19 on: December 03, 2021, 12:47:56 pm »
I faced a similar problem using bass in Lazarus for Windows.  It might be relevant and helpful.  I placed bass.pas, bass.dll and the mp3 file I was working with in the project folder.  There is a comment in this topic about how that differs in Linux.

Code: Pascal  [Select][+][-]
  1. uses
  2.      bass
  3. var
  4.      EC : integer;   H : HSTREAM;  L_Seconds : double;
  5.  
  6. begin
  7.      BASS_Init(0, 44100, 0, H, NIL);  // Without this code the code below will not work

Notice how the fourth parameter in the BASS_Init code is H.  Also, my objective was to extract data so something in the Init code might need to change in order to stream music.  There is lots about how to configure Init here:
http://www.un4seen.com/doc/#bass/BASS_Init.html

The BASS_Init code will be new to you.  Now you have BASS_Init, in place it should work. 
Code: Pascal  [Select][+][-]
  1. H := BASS_StreamCreateFile(FALSE, pchar(Utf8Encode('BAILE MINHA MADEIRA.mp3')), 0, 0, BASS_STREAM_DECODE);
  2. EC := BASS_ErrorGetCode();  write('Error Code = ', EC); // Expected and got zero
  3. L_Seconds := BASS_ChannelBytes2Seconds(H, L_Bytes); // copy to a variable the size in bytes
  4. // do things
  5. BASS_StreamFree(H); // close the stream and free the resources

When
Code: Pascal  [Select][+][-]
  1. H := BASS_StreamCreateFile(FALSE, pchar(Utf8Encode('BAILE MINHA MADEIRA.mp3')), 0, 0, BASS_STREAM_DECODE);
fails, H becomes value: zero.  That zero is not to be confused with error code zero.  What it means is H can be tested to see if it worked:
Code: Pascal  [Select][+][-]
  1. if (H <> 0) then
  2.   do something  // because it worked and a stream was opened
  3. else
  4.   do something else // because a stream was not opened

Before I successfully inserted the BASS_Init line, the ‘H :=’ code did no work.  Use of the
Code: Pascal  [Select][+][-]
  1. EC := BASS_ErrorGetCode();  write('Error Code = ', EC); // Expected and got zero
Immediately after the ‘H :=’ code produced an error number of 8.  As you will see from the documentation website, 8 means ‘BASS_ERROR_INIT ’.  So I was being given a great big hint there about what the problem was.  More on error codes here:
http://www.un4seen.com/doc/#bass/BASS_ErrorGetCode.html

After I made the executable and put it on my MP3 player it did not work.  I needed to place bass.dll in the same folder as the EXE.

Finally, there is a dedicated bass forum, which solved this problem for me
Code: Pascal  [Select][+][-]
  1. http://www.un4seen.com/

I hope that helped and was not too late.  My problem was solved yesterday

 

TinyPortal © 2005-2018