Page 1 sur 1
[R] Problème text & musique AdlibRegister
Posté : sam. 19 mai 2012 19:03
par Ghost911
bonjour alors voila j'ai un petit problème avec AdlibRegister j’arrive pas à faire marcher 2 fonctions en même temps si je mais musique plus le texte sa se bloque et arête de défiler j'aimerais faire fonctionner les 2 en même temps en fond de tache si possible : D ( AdlibRegister("PlayIntro",0) + AdlibRegister("_MoveLabel",25) )
Re: [..] Problème text & musique AdlibRegister
Posté : sam. 19 mai 2012 19:19
par mikell
AdlibRegister("PlayIntro",0)
Tu lances ta fonction toutes les 0 millisecondes ?

Re: [..] Problème text & musique AdlibRegister
Posté : sam. 19 mai 2012 19:24
par Ghost911
non si tu regardes la fonction ya une condition, avec un timer seul moyen que j'ai trouvé pour répéter le morceau en boucle sinon ya un décalage a l'initialisation entre la gui qui démarre & le son .....
Re: [..] Problème text & musique AdlibRegister
Posté : sam. 19 mai 2012 20:15
par mikell
Bah ça marche ^^
► Afficher le texte
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
global $SoundFlag=1,$SoundOpen=0, $iX
Global $MyTextLabel = "Welcome to ????????? By ghost911"
$Form1 = GUICreate("Form1", 275, 67, 606, 540)
$Label1 = GUICtrlCreateLabel("Label1", -100, 24, 50, 17)
Global $hleLabelHandle = GUICtrlGetHandle($Label1)
GUISetState(@SW_SHOW)
SoundPlay ("Sound\Intro.mp3",0)
Sleep(100)
AdlibRegister("_MoveLabel",25)
AdlibRegister("son", 58000)
GUISetOnEvent($GUI_EVENT_CLOSE, "Guiclosed")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "GuiMinimize")
Func son()
SoundPlay ("Sound\Intro.mp3",0)
EndFunc
While 1
Sleep (5)
WEnd
Func GuiMinimize ()
GUISetState ($GUI_EVENT_MINIMIZE,$Form1)
EndFunc
Func Guiclosed ()
For $i_trans = 255 To 0 Step -5
WinSetTrans ($Form1, "", $i_trans)
sleep (40)
Next
Exit
EndFunc
Func _MoveLabel()
$iX += 1
WinMove($hleLabelHandle,"", $iX, 24)
;GUICtrlSetData($Label1,$MyTextLabel)
If $iX > 280 Then $iX = -50
EndFunc
Re: [..] Problème text & musique AdlibRegister
Posté : dim. 20 mai 2012 09:28
par Ghost911
Merci beaucoup enfaîte le problème viens d'ou ?
Re: [..] Problème text & musique AdlibRegister
Posté : dim. 20 mai 2012 09:35
par Ghost911
une dernière question comment je pourrai faire avec le son pour le coupé a tout moment en temps réel avec une checkbox & pouvoir le remette en re-cliquant dessus ? ( sans coupé le texte qui défile )
Re: [..] Problème text & musique AdlibRegister
Posté : dim. 20 mai 2012 09:47
par Arkenix
Bonjour,
Je pense que quelque chose du genre fonctionnerais :
Code : Tout sélectionner
If _SoundStatus($mp3) = "stopped" And GUICtrlRead($Macheckbox) = 4 Then
_SoundPlay($mp3)
ElseIf _SoundStatus($mp3) = "playing" And GUICtrlRead($Macheckbox) = 1 Then
_SoundStop($mp3)
EndIf
EDIT : ne pas oublier le
Re: [..] Problème text & musique AdlibRegister
Posté : dim. 20 mai 2012 09:49
par mikell
Comme ton mp3 fait 58 secondes, faut utiliser AdlibRegister("PlayIntro", 58000) pour le faire tourner en boucle
Le son et le défilement du texte sont indépendants, tu peux gérer le son avec les fonctions _SoundPause , _SoundResume , etc
Re: [..] Problème text & musique AdlibRegister
Posté : dim. 20 mai 2012 11:22
par Ghost911
ok merci nickel mais le son démarre directement avec la gui ou une fois que la gui démarre faut patienter 58 seconde pour l'entendre ? ?
Re: [..] Problème text & musique AdlibRegister
Posté : dim. 20 mai 2012 11:44
par mikell
Hum si tu avais fait des tests avec le code que j'ai mis tu aurais eu ta réponse en 2 secondes
Re: [R] Problème text & musique AdlibRegister
Posté : dim. 20 mai 2012 15:09
par Ghost911
Merci pour votre aide précieuse

