Getting supported read speed of CD drives

Started by kafffee,

kafffee

Hi there :-)

I want to get the supported read speeds of my CD drive and I am wondering about the results:

This is my VB.NET code, I hope you'll be able to read it, otherwise, give me a hint and I'll explain it:

Private Function GetSupportedSpeedFactors() As List(Of Integer)

    Dim CDSpeed As New BASS_CD_INFO()
    CDSpeed = BassCd.BASS_CD_GetInfo(DiscDriveIndex)
    MaxSpeed = CInt(CDSpeed.maxspeed / 176.4)            'get maximum speed
    Debug.WriteLine("MaxSpeed: " & CStr(MaxSpeed))      'print maximum speed
    Dim Factors As New List(Of Integer)                  'initialize list of supported speeds
    For i = 1 To MaxSpeed                                'iterate thru all possible speeds
        Dim success As Boolean = BassCd.BASS_CD_SetSpeed(DiscDriveIndex, i)  'set speed
        If success Then
            Dim SpeedFactor As Integer = CInt(BassCd.BASS_CD_GetSpeedFactor(DiscDriveIndex)) 'get rounded down value of speed that has been set
            If i = SpeedFactor Then                      'if they match, add supported speed to list of supported speeds
                Factors.Add(i)
                Debug.WriteLine("Speed " & CStr(i) & " supported." & Environment.NewLine) 'print results
            Else
                Debug.WriteLine("Speed " & CStr(i) & " not supported." & Environment.NewLine)
            End If
        End If
    Next
    Return Factors
End Function

The weird thing about it is that the only match I get is a speed of
10x
All the other ones, from 1 to 40, which is the maximum speed of my drive (as returned by
BassCd.BASS_CD_GetInfo(DiscDriveIndex)) will return "not supported".

How can this be? Is there anything wrong with my code? Or can you think of a better way to do this?

Thanks to your answers in advance :-)

Ian @ un4seen

The BASS_CD_SetSpeed "speed" parameter is in KB/s rather than a multiplier. To convert a multiplier to KB/s, you need to multiply by 176.4. So something like this:

        Dim success As Boolean = BassCd.BASS_CD_SetSpeed(DiscDriveIndex, CInt(i * 176.4))  'set speed

kafffee

Ah okay. there's another overload...

I tried that and now it's better, but something still seems to be wrong:

I am getting different lists:

For instance:
10, 16, 32, 40

... and next time I open my app:

10, 24, 32

Same CD drive, same CD in it...

do you have any idea of how come this is happening?

________________________________________________________

What I am also wondering about is that when I take this overload...:


Public Shared Function BASS_CD_SetSpeed(drive As Integer, speed As Integer) As Boolean
...I am supposed to pass the speed in KB/sec

and that when I use...:

Public Shared Function BASS_CD_SetSpeed(drive As Integer, speed As Single) As Boolean

...I am supposed to pass the factor.

 That would make more sense to me the other way around, because the speed factor should obviously always be an integer... Am I right?

At least that's what I found in the docs of radio42....

Ian @ un4seen

Quote from: kafffeeAh okay. there's another overload...

I tried that and now it's better, but something still seems to be wrong:

I am getting different lists:

For instance:
10, 16, 32, 40

... and next time I open my app:

10, 24, 32

Same CD drive, same CD in it...

do you have any idea of how come this is happening?

No, that seems strange. For comparison, what does other CD software report? You could also try without a CD in the drive, to see if that makes a difference.

Quote from: kafffeeWhat I am also wondering about is that when I take this overload...:


Public Shared Function BASS_CD_SetSpeed(drive As Integer, speed As Integer) As Boolean
...I am supposed to pass the speed in KB/sec

and that when I use...:

Public Shared Function BASS_CD_SetSpeed(drive As Integer, speed As Single) As Boolean

...I am supposed to pass the factor.

 That would make more sense to me the other way around, because the speed factor should obviously always be an integer... Am I right?

At least that's what I found in the docs of radio42....

Yeah, that is a bit confusing. The 1st overload ("speed As Integer") is the standard BASSCD function. The 2nd overload ("speed As Single") is added by BASS.Net and should probably be called BASS_CD_SetSpeedFactor instead, similar to the BASS_CD_GetSpeedFactor function. I'll check with Bernd.

kafffee

Okay, I checked with a burning software, and it displays 24x and 48x, and 48x as maximum speed. So even the maximum speed is different from what I get with...

Dim CDSpeed As New BASS_CD_INFO()
CDSpeed = BassCd.BASS_CD_GetInfo(DiscDriveIndex)
MaxSpeed = CInt(CDSpeed.maxspeed / 176.4) 

...which returns straight 40x

______________________________________________________________________________________

With my own app, I checked another time with the same disc, now I get 10x and 32x.

When I don't have a disc in the drive, I get a list with no entries...

_______________________________________________________________________________________

Good idea to check with Bernd :-)


radio42

Yes, I can rename those function overload - but it won't change any results you get.

Ian @ un4seen

Quote from: kafffeeOkay, I checked with a burning software, and it displays 24x and 48x, and 48x as maximum speed. So even the maximum speed is different from what I get with...

Dim CDSpeed As New BASS_CD_INFO()
CDSpeed = BassCd.BASS_CD_GetInfo(DiscDriveIndex)
MaxSpeed = CInt(CDSpeed.maxspeed / 176.4) 

...which returns straight 40x

For reference, what does the drive manufacturer say the maximum read speed is?

kafffee

Sry for the late answer, been pretty busy...


@radio42

QuoteYes, I can rename those function overload - but it won't change any results you get.

Do what you think, but no need to do this just for me, now that I know...




@Ian

QuoteFor reference, what does the drive manufacturer say the maximum read speed is?

Hard to figure out... My PC is pretty old, only thing I could find aout about it is that the drive is apparently being called HL-DT-ST DVD+-RW GHB0N