Connexion rapide:  

Forum: General Discussion

Sujet Problem with Action Script (param_contains & get_beat_num)

Ce topic est ancien et peut contenir des informations obselètes ou incorrectes.

Hello guys,

I'm trying to design a BeatCounter for Waltz Rythm, that works fine so far. But I have trouble with the action script. We are saving the dance type in the genre tag of the mp3 file. Due to that we have Slow Waltz and Viennese Waltz I have two differen genre tags. Below I have the beat counter for the skin that works for genre tag 'Waltz'

<group name="beat_counter_left_big" x="+200" y="+20" visibility="deck 1 leftdeck">
<group name="phrase" x="+0" y="+0">
<deck deck="left">
<visual source="param_equal '`deck 1 get_genre`' 'Waltz' ? get_beat_num 6 & param_add 0.166 : get_beat_num 8 & param_add 0.1248" type="circle">
<pos x="+0" y="+0"/>
<size width="40" height="40"/>
<off shape="circle" color="#0F0F10"/>
<on shape="circle" color="#00A0E4"/>
</visual>
<visual>
<pos x="+5" y="+5"/>
<size width="30" height="30"/>
<off shape="circle" color="#111111"/>
</visual>
<textzone>
<pos x="+0" y="+0"/>
<size width="40" height="40"/>
<text fontsize="15" color="#FEFEFE" align="center" weight="bold" action="param_equal '`deck 1 get_genre`' 'Waltz' ? get_beat_num 6 & param_multiply 6 & param_add 1 : get_beat_num 8 & param_multiply 8 & param_add 1"/>
</textzone>
</deck>
</group>
</group>

But because we have two genre tags for waltz ('Slow Waltz' & 'Viennese Waltz'), I'm trying to use param_contains, but then the get_beat_num 6 or get_beat_num 8 doesn't work anymore, whereas the get_beat_num without additional parameters still works. I'm a bit confused about that, or do I have something wrong in my script?

<group name="beat_counter_left_big" x="+200" y="+20" visibility="deck 1 leftdeck">
<group name="phrase" x="+0" y="+0">
<deck deck="left">
<visual source="deck 1 get_genre & param_contains 'Waltz' ? get_beat_num 6 & param_add 0.166 : get_beat_num 8 & param_add 0.1248" type="circle">
<pos x="+0" y="+0"/>
<size width="40" height="40"/>
<off shape="circle" color="#0F0F10"/>
<on shape="circle" color="#00A0E4"/>
</visual>
<visual>
<pos x="+5" y="+5"/>
<size width="30" height="30"/>
<off shape="circle" color="#111111"/>
</visual>
<textzone>
<pos x="+0" y="+0"/>
<size width="40" height="40"/>
<text fontsize="15" color="#FEFEFE" align="center" weight="bold" action="deck 1 get_genre & param_contains 'Waltz' ? get_beat_num 6 & param_multiply 6 & param_add 1 : get_beat_num 8 & param_multiply 8 & param_add 1"/>
</textzone>
</deck>
</group>
</group>

Thanks in advance for your kind help.

With sincere regards,

Tobias
 

Posté Tue 03 Nov 20 @ 1:06 pm
NicotuxHome userMember since 2014
not clear what does not work exactly...

maybe try to use
- "get_beat_bar" or "get_beatpos" (which is not signature dependant) instead of "get_beat_num"
- "get_loaded_song genre" instead of (obsoleted) "get_genre"

deck 1 get_loaded_song genre & param_contains 'Waltz' ? ...

source= "deck 1 get_loaded_song genre & param_contains 'Waltz' ? get_beat_bar 6 & param_add 0.1666 : get_beat_bar 8 & param_add 0.1248"
action="deck 1 get_loaded_song genre & param_contains 'Waltz ? get_beat_bar 6 & param_multiply 6 & param_add 1 : get_beat_bar 8 & param_multiply 8 & param_add 1"

or simpler: (thanks locodog for the use of param_mod ;) using get_beatpos

source= "deck 1 get_loaded_song genre & param_contains 'Waltz' ? get_beatpos & param_add 0.1666 & param_cast trunc : get_beatpos & param_add 0.1248 & param_cast trunc"
action="deck 1 get_loaded_song genre & param_contains 'Waltz' ? get_beatpos & param_mod 6 & param_cast int & param_add 1 : get_beatpos & param_mod 8 & param_cast int & param_add 1 "


more generic : you can set a var to specify current time signature, no need of specific deck :

map ONSONGLOAD : get_loaded_song genre & param_contains 'Waltz' ? set num_beats 6 : set num_beats 8

visual source: "param_mod 'get_var num_beats' 'get_beatpos' & param_add 'get_var num_beats & param_1_x' & param_cast frac"
text action: "param_mod 'get_var num_beats' 'get_beatpos' & param_cast int_trunc & param_add 1"

can set to 2 3 4 6 7 8 16 or anything else depending on other genres
 

Posté Tue 03 Nov 20 @ 4:31 pm


(Les anciens sujets et forums sont automatiquement fermés)