Author Topic: BASS CD Ripper Library  (Read 42925 times)

3delite

  • Posts: 907
BASS CD Ripper Library
« on: 28 Oct '08 - 20:52 »
Hi!

I made a BASS CD Ripper Library which makes it easy to add audio CD ripping functionality to your application.
  • Ripp multiple tracks or the whole CD as one big file
  • Ripp to WAV or
  • Ripp with any command line encoder on the fly, album mode or multiple track mode

Update 1.1.

  • Added resampling function
  • Fixed unicode version command line problem

Update 1.1.3

  • Added single track ripping function
  • Fixed unicode version WAV writing problem

Update 1.1.4

  • More command line option patterns
  • Fixed progress reporting when using resampling

Update 1.1.5

  • Added option to ripp to WMA

Update 1.1.6

  • Added function to get the channel handles before ripping (set DSPs etc. - standard BASS feature :) )

Download: BASS CD Ripper 1.1.6.zip

Beta testers are welcome!

3delite
« Last Edit: 14 Dec '08 - 13:47 by 3delite »

3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #1 on: 12 Nov '08 - 16:35 »
Update 1.1.

  • Added resampling function
  • Fixed unicode version command line problem

Download: BASS CD Ripper 1.1.zip

3delite

danzman

  • Posts: 58
Re: BASS CD Ripper Library
« Reply #2 on: 26 Nov '08 - 04:28 »
Hi, I toyed around with the sample project and it works great! I do have one question. How do I selectively rip a track or series of non-sequential tracks from a CD. Can you comment on this?

3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #3 on: 26 Nov '08 - 10:51 »
Ok, it's added. :)

Update 1.1.3

  • Added single track ripping function
  • Fixed unicode version WAV writing problem

Download: BASS CD Ripper 1.1.3.zip

3delite

danzman

  • Posts: 58
Re: BASS CD Ripper Library
« Reply #4 on: 26 Nov '08 - 11:35 »
Thanks! I will try the new version. BTW whem do I use the ANSI or the Unicode version?
(Sorry, I am a newbie when it comes to Audio programming).


3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #5 on: 26 Nov '08 - 11:40 »
Well, use the unicode version when you want to create unicode file names. :)
If you are using Delphi 2009 you probably want to use the unicode version so then everything is unicode. :)

3delite

3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #6 on: 7 Dec '08 - 03:17 »
Update 1.1.4

  • More command line option patterns
  • Fixed progress reporting when using resampling

Download: BASS CD Ripper 1.1.4.zip

3delite

3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #7 on: 9 Dec '08 - 18:19 »
Update 1.1.5

  • Added option to ripp to WMA

Download: BASS CD Ripper 1.1.5.zip

3delite

pebbledog

  • Guest
Re: BASS CD Ripper Library
« Reply #8 on: 10 Dec '08 - 18:49 »
How can I use this library in vb.net?  Do you have any way of making this into a COM accessible dll?

3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #9 on: 10 Dec '08 - 19:56 »
I don't know what a COM accessible dll is, but I think you can.
You just have to translate the BASSCDRipperDefs.pas to VB and use it as the same mode as BASS.
The BASSCDRipperDefs.pas is using dynamic loading but you can use a simple static loading also.
It's just a few minute work to translate it. (I might try to do that (with zero VB knowledge) but then you have to test it, I don't know VB.)

Regards
3delite

EDIT: Here's the attached VB unit, this is my first VB attempt so probably needs much fixing.
But please tell me how you get on with it!
« Last Edit: 10 Dec '08 - 20:19 by 3delite »

wgrumblat

  • Posts: 5
Re: BASS CD Ripper Library
« Reply #10 on: 13 Dec '08 - 12:22 »
Hi 3delite,

I try to include your ripper library into my VB6 project. I made some changes to the module definitions and the project compiles without error now. But when I try to call the BASSCDRipper_SetParams function, I get a runtime error '53', File not found: BassCDRipper.dll. Although the dll is in the project directory. Do you have any idea about this? All BASS dll's are in the same directory, no problem at all.

If you want, I can send you my module definition file (BassCDRipper.bas) for inspection.

This is my code for the ripper:
----------
Dim pRip As TBASSCDRipperParams
Dim setParameters As Long

pRip.Drive = 2
pRip.FileName = "r:\test\testrip.wav"
pRip.Format = FORMAT_WAV
pRip.Resample = 0
pRip.AlbumMode = 1

