Package wellen
Class Pattern
java.lang.Object
wellen.Loop
wellen.Pattern
- All Implemented Interfaces:
Loopable
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
event
(int beat, int event_at) querry whether an event occured.int
int
get_loop()
int
get_loop_count
(int absolut_position) returns the current loop where 0 is the first loop.int
int
get_relative_position
(int absolut_position) returns the relative postion in repsect to in- and out pointstatic void
static void
static void
println()
static void
static void
run_test()
void
set_in_point
(int in_point) set in point for pattern.void
set_length
(int length) length defines the number of steps before beat is wrapped.void
set_loop
(int pLoop) set the number of loops.void
set_out_point
(int out_point) set out point for pattern.Methods inherited from class wellen.Loop
after, after, before, before, event, get_length, get_offset, set_offset
-
Constructor Details
-
Pattern
public Pattern() -
Pattern
public Pattern(int in_point, int out_point, int loop)
-
-
Method Details
-
print
-
println
public static void println() -
println
-
run_test
public static void run_test() -
set_length
public void set_length(int length) length defines the number of steps before beat is wrapped.e.g an interval of 3 would generate a pattern of 0, 1, 2, 0, 1, 2, 0, 1, …
setting interval length affects the out point. e.g an interval of 3 and an in point of N would yield an out point of N + ( 3 - 1 ) and would generate a pattern of 0, 1, 2, 0, 1, 2, 0, 1, …
- Overrides:
set_length
in classLoop
- Parameters:
length
- number of steps before the beat is wrapped
-
get_loop
public int get_loop() -
set_loop
public void set_loop(int pLoop) set the number of loops. while the length of a single cycle is set byset_length(int)
, the number of cycles or repetitions is defined byset_loop(int)
. if number of loops is set toWellen.LOOP_INFINITE
the loop is repearted infinitely. if set toWellen.NO_LOOP
only one cycle is processed.- Parameters:
pLoop
- number of loops
-
get_in_point
public int get_in_point()- Specified by:
get_in_point
in interfaceLoopable
-
set_in_point
public void set_in_point(int in_point) set in point for pattern. if out point is equal or smaller than in point length is set to 1 and out point accordingly.- Parameters:
in_point
- set in point for pattern
-
get_out_point
public int get_out_point()- Specified by:
get_out_point
in interfaceLoopable
-
set_out_point
public void set_out_point(int out_point) set out point for pattern. this method also affects the length of the pattern.- Parameters:
out_point
- out point for pattern
-
event
public boolean event(int beat, int event_at) querry whether an event occured. the first value is the absolute beat ( or beat ) to evalute, the second value specifies the position in to query. e.g if the pattern is of length 3 (P(3)
, has an in point of 0 and loops infinitely, it will generate the following values:TICK : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 P(3) : 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1
if event is now for example tested againt 0
E(0)
it will either return true+
or false-
:TICK : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 P(3) : 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 E(0) : + - - + - - + - - + - - + - - + -
e.g an increasing value will produce an event every 3 beats:
Pattern p = new Pattern(); p.set_length(3); if (p.event(mTick, 0)) { println("event"); }
-
get_relative_position
public int get_relative_position(int absolut_position) returns the relative postion in repsect to in- and out point- Parameters:
absolut_position
- current absolut position ( i.e beat )- Returns:
- returns the relative postion. value may be negative.
-
get_loop_count
public int get_loop_count(int absolut_position) returns the current loop where 0 is the first loop. this method always returnsWellen.NO_LOOP_COUNT
if one of the following criteria is met:- no out point is specified ( i.e
set_out_point(NO_OUTPOINT)
) - loop is set to
set_loop(NO_LOOP)
- a number of loops is specified but the position is before the in point
- Overrides:
get_loop_count
in classLoop
- Parameters:
absolut_position
- current absolut position ( i.e beat )- Returns:
- returns the current loop. value may be negative.
- no out point is specified ( i.e
-
main
-