Skip to content

Commit

Permalink
Documentation of midi constants is finished!
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddyGuthridge committed Apr 22, 2024
1 parent d0a3119 commit 2ff603d
Show file tree
Hide file tree
Showing 10 changed files with 338 additions and 46 deletions.
12 changes: 12 additions & 0 deletions data/transdoc_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ def docs_url_attr(attribute: str, suffix: str = "") -> str:
return f"[{module}.{fn}{suffix}]({BASE_URL}/{module}/#{module}.{fn})"


def docs_url_callback(callback: str) -> str:
"""
Returns a markdown URL for a callback function within the API
documentation, given its name.
## Args
* `callback` (`str`): callback function to link to.
"""
return f"`{callback}`"


NOTE_MAPPINGS = {
# Commonly repeated info about colors
"colors": f"""Note that colors can be split into or built from components using the
Expand Down
6 changes: 6 additions & 0 deletions docs/midi_controller_scripting/midi/.pages
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ nav:
- Rec events: __rec_events
- MIDI codes: midi codes.md
- OnRefresh flags: on refresh flags.md
- OnDirtyChannel flags: on dirty channel flags.md
- PME flags: pme flags.md
- triggerLiveClip flags: tlc flags.md
- globalTransport commands: gt commands.md
- globalTransport flags: gt flags.md
- Mixer setTrackNumber flags: mixer setTrackNumber flags.md
- FFNEP flags: ffnep flags.md
- getColor flags: get color flags.md
- getVersion flags: get version flags.md
- plugins.getName flags: plugin get name flags.md
- CC flags: cc flags.md
- ...
15 changes: 15 additions & 0 deletions src/midi_controller_scripting/midi/__get_color_flags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
These flags are used by {{docs_url_fn[plugins.getColor]}} to control the kind
of color to return.
"""

GC_BackgroundColor = 0
"""
Returns the darkest background color of the GUI.
"""

GC_Semitone = 1
"""
Returns the semitone color. This can be used with the FPC plugin to get the
drum pad color.
"""
81 changes: 81 additions & 0 deletions src/midi_controller_scripting/midi/__get_version_flags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"""
These flags are given to {{docs_url_fn[ui.getVersion]}} to control the version
information returned.
"""

VER_Major = 0
"""
Return major version number as `int`.
```py
>>> import ui, midi
>>> ui.getVersion(midi.VER_Major)
20
```
"""

VER_Minor = 1
"""
Return minor version number as `int`.
```py
>>> import ui, midi
>>> ui.getVersion(midi.VER_Minor)
8
```
"""

VER_Release = 2
"""
Return release version number as `int`.
```py
>>> import ui, midi
>>> ui.getVersion(midi.VER_Release)
4
```
"""

VER_Build = 3
"""
Return build number as `int`.
```py
>>> import ui, midi
>>> ui.getVersion(midi.VER_Build)
2553
```
"""

VER_VersionAndEdition = 4
"""
Return program version and edition as `str`.
```py
>>> import ui, midi
>>> ui.getVersion(midi.VER_VersionAndEdition)
"Producer Edition v20.8.4 [build 2553]"
```
"""

VER_FullVersionAndEdition = 5
"""
Return program version and edition as `str`.
```py
>>> import ui, midi
>>> ui.getVersion(midi.VER_FullVersionAndEdition)
"Producer Edition v20.8.4 [build 2553] - Signature Bundle - 64Bit"
```
"""

VER_ArchAndBuild = 6
"""
Return operating system and system architecture as `str`.
```py
>>> import ui, midi
>>> ui.getVersion(midi.VER_ArchAndBuild)
"Windows - 64Bit [BETA]"
```
"""
96 changes: 50 additions & 46 deletions src/midi_controller_scripting/midi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
DotPan_Default,
DotVol_Max,
DotNote_Default,
ChannelDefaultVolume,
TackDefaultVolume,
)

from .__midi_codes import (
Expand Down Expand Up @@ -606,49 +608,51 @@
LB_Status_Simplest,
)

# channel looping settings for a given pattern (see TChannelLoopInfo)
ssLoopOff = 0
ssLoopNextStep = -1
ssLoopNextBeat = -2
ssLoopNextBar = -3

# FPD_GetColor flags
GC_BackgroundColor = 0
GC_Semitone = 1

# GetVersion flags
VER_Major = 0
VER_Minor = 1
VER_Release = 2
VER_Build = 3
VER_VersionAndEdition = 4
VER_FullVersionAndEdition = 5
VER_ArchAndBuild = 6

# GetParamName flags
FPN_Param = 0
FPN_ParamValue = 1
FPN_Semitone = 2
FPN_Patch = 3
FPN_VoiceLevel = 4
FPN_VoiceLevelHint = 5
FPN_Preset = 6
FPN_OutCtrl = 7
FPN_VoiceColor = 8
FPN_OutVoice = 9