setParameters = BASSCDRipper_SetParams(0, pRip) 'This results inthe run time error
----------



Regards,
Wolfgang

3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #11 on: 13 Dec '08 - 12:42 »
I see. You have to create a ripper object first (you are passing 0 as ripper object and that's no good).
First you have to make sure to load BassCDRipper.dll into the process space (don't know how's that done in VB - LoadLibary() in Delphi) and then create a ripper object with BASSCDRipper_Create() (and use BASSCDRipper_Free() when you are done), and then pass this object to all functions that you call (0 will not do it).  :)
And also you have to successfully initialize BASS before issueing the BASSCDRipper_Ripp() command!
Thanx for the VB include file, please send it to 3delite AT 3delite.hu and also please send the compiled exe that you made so I can debug and see if the parameters arive successfully and everything is ok.

Regards
3delite
« Last Edit: 13 Dec '08 - 13:18 by 3delite »

wgrumblat

  • Posts: 5
Re: BASS CD Ripper Library
« Reply #12 on: 13 Dec '08 - 21:29 »
Hello 3delite,

I still have the 'File not found' runtime error.

After searching the web, I found only one possible reason: your ripper dll might depend on another dll that is missing on my computer. Can you please check that? Did you create the dll with Delphy? Maybe there is a runtime dll that I need.

I will mail you the .bas module, when I have tested it, to be sure that it works.

Regards,
wolfgang

wgrumblat

  • Posts: 5
Re: BASS CD Ripper Library
« Reply #13 on: 13 Dec '08 - 21:36 »
OK, this problem is solved. It was the bassenc.dll that was really missing. Thanks to the 'Dependancy Walker' from Visual Studio.

Now I will continue testing.

Regards,
Wolfgang

wgrumblat

  • Posts: 5
Re: BASS CD Ripper Library
« Reply #14 on: 13 Dec '08 - 21:50 »
Private Sub form_load()
   
    Dim strFile As String
    strFile = "r:\test\testrip.wav"
   
    'create Ripper Object
    lRip = BASSCDRipper_Create()
    'Ripper Parameters
    Dim pRip As TBASSCDRipperParams
    pRip.Drive = 2
    pRip.FileName = VarPtr(strFile)
    pRip.Format = FORMAT_WAV
    pRip.Resample = 0
    pRip.AlbumMode = 1
    'Set Parameters
    lResult = BASSCDRipper_SetParams(lRip, pRip)

    'here I get runtime error 'Bad DLL Calling Convention'
    'but  lResult = BASSCDRipper_SetParams(lRip, pRip) works without error
    'any idea what I am doing wrong?

End Sub
« Last Edit: 13 Dec '08 - 21:53 by wgrumblat »

(: JOBnik! :)

  • Posts: 1065
Re: BASS CD Ripper Library
« Reply #15 on: 14 Dec '08 - 08:52 »
Hi ;D

Next functions are wrong for VB:
Sub OnProgress(BASSCDRipper: Pointer; Progress, TotalProgress: Cardinal)
Sub WMAEncBefore(BASSCDRipper: Pointer; WMAEncodingHandle: Cardinal; Track: Integer)

please take a look at BASS/BASS_FX VB modules to see how to fix this.

Pointer = Long
Cardinal = Long

I don't think you have to include this function: VBStrFromAnsiPtr
because the user already included it, using BASS.BAS :)

Why won't you update your 1st post with the latest download link, instead of searching all posts for new updates :)
« Last Edit: 14 Dec '08 - 08:58 by (: JOBnik! :) »

3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #16 on: 14 Dec '08 - 12:29 »
Private Sub form_load()
   
    Dim strFile As String
    strFile = "r:\test\testrip.wav"
   
    'create Ripper Object
    lRip = BASSCDRipper_Create()
    'Ripper Parameters
    Dim pRip As TBASSCDRipperParams
    pRip.Drive = 2
    pRip.FileName = VarPtr(strFile)
    pRip.Format = FORMAT_WAV
    pRip.Resample = 0
    pRip.AlbumMode = 1
    'Set Parameters
    lResult = BASSCDRipper_SetParams(lRip, pRip)

    'here I get runtime error 'Bad DLL Calling Convention'
    'but  lResult = BASSCDRipper_SetParams(lRip, pRip) works without error
    'any idea what I am doing wrong?

End Sub


