Tagged: hourstamp
- This topic has 15 replies, 2 voices, and was last updated 9 years, 2 months ago by Zucchi.
-
AuthorPosts
-
6 September 2015 at 23 h 53 min #2855Philippe OllivierKeymaster
Salut Michel,
Sleep est une fonction qui met la macro en sommeil pendant le temps indiqué en ms.Si tu mets :
If {$current_full_tracks_count$ == 2}
TrackPanMono trk1 = -0.8
TrackPanMono trk2 = 0.8
Sleep 10000
TrackPanMono trk1 = 0.8
TrackPanMono trk2 = -0.8
Sleep 10000
EndIfLes Sleeps vont arrêter la macro pendant 10 secondes à chaque fois.
Donc, ça bloque la boucle globale DoRepeat / While pendant le temps de 2 Sleeps 10000…Le Sleep ne semble donc pas approprié dans le cas présent.
Dans la macro ci-dessous, j’utilise l’expression hourstamp() qui nous donne le nombre de secondes depuis minuit… Autrement dit, ça nous donne l’heure dans un format en secondes, ce qui permet de faire calcul simple pour mesurer le temps écoulé.
La variable $temps_entre_changement_de_signe$ est ici fixée à 15 soit 15 secondes entre chaque inversion des panoramiques, tu peux changer la valeur de cette variable.
Pour changer de coté au panoramique, je multiplie sa position par la variable $signe$ qui est soit à 1, soit à -1.
Attention, cette macro fonctionne exclusivement avec une version égale ou postérieure à Logelloop 4.4.
//Début de la macro
Redeclare boolean $user_action_received$ = false
DeclareOnce int $ancienne_heure$ = 0
DeclareOnce boolean $panners_state$ = false
DeclareOnce int $signe$ = 1
Declare int $temps_entre_changement_de_signe$ = 15
Set $ancienne_heure$ = {hourstamp()}BeginSignalCatchBlock
DoRepeat
If {$current_full_tracks_count$ == 1}
TrackPanMono trk1 = 0.
EndIf
If {$current_full_tracks_count$ == 2}
TrackPanMono trk1 = {-0.4 * $signe$}
TrackPanMono trk2 = {0.4 * $signe$}
EndIf
If {$current_full_tracks_count$ == 3}
TrackPanMono trk1 = {-0.4 * $signe$}
TrackPanMono trk2 = {0.4 * $signe$}
TrackPanMono trk3 = 0.
EndIf
If {$current_full_tracks_count$ == 4}
TrackPanMono trk1 = {-0.6 * $signe$}
TrackPanMono trk2 = {0.6 * $signe$}
TrackPanMono trk3 = {-0.4 * $signe$}
TrackPanMono trk4 = {0.4 * $signe$}
EndIf
If {$current_full_tracks_count$ == 5}
TrackPanMono trk1 = {-0.6 * $signe$}
TrackPanMono trk2 = {0.6 * $signe$}
TrackPanMono trk3 = {-0.4 * $signe$}
TrackPanMono trk4 = {0.4 * $signe$}
TrackPanMono trk5 = 0.
EndIf
If {$current_full_tracks_count$ == 6}
TrackPanMono trk1 = {-0.8 * $signe$}
TrackPanMono trk2 = {0.8 * $signe$}
TrackPanMono trk3 = {-0.6 * $signe$}
TrackPanMono trk4 = {0.6 * $signe$}
TrackPanMono trk5 = {-0.4 * $signe$}
TrackPanMono trk6 = {0.4 * $signe$}
EndIf
If {$current_full_tracks_count$ == 7}
TrackPanMono trk1 = {-0.8 * $signe$}
TrackPanMono trk2 = {0.8 * $signe$}
TrackPanMono trk3 = {-0.6 * $signe$}
TrackPanMono trk4 = {0.6 * $signe$}
TrackPanMono trk5 = {-0.4 * $signe$}
TrackPanMono trk6 = {0.4 * $signe$}
TrackPanMono trk7 = 0.
EndIf
If {$current_full_tracks_count$ == 8}
TrackPanMono trk1 = {-0.8 * $signe$}
TrackPanMono trk2 = {0.8 * $signe$}
TrackPanMono trk3 = {-0.6 * $signe$}
TrackPanMono trk4 = {0.6 * $signe$}
TrackPanMono trk5 = {-0.4 * $signe$}
TrackPanMono trk6 = {0.4 * $signe$}
TrackPanMono trk7 = {-1 * $signe$}
TrackPanMono trk8 = {1 * $signe$}
EndIf
If {$current_full_tracks_count$ == 9}
TrackPanMono trk1 = {-0.8 * $signe$}
TrackPanMono trk2 = {0.8 * $signe$}
TrackPanMono trk3 = {-0.6 * $signe$}
TrackPanMono trk4 = {0.6 * $signe$}
TrackPanMono trk5 = {-0.4 * $signe$}
TrackPanMono trk6 = {0.4 * $signe$}
TrackPanMono trk7 = {-1 * $signe$}
TrackPanMono trk8 = {1 * $signe$}
TrackPanMono trk9 = 0.
EndIf
If {$current_full_tracks_count$ == 10}
TrackPanMono trk1 = {-0.8 * $signe$}
TrackPanMono trk2 = {0.8 * $signe$}
TrackPanMono trk3 = {-0.6 * $signe$}
TrackPanMono trk4 = {0.6 * $signe$}
TrackPanMono trk5 = {-0.4 * $signe$}
TrackPanMono trk6 = {0.4 * $signe$}
TrackPanMono trk7 = {-1 * $signe$}
TrackPanMono trk8 = {1 * $signe$}
TrackPanMono trk9 = {-0.2 * $signe$}
TrackPanMono trk10 = {0.2 * $signe$}
EndIf//Affiche le temps restant avant inversion des panoramiques
Message {“L’inversion des positions de panner aura lieu dans : ” + ($temps_entre_changement_de_signe$ -(hourstamp() – $ancienne_heure$))}//Partie concernant l’inversion de position toutes les n secondes
If {$ancienne_heure$ == (hourstamp() – $temps_entre_changement_de_signe$)}
//Message {$ancienne_heure$ – hourstamp()}
Message “pouet”
Set $panners_state$ = {!$panners_state$}
Set $ancienne_heure$ = {hourstamp()}
EndIfIf {$panners_state$ == true}
Set $signe$ = 1
Else
Set $signe$ = -1
EndIfSleep 100
While {!$user_action_received$}EndSignalCatchBlock OnSignalCatched Do Set $user_action_received$ = true
TrackPanMono trk_all = 0
//Fin de la macro
-
AuthorPosts
- You must be logged in to reply to this topic.