Skip to content

Commit e958f45

Browse files
committed
Add play sound,update auto-generated docs
1 parent 887d108 commit e958f45

File tree

4 files changed

+1352
-1701
lines changed

4 files changed

+1352
-1701
lines changed

README.md

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
- [Program state](#program-state)
2323
- [Timing (sequential primitives) ](#timing-sequential-primitives)
2424
- [Hotkeys](#hotkeys)
25+
- [Play sound](#play-sound)
2526
- [Debug](#debug)
27+
- [Docs and code examples](docs-and-code-examples)
2628
- [Links](#links)
2729
- [Contribute](#contribute)
2830

@@ -92,15 +94,15 @@ eg.update_text = partial(eg.update_text,flag_func=flag)
9294
```
9395
[Full example](src/callback_partial.py)
9496
## UI
95-
|code | result |
96-
| --- | --- |
97-
|`obs.obs_properties_add_button(props, "button1", "Refresh1:",callback)` | ![img](src/button.png) |
98-
|`obs.obs_properties_add_bool(props,"_bool","_bool:")` | ![img](src/bool.png) |
99-
|`obs.obs_properties_add_int(props,"_int","_int:",1,100,1)` | ![img](src/int.png) |
100-
|`obs.obs_properties_add_int_slider(props,"_slider","_slider:",1,100,1) ` | ![img](src/slider.png) |
101-
|`obs.obs_properties_add_text(props, "_text", "_text:", obs.OBS_TEXT_DEFAULT) ` | ![img](src/text.png) |
102-
|`obs.obs_properties_add_color(props,"_color","_color:") ` | ![img](src/color.png) |
103-
|`obs.obs_properties_add_font(props,"_font","_font:") `| ![img](src/font.png) |
97+
|Preview|
98+
| --- |
99+
| `obs.obs_properties_add_button(props, "button1", "Refresh1:",callback)` ![img](src/button.png) |
100+
|`obs.obs_properties_add_bool(props,"_bool","_bool:")` ![img](src/bool.png) |
101+
|`obs.obs_properties_add_int(props,"_int","_int:",1,100,1)` ![img](src/int.png) |
102+
|`obs.obs_properties_add_int_slider(props,"_slider","_slider:",1,100,1) ` ![img](src/slider.png) |
103+
|`obs.obs_properties_add_text(props, "_text", "_text:", obs.OBS_TEXT_DEFAULT) ` ![img](src/text.png) |
104+
|`obs.obs_properties_add_color(props,"_color","_color:") ` ![img](src/color.png) |
105+
|`obs.obs_properties_add_font(props,"_font","_font:") ` ![img](src/font.png) |
104106

105107
See also :
106108
https://obsproject.com/docs/reference-properties.html#property-object-functions
@@ -153,6 +155,9 @@ def script_properties(): # ui
153155
...
154156
```
155157
[Full example](src/modification_prop.py)
158+
159+
Note: properties share similar structure , in Python, Lua, C.
160+
[Example C](https://github.com/obsproject/obs-studio/blob/05c9ddd2293a17717a1bb4189406dfdad79a93e1/plugins/oss-audio/oss-input.c#L626)
156161
See also :
157162
https://obsproject.com/docs/reference-properties.html#property-modification-functions
158163

@@ -165,13 +170,6 @@ https://obsproject.com/docs/reference-properties.html#property-modification-func
165170
- `obs_data_get_obj`
166171
- `obs_data_get_array`
167172

168-
Introspection of `obspython`:
169-
[Full example](src/export_md.py)
170-
[Generated export1.txt](src/export.md) contains all variables and functions available in `obspython` formatted with markdown and linked to appropriate search terms in OBS Studio github repository.
171-
172-
Note: properties share similar structure , in Python, Lua, C.
173-
[Example C](https://github.com/obsproject/obs-studio/blob/05c9ddd2293a17717a1bb4189406dfdad79a93e1/plugins/oss-audio/oss-input.c#L626)
174-
175173
## Save settings as json
176174

177175
```python
@@ -418,6 +416,23 @@ def script_load(settings):
418416
See also:
419417
https://github.com/obsproject/obs-studio/blob/master/libobs/obs-hotkeys.h
420418

419+
# Play sound
420+
```python
421+
def play_sound():
422+
...
423+
mediaSource = obs.obs_source_create_private(
424+
"ffmpeg_source", "Global Media Source", None
425+
)
426+
s = obs.obs_data_create()
427+
obs.obs_data_set_string(s, "local_file", script_path() + "alert.mp3")
428+
obs.obs_source_update(mediaSource, s)
429+
obs.obs_source_set_monitoring_type(
430+
mediaSource, obs.OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT
431+
)
432+
...
433+
```
434+
- [Full example](src/play_sound_globally.py)
435+
421436
# Debug
422437
There is no stdin therefore you can't use pdb , options are:
423438
- using `print`
@@ -432,6 +447,13 @@ There is no stdin therefore you can't use pdb , options are:
432447

433448
![screenshot](src/debug.png)
434449

450+
# Docs and code examples
451+
452+
[Generated export.md](src/export.md) contains all variables and functions available in `obspython` formatted with markdown. Table consist of links to appropriate search terms in OBS Studio repository, and obswebsocket,links to scripts in `obspython` and `obslua` with each script within github code search.`gs_*` and `matrix_*` functions exluded from that table.
453+
[Full example](src/export_md.py)
454+
455+
456+
435457
# Links
436458
- [Scripts](https://obsproject.com/forum/resources/categories/scripts.5/)
437459
- [OBS Studio Repo](https://github.com/obsproject/obs-studio)

0 commit comments

Comments
 (0)