|
You last visited: Today at 20:33
Advertisement
titellänge
Discussion on titellänge within the AutoIt forum part of the Coders Den category.
09/06/2012, 17:57
|
#1
|
elite*gold: 0
Join Date: Apr 2012
Posts: 1,214
Received Thanks: 153
|
titellänge
spiele über soundplay verschiedene .mp3s ab, damit der script sich nicht vor beendigung des abspielens beendet oder den nächsten titel startet, verwende ich ein sleep, da ich allerdings nicht für jeden titel ein spezielles sleep mit der spiellänge des titels machen möchte (zu aufwändig) suche ich eine möglichkeit die spiellänge einer .mp3 auszulesen...google hat noch nicht wirklich geholfen...
jemand hier eine idee?
|
|
|
09/06/2012, 18:01
|
#2
|
elite*gold: 0
Join Date: Aug 2010
Posts: 880
Received Thanks: 113
|
Guck dir mal an. Außerdem kansnt du ja bei _soundplay/soundplay das Parameter setzen
PHP Code:
SoundPlay ( "filename" [, wait] )
wait [optional] This flag determines if the script should wait for the sound to finish before continuing: 1 = wait until sound has finished 0 = continue script while sound is playing (default)
MfG Ludder231
|
|
|
09/06/2012, 18:04
|
#3
|
elite*gold: 0
Join Date: Apr 2012
Posts: 1,214
Received Thanks: 153
|
Quote:
Originally Posted by Ludder231
Guck dir mal an. Außerdem kansnt du ja bei _soundplay/soundplay das Parameter setzen
PHP Code:
SoundPlay ( "filename" [, wait] )
wait [optional] This flag determines if the script should wait for the sound to finish before continuing: 1 = wait until sound has finished 0 = continue script while sound is playing (default)
MfG Ludder231
|
okay, danke, werd ich mir anschauen
|
|
|
09/06/2012, 18:13
|
#4
|
elite*gold: 192
Join Date: May 2009
Posts: 2,227
Received Thanks: 3,262
|
Relativ einfach, wenn man weiß, wie man mit der AutoIT Hilfe umzugehen hat
Code:
#RequireAdmin
#include <Sound.au3>
Local $hFile = "Song.mp3"
_SoundOpen ($hFile)
if not @error Then
Local $hFileLenght = _SoundLength($hFile,1)
if not @error Then
_SoundPlay ($hFile, 1)
EndIf
EndIf
|
|
|
09/06/2012, 18:16
|
#5
|
elite*gold: 0
Join Date: Aug 2010
Posts: 880
Received Thanks: 113
|
Quote:
Originally Posted by Logtetsch
Relativ einfach, wenn man weiß, wie man mit der AutoIT Hilfe umzugehen hat
Code:
#RequireAdmin
#include <Sound.au3>
Local $hFile = "Song.mp3"
_SoundOpen ($hFile)
if not @error Then
Local $hFileLenght = _SoundLength($hFile,1)
if not @error Then
_SoundPlay ($hFile, 1)
EndIf
EndIf
|
Ja, so hast du ihm aber alles vorgesagt. Ich hab ihm nur gesagt welchen Befehl man benutzt. Da ist doch der Lerneffekt viel höher.
|
|
|
09/06/2012, 18:30
|
#6
|
elite*gold: 192
Join Date: May 2009
Posts: 2,227
Received Thanks: 3,262
|
Mir ist gerade langweilig, deshalb habe ich sogar einen kleinen Audioplayer gescriptet.
Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <Sound.au3>
Global $txt_NoTitel = "???"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Audioplayer", 163, 78, 192, 114)
$Progress1 = GUICtrlCreateProgress(5, 5, 150, 16)
$btn_OpenFile = GUICtrlCreateButton("open", 5, 25, 60, 25)
$btn_HandleFile = GUICtrlCreateButton("play/ break", 95, 25, 60, 25)
$lbl_Title = GUICtrlCreateLabel ($txt_NoTitel, 5, 58, 50, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $hFile, $length, $FileName, $io = 0
While Sleep (10)
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $btn_OpenFile
Local $path = FileOpenDialog ("Select mp3", @ScriptDir, "Audio (*.mp3; *.wav;)", 1+4)
if @error Then
GUICtrlSetData ($lbl_Title, $txt_NoTitel)
Else
$hFile = _SoundOpen ($path)
if not @error Then
Local $sSplit = StringSplit ($path, "\")
if IsArray ($sSplit) Then
Local $sSize = UBound ($sSplit) -1
if $sSize > 0 Then
GUICtrlSetData ($lbl_Title, $sSplit[$sSize])
EndIf
EndIf
Else
$hFile = 0
MsgBox (46,"Error","Cannot open file!")
GUICtrlSetData ($lbl_Title, $txt_NoTitel)
EndIf
EndIf
Case $btn_HandleFile
if $hFile <> "" Then
if $io = 0 Then
_LPlaySound($hFile)
$io = 1
Else
_LPauseSound()
$io = 0
EndIf
Else
MsgBox (64,"Info","You have to select a file!")
EndIf
EndSwitch
if $hFile <> 0 or $hFile <> "" Then
Local $hLenght = _SoundLength ($hFile, 2)
Local $hPosition = _SoundPos ($hFile, 2)
if not @error Then
Local $SoundLenght = $hLenght / 1000
Local $SoundPosition = $hPosition / 1000
Local $secDiff = $SoundLenght / $SoundPosition
Local $procDiff = 100 / $secDiff
GUICtrlSetData ($Progress1, $procDiff)
EndIf
EndIf
WEnd
Func _LPlaySound($file)
_SoundPlay ($file, 0)
EndFunc
Func _LPauseSound()
_SoundPause($hFile)
EndFunc
Wollte eigentlich die Progressbar zu Ende scripten, aber leider muss ich meine Termine einhalten. Werde es später editieren
€: Paar kleine Textänderungen. Zudem funktioniert nun die Progressbar und habe einen Label hinzugefügt, der den Soundtitel anzeigt!
|
|
|
All times are GMT +2. The time now is 20:33.
|
|