Skip to content

Commit

Permalink
Small improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamueleGiraudo committed Oct 17, 2020
1 parent b44b6dd commit 2613787
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
23 changes: 23 additions & 0 deletions Examples/CompleteHir3.bmb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{Sets some context information.}
set_scale 2 1 4 1 4
set_root 60
set_tempo 128
set_sounds 108 107

{Defines 3 2-multi-patterns.}
multi_pattern mpat_1 1 1 0 0 2 2 1 1 ; -5 * * * 0 * * *
multi_pattern mpat_2 -1 * 0 * 1 * ; * 0 * * 0 *
multi_pattern mpat_3 0 * ; * 0

{Defines 4 colored 2-multi-patterns from the previous 2-multi-patterns.}
colorize cpat_1 mpat_1 c1 c2 c1
colorize cpat_2 mpat_1 c1 c1 c2
colorize cpat_3 mpat_2 c1 c1 c2
colorize cpat_4 mpat_3 c1 c1

{Creates a new 2-multi-pattern mpat_4 obtained by using the partial random generation
algorithm with k := 32, c1 as initial color, and cpat_1, cpat_2, cpat_3, and cpat_4 as
rules.}
generate mpat_4 partial 32 c1 cpat_1 cpat_2 cpat_3 cpat_4
play mpat_4

2 changes: 1 addition & 1 deletion Examples/Sounds.bmb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ By default, the MIDI sound of all voices is the "Acoustic Grand Piano" of code 0.}
{By default, the MIDI sound of all voices is the "Acoustic Grand Piano" of code 0.}
multi_pattern p1 1 -1 0 * * 7 ; 3 * 2 * 0 0
play p1

Expand Down
2 changes: 2 additions & 0 deletions Sources/Program.ml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ let execute_instruction instr st =
|MultiPattern (name, mpat) -> begin
if not (is_name name) then
raise (ExecutionError "Bad multi-pattern name.");
if not (MultiPattern.is_multi_pattern mpat) then
raise (ExecutionError "Bad multi-pattern.");
let st' = add_multi_pattern st name mpat in
Printf.printf "%s Multi-pattern added." output_mark;
print_newline ();
Expand Down

0 comments on commit 2613787

Please sign in to comment.