# OnProjectLoad status
PL_Start = 0
PL_LoadOk = 100
PL_LoadError = 101

# OnDirtyChannelFlag flags
CE_New = 0
CE_Delete = 1
CE_Replace = 2
CE_Rename = 3
CE_Select = 4


ChannelDefaultVolume = 1000 / 1280
TackDefaultVolume = 800 / 1000
from .__step_sequencer_loop import (
ssLoopOff,
ssLoopNextStep,
ssLoopNextBeat,
ssLoopNextBar,
)

from .__get_color_flags import (
GC_BackgroundColor,
GC_Semitone,
)

from .__get_version_flags import (
VER_Major,
VER_Minor,
VER_Release,
VER_Build,
VER_VersionAndEdition,
VER_FullVersionAndEdition,
VER_ArchAndBuild,
)

from .__plugin_get_name_flags import (
FPN_Param,
FPN_ParamValue,
FPN_Semitone,
FPN_Patch,
FPN_VoiceLevel,
FPN_VoiceLevelHint,
FPN_Preset,
FPN_OutCtrl,
FPN_VoiceColor,
FPN_OutVoice,
)

from .__project_load_status import (
PL_Start,
PL_LoadOk,
PL_LoadError,
)

from .__on_dirty_channel_flags import (
CE_New,
CE_Delete,
CE_Replace,
CE_Rename,
CE_Select,
)
10 changes: 10 additions & 0 deletions src/midi_controller_scripting/midi/__miscellaneous.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,13 @@ def EncodeRemoteControlID(PortNum: int, ChanNum: int, CCNum: int) -> int:
DotPan_Default = 64
DotVol_Max = 128
DotNote_Default = MiddleNote_Default

ChannelDefaultVolume = 1000 / 1280
"""
Default volume of new channels on the channel rack.
"""

TackDefaultVolume = 800 / 1000
"""
Default volume of new tracks on the mixer. The name has a typo.
"""
29 changes: 29 additions & 0 deletions src/midi_controller_scripting/midi/__on_dirty_channel_flags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
These flags are given as an argument to the
{{docs_url_callback[OnDirtyChannel]}} callback.
"""

CE_New = 0
"""
A channel was added.
"""

CE_Delete = 1
"""
A channel was removed.
"""

CE_Replace = 2
"""
A channel was replaced.
"""

CE_Rename = 3
"""
A channel was renamed.
"""

CE_Select = 4
"""
The channel selection was changed.
"""
88 changes: 88 additions & 0 deletions src/midi_controller_scripting/midi/__plugin_get_name_flags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
"""
These values are provided to {{docs_url_fn[plugins.getName]}} to control the
information that it returns.
"""

FPN_Param = 0
"""
Name of plugin parameter.
* `paramIndex` should be the index of the parameter.
```py
>>> import plugins, midi
>>> plugins.getName(0, flag=midi.FPN_Param, paramIndex=0)
"Expression"
```
"""

FPN_ParamValue = 1
"""
Text value of plugin parameter.
* `paramIndex` should be the index of the parameter.
```py
>>> import plugins, midi
>>> plugins.getName(0, flag=midi.FPN_ParamValue, paramIndex=0)
"42%"
```
"""

FPN_Semitone = 2
"""
Name of note as defined by plugin.
* `paramIndex` should be the note number (eg `60` for middle C)
* If note names aren't defined by the plugin, an empty string is returned, even
though FL Studio will display the generic note name.
```py
>>> import plugins, midi
>>> plugins.getName(1, flag=midi.FPN_Semitone, paramIndex=42)
"Closed Hat"
```
"""

FPN_Patch = 3
"""
Name of the patch defined by the plugin?
"""

FPN_VoiceLevel = 4
"""
Name of the per-voice parameter defined by the plugin?
"""

FPN_VoiceLevelHint = 5
"""
Hint for per-voice parameter defined by plugin?
"""

FPN_Preset = 6
"""
For plugins that support internal presets, the name of the preset.
* `paramIndex` should be the index of the preset.
```py
>>> import plugins, midi
>>> plugins.getName(1, flag=midi.FPN_Preset, paramIndex=0)
"Breakbeat"
```
"""

FPN_OutCtrl = 7
"""
For plugins that output controllers, the name of the output controller?
"""

FPN_VoiceColor = 8
"""
Name of per-voice color?
"""

FPN_OutVoice = 9
"""
For plugins that output voices, the name of output voice?
"""
20 changes: 20 additions & 0 deletions src/midi_controller_scripting/midi/__project_load_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
These values are given as an argument to the
{{docs_url_callback[OnProjectLoad]}} callback.
"""


PL_Start = 0
"""
Starting to load the project.
"""

PL_LoadOk = 100
"""
The project was successfully loaded.
"""

PL_LoadError = 101
"""
The project stopped loading due to an error.
"""
Loading

0 comments on commit 2ff603d

Please sign in to comment.