Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new features #27

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/piano_roll_scripting/flpianoroll/__note.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,33 @@ def pitchofs(self) -> int:
def pitchofs(self, new_value: int) -> None:
pass

@property
def repeats(self) -> int:
"""
The repeats property of the note from 0 to 14.

* `0`: no repeat
* `1`: 1/4 (beat)
* `2`: 1/8 dotted
* `3`: 1/4 triplet
* `4`: 1/8
* `5`: 1/16 dotted
* `6`: 1/8 triplet
* `7`: 1/16 (step)
* `8`: 1/32 dotted
* `9`: 1/16 triplet
* `10`: 1/32 (half step)
* `11`: 1/64 dotted
* `12`: 1/32 triplet
* `13`: 1/64 (quarter step)
* `14`: 1/64 triplet
"""
return 0

@repeats.setter
def repeats(self, new_value: int) -> None:
pass

@property
def slide(self) -> bool:
"""
Expand Down
57 changes: 57 additions & 0 deletions src/piano_roll_scripting/flpianoroll/__score.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,30 @@ def tsden(self) -> int:
"""
return 0

@property
def snap_root_note(self) -> int:
"""
Root note of the piano roll's snap to scale setting,
where C is note `0`.
Note that this does not reflect key/scale markers.

Read-only.
"""
return 0

@property
def snap_scale_helper(self) -> str:
"""
String in the form of `0,1,0,1,0,0,1,0,1,0,1,0` with 0 indicating notes
**in** the scale and 1 indicating notes **not** in scale of the piano
roll's snap to scale setting.
This helper is always C-aligned.
Note that this does not reflect key/scale markers.

Read-only.
"""
return "0,1,0,1,0,0,1,0,1,0,1,0"

def clear(self, all: bool = False) -> None:
"""
Clear the selected notes and markers on the piano roll, or if there is
Expand Down Expand Up @@ -162,6 +186,39 @@ def deleteMarker(self, index: int) -> None:
* `index` (`int`): index of the marker to remove
"""

def getTimelineSelection(self) -> tuple[int, int]:
"""
Returns the selected timeline range.

## Returns

* `tuple[int, int]`: selection start, selection end (start is -1 if no selection was made)
"""
return -1, 0

def getDefaultNoteProperties(self) -> Note:
"""
Returns a note with the currently active style.

## Returns

`Note`: note with the draw tool's current properties
"""
return Note()

def getNextFreeGroupIndex(self) -> int:
"""
Returns the next free note group index.
If your script adds multiple groups, make sure to add the notes of one
group using `addNote` before calling this function again to get the
updated next free group index.

## Returns

`int`: Next free note group index
"""
return 0


score = Score()
"""
Expand Down