Re: [...] Problème text & musique AdlibRegister
Posté : lun. 21 mai 2012 15:32
par Ghost911
désolé de vous déranger à nouveau j'ai remis un nouveau script avec un problème j’arrive pas à faire tourner le son en boucle sans blocage de tout le script je comprends pas ... une petite idée svp ?

Re: [...] Problème text & musique AdlibRegister
Posté : mar. 22 mai 2012 14:05
par mikell
► Afficher le texte
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ListViewConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <Sound.au3>
Opt("GUIOnEventMode", 1)
Global $Titre = "MyAPP v 1.0 by ghost911",$SoundFlag=1,$SoundIntro="Sound\Intro.mp3"
Global $MyTextLabel = $Titre
Global $iX
$Form1_1 = GUICreate($Titre, 424, 512, -1,-1)
GUISetBkColor(0xFFFFFF)
$Tab1 = GUICtrlCreateTab(0, 0, 425, 465)
$TabSheet1 = GUICtrlCreateTabItem("Security :")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Sound = GUICtrlCreateCheckbox("Sound", 8, 432, 97, 17)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
$Label1 = GUICtrlCreateLabel("", -40, 469, 600, 20)
Global $hleLabelHandle = GUICtrlGetHandle($Label1)
GUISetState(@SW_SHOW)
CheckSoundIsActive()
AdlibRegister("_MoveLabel",25)
GUICtrlSetOnEvent($Sound,"CheckBoxIntro")
GUISetOnEvent($GUI_EVENT_CLOSE, "Guiclosed")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "GuiMinimize")
While 1
CheckSoundIsActive()
Sleep (10)
WEnd
;=======================================
Func _MoveLabel()
$iX += 1
WinMove($hleLabelHandle,-100, 450 - $iX / 2, 469)
GUICtrlSetData($Label1,$MyTextLabel)
If $iX > 2000 Then $iX = 0
EndFunc
Func PlayingSoundIntro()
_SoundPlay($SoundIntro,0)
EndFunc
Func CheckBoxIntro()
If _SoundStatus($SoundIntro) = "stopped" And GUICtrlRead($Sound) = 1 Then
_SoundPlay($SoundIntro,0)
AdlibRegister ("PlayingSoundIntro",58000)
IniWrite ( "Config.bin", "Sound", "Play",GUICtrlRead ($Sound))
$SoundFlag=1
ElseIf _SoundStatus($SoundIntro) = "playing" And GUICtrlRead($Sound) = 4 Then
AdlibUnRegister ("PlayingSoundIntro")
_SoundStop($SoundIntro)
IniWrite ( "Config.bin", "Sound", "Play",GUICtrlRead ($Sound))
$SoundFlag=0
EndIf
EndFunc
Func CheckSoundIsActive()
If IniRead("Config.bin", "Sound", "Play", "NotFound") = "1" Then
GUICtrlSetState($Sound, $GUI_CHECKED)
$SoundFlag=1
CheckBoxIntro ()
Else
$SoundFlag=0
EndIf
EndFunc
Func GuiMinimize ()
GUISetState ($GUI_EVENT_MINIMIZE,$Form1_1)
EndFunc
Func Guiclosed ()
For $i_trans = 255 To 0 Step -5
WinSetTrans ($Form1_1, "", $i_trans)
sleep (40)
Next
Exit
EndFunc
Mais sérieux, faudrait faire un effort sur l'organisation du script : les includes en haut, puis les déclarations de variables, puis la gui, puis les accessoires, puis la boucle principale, et les fonctions en bas... ça serait plus lisible
Re: [R] Problème text & musique AdlibRegister
Posté : mar. 22 mai 2012 18:41
par Ghost911
merci mikell