My knowledge of VB is close to zero, but as far as I know VB uses stdcall as the calling convention and BASS CD Ripper Library uses stdcall to (like BASS). So I can't recommend you anything. Maybe a VB guru will come by and help.
From the Delphi view using the ripper is the same as using BASS.

Ok I'll update the first post from now on.
Thanx for the comments.

Regards
3delite

danzman

  • Posts: 58
Re: BASS CD Ripper Library
« Reply #17 on: 14 Dec '08 - 13:02 »
I can see that you are hard-coding the drive designation. Can you get the drive number as in BassCD example? I understand that the drive designations are zero-indexed, meaning - count starts from zero. So the second drive is 1. This happened to me before when I hardcoded the drive number.

-- just my two bits.

3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #18 on: 14 Dec '08 - 13:47 »
Sorry but I don't understand you. What do you mean by hard coding the drive designation? The drive parameter will be passed to BASSCD so it's the same methode as with using the BASSCD. It is zero based by BASCD, I did not change anything...  ???

Update 1.1.6

  • Added function to get the channel handles before ripping (set DSPs etc. - standard BASS feature :) )

EDIT: It just came to my mind to accomplish the following: is it possible to ripp in real time (issue BASS_ChannelPlay()) to for example get the channel handle with BASSMIX add a recording channel to it, and record the karaoke singing together with the audio cd on the fly, with all the options: to WMA, command line encoder etc.?

Regards
3delite
« Last Edit: 14 Dec '08 - 14:04 by 3delite »

evstevemd

  • Posts: 101
Re: BASS CD Ripper Library
« Reply #19 on: 19 Dec '08 - 04:44 »
I'm still Bass Learner. Once I grasp the basics, I will start wondering with ripping and all these stuffs. Nice work guys!

3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #20 on: 23 Oct '09 - 16:27 »
Hi!

The package has been updated with a VC++ example. :)

Homepage: BASS CD Ripper Library

Best regards
3delite

redobbin

  • Posts: 4
Re: BASS CD Ripper Library
« Reply #21 on: 8 Nov '12 - 20:33 »

Hello I am working with the BASSCDRipper_Ripp in Delphi 3.  I see from the hearder that it returns bool - however, I could not find an documentation any of these call to know when true or false is returned.  Can you advise or point me to some documentation?  (In fact, in the examples I don't see a return ever being checked.)

Chris

  • Posts: 1810
Re: BASS CD Ripper Library
« Reply #22 on: 8 Nov '12 - 20:48 »
By the way I like Delphi but.....Delphi 3 !!!!!!!!!!!!!You are trying to develop with a abolute outdated Dev-Language.(Delphi 3 is from 1997.15 years old !!).No 64bit Compiler No int64 Support...No support for Vista/win7/win8 and so on...try a highe delphi version or change to Lazarus(OpenSource).

redobbin

  • Posts: 4
Re: BASS CD Ripper Library
« Reply #23 on: 8 Nov '12 - 21:50 »
Everything works, I just did not see docs for the BASSCDRipper and wanted to know what the returns are or if they should be ignored since the examples do not seem to interrogate them. 

3delite

  • Posts: 907
Re: BASS CD Ripper Library
« Reply #24 on: 27 Nov '12 - 12:54 »
Ok. An update is available at the official page: BASS CD Ripper Library

Updates:

  • Added function to specify a CDDataProc callback function (see BASSCD docs for details)
  • Fixed BASSCDRipper_Ripp() return value
  • Changed error code values to not interfere with BASS error codes

Hints:

1. Before calling the 'Ripp' commands BASSCD's functionality can be changed by the BASS_SetConfig() function. See the BASSCD docs's 'Config' options (BASS_CONFIG_CD_AUTOSPEED, BASS_CONFIG_CD_CDDB_SERVER, BASS_CONFIG_CD_FREEOLD, BASS_CONFIG_CD_RETRY and BASS_CONFIG_CD_SKIPERROR).

2. BASSCDRipper_SetGetChannelCallback() can be used to get the BASS CD channel handles (set it before calling the 'Ripp' functions) and do anything that is possible with it as with BASS channels (DSP, SYNCS etc.). For example it can be used to set a BASS_SYNC_CD_ERROR and/or BASS_SYNC_CD_SPEED syncs. See the BASSCD docs 'Streams/CD syncs' page.

3. BASSCDRipper_GetLastError() can be used to get BASS or BASS CD Ripper Library error codes.

It hasn't been tested, please tell me if any errors occurs.