Musikcd abspielen an bestimmter Position

  • Hi,

    ich würde gerne eine Musikcd in Autoit abspielen. Habe es zuerst mit den Soundfunktionen versucht und auch schon einige Musikplayer in Autoit angeschaut. Problem an der Sache ist, dass diese alle ein Musikfile(mp3, wav ect) benötigen um richtig zu arbeiten.
    Da nun aber auf Musikcds im Normalfall nur cda-Dateien vorhanden sind kann man diese zwar öffnen, aber die CD beginnt dann von vorne zu spielen und man kann nicht zu einem bestimmten Song springen.
    Da ich nun allerdings die Startoffsets der Songs habe an der diese beginnen müsste man ja auch irgendwie direkt zu diesen Offsets springen können und von dort aus dann die CD absspielen.
    Theoretisch hört es sich ja gut an, nur habe ich keine Ahnung wie ich das in der Praxis machen soll. Hoffe hat jemand eine Idee.

    mfg

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

    Einmal editiert, zuletzt von chip (8. Oktober 2010 um 01:18)

  • Hab mich mit Musikplayern zwar noch nicht wirklich beschäftigt aber hilft dir die Bass.au3 nichts?
    Der Starplayer von Oscar verwendet die auch glaub ich.
    Und soweit ich weiß kann man da doch recht viel damit machen.

  • Habe das leider nichts gefunden in der Bass.au3 was funktionieren könnte. Der Starplayer von Oscar spielt wie ich gesehen habe auch nur mp3 ab.

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Hab einen Player gefunden der es kann, allerdings komme ich nicht so ganz dahinter wie es funktioniert:

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <EditConstants.au3>
    #include <StaticConstants.au3>
    #include <GUIConstantsEx.au3>
    ; ----------------------------------------------------------------------------
    ;
    ; AutoIt Version: 3.1.0
    ; Author: TheSaint <[email='thsaint@ihug.com.au'][/email]>
    ;
    ; Script Function: Play CD from a selected drive and display details, etc
    ; Template AutoIt script.
    ;
    ; ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; FUNCTIONS
    ; ChangeDrive(), CheckContent(), CheckSelectedCD(), CloseCDAndExitDll(), GetCDDetails(), GetCDid()
    ; GetCDPlayerIniDetails(), StopCDAndResetValues(), UpdateTrack()

    [/autoit] [autoit][/autoit] [autoit]

    #region --- GuiBuilder code Start ---
    ; Script generated by AutoBuilder 0.5 Prototype

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

    [/autoit] [autoit][/autoit] [autoit]

    Dim $Button_E, $Button_M, $Button_nx, $Button_P, $Button_pa, $Button_pr, $Button_R, $Button_S
    Dim $Button_x, $Group_1, $Group_2, $Group_3, $Input_ar, $Input_co, $Input_id, $Input_n, $Input_s
    Dim $Input_t1, $Input_t2, $Input_t3, $Input_t4, $Input_tn, $Input_tr, $Input_tt, $Input_yr
    Dim $Label_1, $Label_2, $Label_3, $Label_a, $Label_ar, $Label_au, $Label_b, $Label_c, $Label_co
    Dim $Label_d, $Label_tn, $Label_tt, $Label_yr, $Radio_1, $Radio_2, $Radio_3
    ;
    Dim $Cdplay, $Dialog
    Dim $art, $cdid, $cdini, $cdlen, $dcon, $dlbl, $dll, $drives, $drv, $frs, $i, $inifile, $len, $mgNum
    Dim $mins, $posi, $ready, $res, $result, $secs, $time, $tit, $tot, $trak, $trk, $use, $val, $width, $yr

    [/autoit] [autoit][/autoit] [autoit]

    $inifile = @ScriptDir & "\Settings.ini"
    $cdini = @WindowsDir & "\Cdplayer.ini"

    [/autoit] [autoit][/autoit] [autoit]

    $Dialog = $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE + $WS_CLIPSIBLINGS
    $width = 390

    [/autoit] [autoit][/autoit] [autoit]

    $Cdplay = GuiCreate("Simple CDPlayer v1.3 (updated Feb. 2009)", $width, 440, _
    (@DesktopWidth-$width)/2, (@DesktopHeight-440)/2 , $Dialog + $WS_MINIMIZEBOX)

    [/autoit] [autoit][/autoit] [autoit]

    $Label_1 = GuiCtrlCreateLabel("Current Track", 20, 22, 70, 20)
    $Input_n = GuiCtrlCreateInput("", 95, 20, 20, 20)
    $Label_2 = GuiCtrlCreateLabel("/", 122, 23, 10, 20)
    $Input_tr = GuiCtrlCreateInput("", 135, 20, 20, 20)
    $Label_3 = GuiCtrlCreateLabel("Status", 175, 22, 40, 20)
    $Input_s = GuiCtrlCreateInput("", 215, 20, 55, 20)
    ;
    $Button_P = GuiCtrlCreateButton("PLAY", 20, 60, 70, 70)
    GUICtrlSetFont($Button_P, 9, 600)
    $Button_pa = GuiCtrlCreateButton("Pause", 20, 140, 70, 30)
    $Button_S = GuiCtrlCreateButton("Stop", 20, 180, 70, 40)
    ;
    $Button_pr = GuiCtrlCreateButton("|<", 110, 60, 30, 30)
    $Button_nx = GuiCtrlCreateButton(">|", 150, 60, 30, 30)
    ;
    $Button_R = GuiCtrlCreateButton("Restart", 110, 100, 70, 30)
    $Button_M = GuiCtrlCreateButton("Mute", 110, 140, 70, 30)
    $Button_x = GuiCtrlCreateButton("EXIT", 110, 180, 70, 40)
    GUICtrlSetFont($Button_x, 9, 600)
    ;
    $Button_E = GuiCtrlCreateButton("Open", 200, 60, 70, 40)
    ;
    $Group_1 = GUICtrlCreateGroup("Time", 290, 15, 80, 205)
    $Label_a = GuiCtrlCreateLabel("Played", 300, 35, 35, 20)
    $Input_t1 = GuiCtrlCreateInput("", 300, 50, 60, 20)
    $Label_b = GuiCtrlCreateLabel("Track Start", 300, 80, 60, 20)
    $Input_t2 = GuiCtrlCreateInput("", 300, 95, 60, 20)
    $Label_c = GuiCtrlCreateLabel("Duration", 300, 125, 50, 20)
    $Input_t3 = GuiCtrlCreateInput("", 300, 140, 60, 20)
    $Label_d = GuiCtrlCreateLabel("Total CD", 300, 170, 60, 20)
    $Input_t4 = GuiCtrlCreateInput("", 300, 185, 60, 20)
    ;
    $Group_1 = GUICtrlCreateGroup("CDPlayer.ini - ID && Entries", 20, 235, 350, 160)
    $Input_id = GuiCtrlCreateInput("", 200, 232, 70, 20, $ES_READONLY + $ES_CENTER)
    ;;;;;
    $Label_ar = GuiCtrlCreateLabel("Artist", 40, 267, 38, 20, $SS_RIGHT)
    GUICtrlSetFont($Label_ar, 9, 600)
    $Input_ar = GuiCtrlCreateInput("", 85, 265, 265, 20)
    $Label_tt = GuiCtrlCreateLabel("Title", 40, 297, 38, 20, $SS_RIGHT)
    GUICtrlSetFont($Label_tt, 9, 600)
    $Input_tt = GuiCtrlCreateInput("", 85, 295, 265, 20)
    $Label_tn = GuiCtrlCreateLabel("Track", 40, 327, 38, 20, $SS_RIGHT)
    GUICtrlSetFont($Label_tn, 9, 600)
    $Input_tn = GuiCtrlCreateInput("", 85, 325, 265, 20)
    $Label_yr = GuiCtrlCreateLabel("Year", 40, 357, 38, 20, $SS_RIGHT)
    GUICtrlSetFont($Label_yr, 9, 600)
    $Input_yr = GuiCtrlCreateInput("", 85, 355, 40, 20)
    ;$Label_pw = GuiCtrlCreateLabel("Please Wait!", 142, 359, 80, 20, $ES_CENTER)
    ;GUICtrlSetFont($Label_pw, 8, 600)
    ;GUICtrlSetColor($Label_pw, 0xF00000)
    $Label_co = GuiCtrlCreateLabel("Type", 224, 357, 38, 20, $SS_RIGHT)
    GUICtrlSetFont($Label_co, 9, 600)
    $Input_co = GuiCtrlCreateInput("", 270, 355, 80, 20, $ES_CENTER)
    ;
    $Group_3 = GUICtrlCreateGroup("Drives", 200, 115, 70, 100)
    $drives = DriveGetDrive("CDROM")
    If $drives[0] > 0 Then
    $drv = StringUpper($drives[1])
    $Radio_1 = GuiCtrlCreateRadio($drv, 223, 135, 30, 20)
    IniWrite($inifile, "Drives", "1", $drv)
    $use = IniRead($inifile, "Drive", "use", "")
    If $use = "" Then
    $use = $drv
    IniWrite($inifile, "Drive", "use", $use)
    IniWrite($inifile, "Drive", "num", "1")
    EndIf
    EndIf
    If $drives[0] > 1 Then
    $drv = StringUpper($drives[2])
    $Radio_2 = GuiCtrlCreateRadio($drv, 223, 160, 30, 20)
    IniWrite($inifile, "Drives", "2", $drv)
    EndIf
    If $drives[0] > 2 Then
    $drv = StringUpper($drives[3])
    $Radio_3 = GuiCtrlCreateRadio($drv, 223, 185, 30, 20)
    IniWrite($inifile, "Drives", "3", $drv)
    EndIf
    ;
    $Label_au = GuiCtrlCreateLabel("© TheSaint (April 2006)", _
    $width / 2 - (140 / 2), 410, 140, 17, $SS_SUNKEN + $SS_CENTER + $SS_NOPREFIX)
    GUICtrlSetColor($Label_au, 0xffffff) ; White
    GUICtrlSetBkColor($Label_au, 0x000000) ; Black

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; SETTINGS
    GUICtrlSetState($Button_P, $GUI_DISABLE)
    GUICtrlSetState($Button_pa, $GUI_DISABLE)
    GUICtrlSetState($Button_S, $GUI_DISABLE)
    GUICtrlSetState($Button_pr, $GUI_DISABLE)
    GUICtrlSetState($Button_nx, $GUI_DISABLE)
    GUICtrlSetState($Button_R, $GUI_DISABLE)
    GUICtrlSetState($Button_M, $GUI_DISABLE)
    ;
    $drv = IniRead($inifile, "Drive", "num", "")
    If $drv = "1" Then
    GUICtrlSetState($Radio_1, $GUI_CHECKED)
    ElseIf $drv = "2" Then
    GUICtrlSetState($Radio_2, $GUI_CHECKED)
    ElseIf $drv = "3" Then
    GUICtrlSetState($Radio_3, $GUI_CHECKED)
    EndIf
    ;
    CheckSelectedCD()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    GuiSetState()
    While 1
    If GUICtrlRead($Input_s) = "playing" Then
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Position", "str", "", "int", 255, "long", 0)
    $time = $res[2]
    GUICtrlSetData($Input_t1, $time)
    EndIf
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    ExitLoop
    Case $msg = $Button_x
    If GUICtrlRead($Input_s) = "playing" Then
    $res = DllCall($dll, "int", "mciSendString", "str", "Stop CD wait", "str", "", "int", 255, "long", 0)
    EndIf
    GUIDelete($Cdplay)
    ExitLoop
    Case $msg = $Button_S
    ; STOP CD
    StopCDAndResetValues()
    Case $msg = $Button_R
    ; RESTART CD
    $trk = 1
    UpdateTrack()
    Case $msg = $Button_pr
    ; PREVIOUS TRACK
    If $trk > 1 Then
    $trk = $trk - 1
    UpdateTrack()
    EndIf
    Case $msg = $Button_pa
    ; PAUSE or RESUME PLAYING CD
    If GUICtrlRead($Button_pa) = "Pause" Then
    $res = DllCall($dll, "int", "mciSendString", "str", "Pause CD", "str", "", "int", 255, "long", 0)
    If @error <> 0 Then MsgBox(0, "DLL CALL - STOP CD RESULT", @error)
    GUICtrlSetData($Button_pa, "Resume")
    ElseIf GUICtrlRead($Button_pa) = "Resume" Then
    $res = DllCall($dll, "int", "mciSendString", "str", "Resume CD", "str", "", "int", 255, "long", 0)
    If @error <> 0 Then MsgBox(0, "DLL CALL - STOP CD RESULT", @error)
    GUICtrlSetData($Button_pa, "Pause")
    EndIf
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Mode", "str", "", "int", 255, "long", 0)
    GUICtrlSetData($Input_s, $res[2])
    Case $msg = $Button_P
    ; PLAY CD
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Position Track " & $trk, "str", "", "int", 255, "long", 0)
    $posi = $res[2]
    $res = DllCall($dll, "int", "mciSendString", "str", "Play CD From " & $posi, "str", "", "int", 255, "long", 0)
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Mode", "str", "", "int", 255, "long", 0)
    GUICtrlSetData($Input_s, $res[2])
    If GUICtrlRead($Button_pa) = "Resume" Then GUICtrlSetData($Button_pa, "Pause")
    GUICtrlSetState($Button_P, $GUI_DISABLE)
    GUICtrlSetState($Button_pa, $GUI_ENABLE)
    GUICtrlSetState($Button_S, $GUI_ENABLE)
    Case $msg = $Button_nx
    ; NEXT TRACK
    If $trk < $tot Then
    $trk = $trk + 1
    UpdateTrack()
    EndIf
    Case $msg = $Button_M
    ; MUTE SOUND
    If GUICtrlRead($Button_M) = "Mute" Then
    Send("{VOLUME_MUTE}") ; WIN XP only
    $res = DllCall($dll, "int", "mciSendString", "str", "Set CD Audio All Off", "str", "", "int", 255, "long", 0)
    GUICtrlSetData($Button_M, "Muted")
    ElseIf GUICtrlRead($Button_M) = "Muted" Then
    ;Send("{VOLUME_UP}")
    Send("{VOLUME_MUTE}") ; WIN XP only
    $res = DllCall($dll, "int", "mciSendString", "str", "Set CD Audio All On", "str", "", "int", 255, "long", 0)
    GUICtrlSetData($Button_M, "Mute")
    EndIf
    Case $msg = $Button_E
    ; EJECT or LOAD CD
    SplashTextOn("", @CRLF & @CRLF & "Please Wait!", 150, 100, -1, -1, 1)
    If GUICtrlRead($Input_s) = "stopped" Or GUICtrlRead($Input_s) = "" Then
    ; EJECT
    $res = DllCall($dll, "int", "mciSendString", "str", "Set CD Door Open wait", "str", "", "int", 255, "long", 0)
    GUICtrlSetData($Button_E, "Load")
    GUICtrlSetData($Input_n, "")
    GUICtrlSetData($Input_tr, "")
    GUICtrlSetData($Input_t1, "")
    GUICtrlSetData($Input_t2, "")
    GUICtrlSetData($Input_t3, "")
    GUICtrlSetData($Input_t4, "")
    GUICtrlSetData($Input_id, "")
    GUICtrlSetData($Input_ar, "")
    GUICtrlSetData($Input_tt, "")
    GUICtrlSetData($Input_tn, "")
    GUICtrlSetData($Input_yr, "")
    GUICtrlSetData($Input_co, "")
    GUICtrlSetState($Button_P, $GUI_DISABLE)
    GUICtrlSetState($Button_pa, $GUI_DISABLE)
    GUICtrlSetState($Button_S, $GUI_DISABLE)
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Mode", "str", "", "int", 255, "long", 0)
    GUICtrlSetData($Input_s, $res[2])
    ElseIf GUICtrlRead($Input_s) = "open" Then
    ; LOAD
    $res = DllCall($dll, "int", "mciSendString", "str", "Set CD Door Closed wait", "str", "", "int", 255, "long", 0)
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Media Present wait", "str", "", "int", 0, "long", 0)
    ;Sleep(2000)
    $ready = DriveStatus($use & "\")
    If $ready = "READY" Then
    GetCDDetails()
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Mode", "str", "", "int", 255, "long", 0)
    GUICtrlSetData($Input_s, $res[2])
    Else
    GUICtrlSetData($Input_s, "")
    EndIf
    GUICtrlSetData($Button_E, "Open")
    EndIf
    SplashOff()
    Case $msg = $Radio_3 And $drives[0] > 2
    ; USE DRIVE 3
    $use = IniRead($inifile, "Drives", "3", "")
    IniWrite($inifile, "Drive", "use", $use)
    IniWrite($inifile, "Drive", "num", "3")
    ChangeDrive()
    Case $msg = $Radio_2 And $drives[0] > 1
    ; USE DRIVE 2
    $use = IniRead($inifile, "Drives", "2", "")
    IniWrite($inifile, "Drive", "use", $use)
    IniWrite($inifile, "Drive", "num", "2")
    ChangeDrive()
    Case $msg = $Radio_1
    ; USE DRIVE 1
    $use = IniRead($inifile, "Drives", "1", "")
    IniWrite($inifile, "Drive", "use", $use)
    IniWrite($inifile, "Drive", "num", "1")
    ChangeDrive()
    Case Else
    ;;;
    EndSelect
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    CloseCDAndExitDll()

    [/autoit] [autoit][/autoit] [autoit]

    Exit
    #endregion --- GuiBuilder generated code End ---

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func ChangeDrive()
    StopCDAndResetValues()
    CloseCDAndExitDll()
    CheckSelectedCD()
    EndFunc ;=> ChangeDrive

    [/autoit] [autoit][/autoit] [autoit]

    Func CheckContent()
    $dlbl = DriveGetLabel($use)
    If $dlbl <> "Audio CD" Then
    If $tot > 1 Then
    $dcon = "Audio & Data"
    ElseIf $tot = 1 Then
    $dcon = "Data"
    EndIf
    Else
    $dcon = "Audio"
    EndIf
    GUICtrlSetData($Input_co, $dcon)
    EndFunc ;=> CheckContent

    [/autoit] [autoit][/autoit] [autoit]

    Func CheckSelectedCD()
    $dll = DllOpen("winmm.dll")
    If $dll <> 1 Then MsgBox(0, "DLL OPEN - RESULT", $dll)
    ;
    $res = DllCall($dll, "int", "mciSendString", "str", "Open CDAudio" & "!" & $use & " alias CD shareable wait", "str", "", "int", 0, "long", 0)
    If @error <> 0 Then MsgBox(0, "DLL CALL - OPEN CD RESULT", @error)
    ;
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Media Present wait", "str", "", "int", 0, "long", 0)
    ;
    ;$res = DllCall($dll, "int", "mciSendString", "str", "set cdaudio time format milliseconds", "str", "True", "int", 255, "long", 0)
    $res = DllCall($dll, "int", "mciSendString", "str", "Set CD Time Format tfmsf wait", "str", "", "int", 255, "long", 0)
    ;
    $ready = DriveStatus($use & "\")
    If $ready = "READY" Then
    SplashTextOn("", @CRLF & @CRLF & "Please Wait!", 150, 100, -1, -1, 1)
    ;
    GetCDDetails()
    ;
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Mode", "str", "", "int", 255, "long", 0)
    If @error <> 0 Then MsgBox(0, "DLL CALL - STATUS CD RESULT", @error)
    GUICtrlSetData($Input_s, $res[2])
    ;
    SplashOff()
    EndIf
    EndFunc ;=> CheckSelectedCD

    [/autoit] [autoit][/autoit] [autoit]

    Func CloseCDAndExitDll()
    $res = DllCall($dll, "int", "mciSendString", "str", "Close CD", "str", "", "int", 255, "long", 0)
    If @error <> 0 Then MsgBox(0, "DLL CALL - CLOSE CD RESULT", @error)
    ;
    DllClose($dll)
    EndFunc ;=> CloseCDAndExitDll

    [/autoit] [autoit][/autoit] [autoit]

    Func GetCDDetails()
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Media Present wait", "str", "", "int", 255, "long", 0)
    If @error <> 0 Then MsgBox(0, "DLL CALL - STATUS CD RESULT", @error)
    ;
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Number of Tracks", "str", "", "int", 255, "long", 0)
    $tot = $res[2]
    GUICtrlSetData($Input_tr, $tot)
    ;
    CheckContent()
    ;
    If $dcon <> "Data" Then
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Current Track", "str", "", "int", 255, "long", 0)
    $trk = $res[2]
    GUICtrlSetData($Input_n, $trk)
    ;
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Position Track " & $trk, "str", "", "int", 255, "long", 0)
    If @error <> 0 Then MsgBox(0, "DLL CALL - TRACK POS", @error)
    GUICtrlSetData($Input_t2, $res[2])
    ;
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Length Track " & $trk, "str", "", "int", 255, "long", 0)
    If @error <> 0 Then MsgBox(0, "DLL CALL - TRACK POS", @error)
    GUICtrlSetData($Input_t3, $res[2])
    ;
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Length", "str", "", "int", 255, "long", 0)
    If @error <> 0 Then MsgBox(0, "DLL CALL - TRACK POS", @error)
    GUICtrlSetData($Input_t4, $res[2])
    ;
    GUICtrlSetData($Input_t1, "00:02:00")
    ;
    GetCDid()
    ;
    GetCDPlayerIniDetails()
    ;
    GUICtrlSetState($Button_P, $GUI_ENABLE)
    GUICtrlSetState($Button_pr, $GUI_ENABLE)
    GUICtrlSetState($Button_nx, $GUI_ENABLE)
    GUICtrlSetState($Button_R, $GUI_ENABLE)
    GUICtrlSetState($Button_M, $GUI_ENABLE)
    EndIf
    ;
    EndFunc ;=> GetCDDetails

    [/autoit] [autoit][/autoit] [autoit]

    Func GetCDid()
    ; set CD time format Milliseconds wait
    $res = DllCall($dll, "int", "mciSendString", "str", "Set CD Time Format tfmsf wait", "str", "", "int", 255, "long", 0)
    $cdid = 0
    $mgNum = 0
    For $i = 1 To $tot
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Position Track " & String($i), "str", "", "int", 255, "long", 0)
    $len = String($res[2]); * 30
    $mins = StringLeft($len, 2)
    $secs = StringMid($len, 4, 2)
    $frs = StringRight($len, 2)
    $cdid = $cdid + (($mins * 65536) + ($secs * 256) + $frs)
    If $i = 1 And $tot = 2 Then $mgNum = $frs
    Next
    If $tot < 3 Then
    ;$res = DllCall($dll, "int", "mciSendString", "str", "set cdaudio time format milliseconds wait", "str", "", "int", 255, "long", 0)
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Length", "str", "", "int", 255, "long", 0)
    ;
    $len = String($res[2]); * 30
    $mins = StringLeft($len, 2)
    $secs = StringMid($len, 4, 2)
    $frs = StringRight($len, 2)
    ;
    $cdlen = (($mins * 60) + $secs) * 75 + $frs
    ;MsgBox(0, "Values", "Value 1 = " & ($cdlen / 60 / 75) & @CRLF & _
    ;"Value 2 = " & $mins + (($secs + $frs) / 60))
    If $mins + ($secs + $frs / 60) <> ($cdlen / 60 / 75) Then $cdlen = $cdlen + 1
    ;
    $cdid = $cdid + $mgNum + $cdlen
    EndIf
    $cdid = Hex(String($cdid), 8)
    While StringLeft($cdid, 1) = "0"
    $cdid = StringMid($cdid, 2)
    WEnd
    GUICtrlSetData($Input_id, $cdid)
    EndFunc ;=> GetCDid

    [/autoit] [autoit][/autoit] [autoit]

    Func GetCDPlayerIniDetails()
    If FileExists($cdini) Then
    $art = IniRead($cdini, $cdid, "artist", "")
    GUICtrlSetData($Input_ar, $art)
    $tit = IniRead($cdini, $cdid, "title", "")
    GUICtrlSetData($Input_tt, $tit)
    $trak = IniRead($cdini, $cdid, "0", "")
    GUICtrlSetData($Input_tn, $trak)
    $yr = IniRead($cdini, $cdid, "year", "")
    GUICtrlSetData($Input_yr, $yr)
    EndIf
    EndFunc ;=> GetCDPlayerIniDetails

    [/autoit] [autoit][/autoit] [autoit]

    Func StopCDAndResetValues()
    $res = DllCall($dll, "int", "mciSendString", "str", "Stop CD wait", "str", "", "int", 255, "long", 0)
    If @error <> 0 Then MsgBox(0, "DLL CALL - STOP CD RESULT", @error)
    GUICtrlSetData($Input_t1, "00:02:00")
    If GUICtrlRead($Button_pa) = "Resume" Then
    GUICtrlSetData($Button_pa, "Pause")
    ElseIf GUICtrlRead($Button_pa) = "Pause" And GUICtrlRead($Input_s) = "stopped" Then
    $trk = 1
    GetCDDetails()
    EndIf
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Mode", "str", "", "int", 255, "long", 0)
    GUICtrlSetData($Input_s, $res[2])
    GUICtrlSetState($Button_pa, $GUI_DISABLE)
    GUICtrlSetState($Button_S, $GUI_DISABLE)
    GUICtrlSetState($Button_P, $GUI_ENABLE)
    EndFunc ;=> StopCDAndResetValues

    [/autoit] [autoit][/autoit] [autoit]

    Func UpdateTrack()
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Position Track " & $trk, "str", "", "int", 255, "long", 0)
    $posi = $res[2]
    If GUICtrlRead($Input_s) = "playing" Then
    $res = DllCall($dll, "int", "mciSendString", "str", "Play CD From " & $posi, "str", "", "int", 255, "long", 0)
    EndIf
    GUICtrlSetData($Input_n, $trk)
    GUICtrlSetData($Input_t2, $posi)
    $res = DllCall($dll, "int", "mciSendString", "str", "Status CD Length Track " & $trk, "str", "", "int", 255, "long", 0)
    GUICtrlSetData($Input_t3, $res[2])
    ;
    $trak = IniRead($cdini, $cdid, $trk - 1, "")
    GUICtrlSetData($Input_tn, $trak)
    EndFunc ;=> UpdateTrack

    [/autoit]

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Also so richtig weiterhelfen kann ich Dir leider auch nicht, und Dein letztes Beispiel versteh ich auch kaum, wird ja mit .dll's gearbeitet...

    Aber hier gibts alle BASS-Dateien zu laden und unter anderem sind da auch Funktionen für einen CD-Player dabei (nach dem Entpacken im Ordner "BASS_CD")... Das hab ich zwar noch nie benutzt - deswegen kann ich da keine wirkliche Hilfe geben - aber erscheint mir plausibel, dass das fürs CD-Abspielen gedacht ist :)

    Spoiler anzeigen

    BassCD
    Allows for digital streaming and ripping of audio CDs along with analog playback support.

    Andy :)

  • Problem ist, dass die Bass.au3 scheinbar nicht Win 7 kompatiebel ist. Zumindestens die Beispiele in der Bass_CD funktionieren nicht und wird schon direkt bei _BASS_Startup() abgebrochen mit ledichlich einem @error = -1

    Edit:

    So habs nun gelöst und es geschaft direkt eine Track anzusprechen.

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    OnAutoItExitRegister("MyTestFunc")

    [/autoit] [autoit][/autoit] [autoit]

    $track = 5
    $dll = DllOpen("winmm.dll")
    $res = DllCall($dll, "int", "mciSendString", "str", "open cdaudio", "str", "", "int", 255, "long", 0)
    $res = DllCall($dll, "int", "mciSendString", "str", "status cdaudio position track " & $Track, "str", "", "int", 255, "long", 0)
    $res = DllCall($dll, "int", "mciSendString", "str", "play cdaudio from " & $res[2], "str", "", "int", 255, "long", 0)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func MyTestFunc()
    $res = DllCall($dll, "int", "mciSendString", "str", "stop cdaudio", "str", "", "int", 255, "long", 0)
    $res = DllCall($dll, "int", "mciSendString", "str", "close cdaudio", "str", "", "int", 255, "long", 0)
    DllClose($dll)
    EndFunc ;==>MyTestFunc

    [/autoit]

    Hier noch die mögliche Paramter die mciSendString genutzt werden können: http://msdn.microsoft.com/en-us/library/ms712587

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

    6 Mal editiert, zuletzt von chip (8. Oktober 2010 um 01:26)