-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsws_python.py
1535 lines (1235 loc) · 67.2 KB
/
sws_python.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SWS 2.9.7
from reaper_python import *
def BR_EnvAlloc(envelope,takeEnvelopesUseProjectTime):
"""
Python: BR_Envelope BR_EnvAlloc(TrackEnvelope envelope, Boolean takeEnvelopesUseProjectTime)
[BR] Allocate envelope object from track or take envelope pointer. Always call BR_EnvFree
when done to release the object and commit changes if needed.
takeEnvelopesUseProjectTime: take envelope points' positions are counted from take position, not project start time. If you want to work with project time instead, pass this as true.
For further manipulation see BR_EnvCountPoints
, BR_EnvDeletePoint
, BR_EnvFind
, BR_EnvFindNext
, BR_EnvFindPrevious
, BR_EnvGetParentTake
, BR_EnvGetParentTrack
, BR_EnvGetPoint
, BR_EnvGetProperties
, BR_EnvSetPoint
, BR_EnvSetProperties
, BR_EnvValueAtPos
.
"""
a=rpr_getfp('BR_EnvAlloc')
f=CFUNCTYPE(c_uint64,c_uint64,c_byte)(a)
t=(rpr_packp('TrackEnvelope*',envelope),c_byte(takeEnvelopesUseProjectTime))
r=f(t[0],t[1])
return rpr_unpackp('BR_Envelope*',r)
def BR_EnvCountPoints(envelope):
"""
Python: Int BR_EnvCountPoints(BR_Envelope envelope)
[BR] Count envelope points in the envelope object allocated with BR_EnvAlloc
.
"""
a=rpr_getfp('BR_EnvCountPoints')
f=CFUNCTYPE(c_int,c_uint64)(a)
t=(rpr_packp('BR_Envelope*',envelope),)
r=f(t[0])
return r
def BR_EnvDeletePoint(envelope,Id):
"""
Python: Boolean BR_EnvDeletePoint(BR_Envelope envelope, Int id)
[BR] Delete envelope point by index (zero-based) in the envelope object allocated with BR_EnvAlloc
. Returns true on success.
"""
a=rpr_getfp('BR_EnvDeletePoint')
f=CFUNCTYPE(c_byte,c_uint64,c_int)(a)
t=(rpr_packp('BR_Envelope*',envelope),c_int(Id))
r=f(t[0],t[1])
return r
def BR_EnvFind(envelope,position,delta):
"""
Python: Int BR_EnvFind(BR_Envelope envelope, Float position, Float delta)
[BR] Find envelope point at time position in the envelope object allocated with BR_EnvAlloc
. Pass delta > 0 to search surrounding range - in that case the closest point to position within delta will be searched for. Returns envelope point id (zero-based) on success or -1 on failure.
"""
a=rpr_getfp('BR_EnvFind')
f=CFUNCTYPE(c_int,c_uint64,c_double,c_double)(a)
t=(rpr_packp('BR_Envelope*',envelope),c_double(position),c_double(delta))
r=f(t[0],t[1],t[2])
return r
def BR_EnvFindNext(envelope,position):
"""
Python: Int BR_EnvFindNext(BR_Envelope envelope, Float position)
[BR] Find next envelope point after time position in the envelope object allocated with BR_EnvAlloc
. Returns envelope point id (zero-based) on success or -1 on failure.
"""
a=rpr_getfp('BR_EnvFindNext')
f=CFUNCTYPE(c_int,c_uint64,c_double)(a)
t=(rpr_packp('BR_Envelope*',envelope),c_double(position))
r=f(t[0],t[1])
return r
def BR_EnvFindPrevious(envelope,position):
"""
Python: Int BR_EnvFindPrevious(BR_Envelope envelope, Float position)
[BR] Find previous envelope point before time position in the envelope object allocated with BR_EnvAlloc
. Returns envelope point id (zero-based) on success or -1 on failure.
"""
a=rpr_getfp('BR_EnvFindPrevious')
f=CFUNCTYPE(c_int,c_uint64,c_double)(a)
t=(rpr_packp('BR_Envelope*',envelope),c_double(position))
r=f(t[0],t[1])
return r
def BR_EnvFree(envelope,commit):
"""
Python: Boolean BR_EnvFree(BR_Envelope envelope, Boolean commit)
[BR] Free envelope object allocated with BR_EnvAlloc
and commit changes if needed. Returns true if changes were committed successfully. Note that when envelope object wasn't modified nothing will get committed even if commit = true - in that case function returns false.
"""
a=rpr_getfp('BR_EnvFree')
f=CFUNCTYPE(c_byte,c_uint64,c_byte)(a)
t=(rpr_packp('BR_Envelope*',envelope),c_byte(commit))
r=f(t[0],t[1])
return r
def BR_EnvGetParentTake(envelope):
"""
Python: MediaItem_Take BR_EnvGetParentTake(BR_Envelope envelope)
[BR] If envelope object allocated with BR_EnvAlloc
is take envelope, returns parent media item take, otherwise NULL.
"""
a=rpr_getfp('BR_EnvGetParentTake')
f=CFUNCTYPE(c_uint64,c_uint64)(a)
t=(rpr_packp('BR_Envelope*',envelope),)
r=f(t[0])
return rpr_unpackp('MediaItem_Take*',r)
def BR_EnvGetParentTrack(envelope):
"""
Python: MediaItem BR_EnvGetParentTrack(BR_Envelope envelope)
[BR] Get parent track of envelope object allocated with BR_EnvAlloc
. If take envelope, returns NULL.
"""
a=rpr_getfp('BR_EnvGetParentTrack')
f=CFUNCTYPE(c_uint64,c_uint64)(a)
t=(rpr_packp('BR_Envelope*',envelope),)
r=f(t[0])
return rpr_unpackp('MediaItem*',r)
def BR_EnvGetPoint(envelope,Id,positionOut,valueOut,shapeOut,selectedOut,bezierOut):
"""
Python: (Boolean retval, BR_Envelope envelope, Int id, Float positionOut, Float valueOut, Int shapeOut, Boolean selectedOut, Float bezierOut) = BR_EnvGetPoint(envelope, id, positionOut, valueOut, shapeOut, selectedOut, bezierOut)
[BR] Get envelope point by id (zero-based) from the envelope object allocated with BR_EnvAlloc
. Returns true on success.
"""
a=rpr_getfp('BR_EnvGetPoint')
f=CFUNCTYPE(c_byte,c_uint64,c_int,c_void_p,c_void_p,c_void_p,c_void_p,c_void_p)(a)
t=(rpr_packp('BR_Envelope*',envelope),c_int(Id),c_double(positionOut),c_double(valueOut),c_int(shapeOut),c_byte(selectedOut),c_double(bezierOut))
r=f(t[0],t[1],byref(t[2]),byref(t[3]),byref(t[4]),byref(t[5]),byref(t[6]))
return (r,envelope,Id,float(t[2].value),float(t[3].value),int(t[4].value),int(t[5].value),float(t[6].value))
def BR_EnvGetProperties(envelope,activeOut,visibleOut,armedOut,inLaneOut,laneHeightOut,defaultShapeOut,minValueOut,maxValueOut,centerValueOut,typeOut,faderScalingOut):
"""
Python: (BR_Envelope envelope, Boolean activeOut, Boolean visibleOut, Boolean armedOut, Boolean inLaneOut, Int laneHeightOut, Int defaultShapeOut, Float minValueOut, Float maxValueOut, Float centerValueOut, Int typeOut, Boolean faderScalingOut) = BR_EnvGetProperties(envelope, activeOut, visibleOut, armedOut, inLaneOut, laneHeightOut, defaultShapeOut, minValueOut, maxValueOut, centerValueOut, typeOut, faderScalingOut)
[BR] Get envelope properties for the envelope object allocated with BR_EnvAlloc
.
active: true if envelope is active
visible: true if envelope is visible
armed: true if envelope is armed
inLane: true if envelope has it's own envelope lane
laneHeight: envelope lane override height. 0 for none, otherwise size in pixels
defaultShape: default point shape: 0->Linear, 1->Square, 2->Slow start/end, 3->Fast start, 4->Fast end, 5->Bezier
minValue: minimum envelope value
maxValue: maximum envelope value
type: envelope type: 0->Volume, 1->Volume (Pre-FX), 2->Pan, 3->Pan (Pre-FX), 4->Width, 5->Width (Pre-FX), 6->Mute, 7->Pitch, 8->Playrate, 9->Tempo map, 10->Parameter
faderScaling: true if envelope uses fader scaling
"""
a=rpr_getfp('BR_EnvGetProperties')
f=CFUNCTYPE(None,c_uint64,c_void_p,c_void_p,c_void_p,c_void_p,c_void_p,c_void_p,c_void_p,c_void_p,c_void_p,c_void_p,c_void_p)(a)
t=(rpr_packp('BR_Envelope*',envelope),c_byte(activeOut),c_byte(visibleOut),c_byte(armedOut),c_byte(inLaneOut),c_int(laneHeightOut),c_int(defaultShapeOut),c_double(minValueOut),c_double(maxValueOut),c_double(centerValueOut),c_int(typeOut),c_byte(faderScalingOut))
f(t[0],byref(t[1]),byref(t[2]),byref(t[3]),byref(t[4]),byref(t[5]),byref(t[6]),byref(t[7]),byref(t[8]),byref(t[9]),byref(t[10]),byref(t[11]))
return (envelope,int(t[1].value),int(t[2].value),int(t[3].value),int(t[4].value),int(t[5].value),int(t[6].value),float(t[7].value),float(t[8].value),float(t[9].value),int(t[10].value),int(t[11].value))
def BR_EnvSetPoint(envelope,Id,position,value,shape,selected,bezier):
"""
Python: Boolean BR_EnvSetPoint(BR_Envelope envelope, Int id, Float position, Float value, Int shape, Boolean selected, Float bezier)
[BR] Set envelope point by id (zero-based) in the envelope object allocated with BR_EnvAlloc
. To create point instead, pass id = -1. Note that if new point is inserted or existing point's time position is changed, points won't automatically get sorted. To do that, see BR_EnvSortPoints
.
Returns true on success.
"""
a=rpr_getfp('BR_EnvSetPoint')
f=CFUNCTYPE(c_byte,c_uint64,c_int,c_double,c_double,c_int,c_byte,c_double)(a)
t=(rpr_packp('BR_Envelope*',envelope),c_int(Id),c_double(position),c_double(value),c_int(shape),c_byte(selected),c_double(bezier))
r=f(t[0],t[1],t[2],t[3],t[4],t[5],t[6])
return r
def BR_EnvSetProperties(envelope,active,visible,armed,inLane,laneHeight,defaultShape,faderScaling):
"""
Python: BR_EnvSetProperties(BR_Envelope envelope, Boolean active, Boolean visible, Boolean armed, Boolean inLane, Int laneHeight, Int defaultShape, Boolean faderScaling)
[BR] Set envelope properties for the envelope object allocated with BR_EnvAlloc
. For parameter description see BR_EnvGetProperties
.
"""
a=rpr_getfp('BR_EnvSetProperties')
f=CFUNCTYPE(None,c_uint64,c_byte,c_byte,c_byte,c_byte,c_int,c_int,c_byte)(a)
t=(rpr_packp('BR_Envelope*',envelope),c_byte(active),c_byte(visible),c_byte(armed),c_byte(inLane),c_int(laneHeight),c_int(defaultShape),c_byte(faderScaling))
f(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7])
def BR_EnvSortPoints(envelope):
"""
Python: BR_EnvSortPoints(BR_Envelope envelope)
[BR] Sort envelope points by position. The only reason to call this is if sorted points are explicitly needed after editing them with BR_EnvSetPoint
. Note that you do not have to call this before doing BR_EnvFree
since it does handle unsorted points too.
"""
a=rpr_getfp('BR_EnvSortPoints')
f=CFUNCTYPE(None,c_uint64)(a)
t=(rpr_packp('BR_Envelope*',envelope),)
f(t[0])
def BR_EnvValueAtPos(envelope,position):
"""
Python: Float BR_EnvValueAtPos(BR_Envelope envelope, Float position)
[BR] Get envelope value at time position for the envelope object allocated with BR_EnvAlloc
.
"""
a=rpr_getfp('BR_EnvValueAtPos')
f=CFUNCTYPE(c_double,c_uint64,c_double)(a)
t=(rpr_packp('BR_Envelope*',envelope),c_double(position))
r=f(t[0],t[1])
return r
def BR_GetArrangeView(proj,startTimeOut,endTimeOut):
"""
Python: (ReaProject proj, Float startTimeOut, Float endTimeOut) = BR_GetArrangeView(proj, startTimeOut, endTimeOut)
[BR] Deprecated, see GetSet_ArrangeView2
(REAPER v5.12pre4+) -- Get start and end time position of arrange view. To set arrange view instead, see BR_SetArrangeView
.
"""
a=rpr_getfp('BR_GetArrangeView')
f=CFUNCTYPE(None,c_uint64,c_void_p,c_void_p)(a)
t=(rpr_packp('ReaProject*',proj),c_double(startTimeOut),c_double(endTimeOut))
f(t[0],byref(t[1]),byref(t[2]))
return (proj,float(t[1].value),float(t[2].value))
def BR_GetClosestGridDivision(position):
"""
Python: Float BR_GetClosestGridDivision(Float position)
[BR] Get closest grid division to position. Note that this functions is different from SnapToGrid
in two regards. SnapToGrid() needs snap enabled to work and this one works always. Secondly, grid divisions are different from grid lines because some grid lines may be hidden due to zoom level - this function ignores grid line visibility and always searches for the closest grid division at given position. For more grid division functions, see BR_GetNextGridDivision
and BR_GetPrevGridDivision
.
"""
a=rpr_getfp('BR_GetClosestGridDivision')
f=CFUNCTYPE(c_double,c_double)(a)
t=(c_double(position),)
r=f(t[0])
return r
def BR_GetCurrentTheme(themePathOut,themePathOut_sz,themeNameOut,themeNameOut_sz):
"""
Python: (String themePathOut, Int themePathOut_sz, String themeNameOut, Int themeNameOut_sz) = BR_GetCurrentTheme(themePathOut, themePathOut_sz, themeNameOut, themeNameOut_sz)
[BR] Get current theme information. themePathOut is set to full theme path and themeNameOut is set to theme name excluding any path info and extension
"""
a=rpr_getfp('BR_GetCurrentTheme')
f=CFUNCTYPE(None,c_char_p,c_int,c_char_p,c_int)(a)
t=(rpr_packs(themePathOut),c_int(themePathOut_sz),rpr_packs(themeNameOut),c_int(themeNameOut_sz))
f(t[0],t[1],t[2],t[3])
return (rpr_unpacks(t[0]),themePathOut_sz,rpr_unpacks(t[2]),themeNameOut_sz)
def BR_GetMediaItemByGUID(proj,guidStringIn):
"""
Python: MediaItem BR_GetMediaItemByGUID(ReaProject proj, String guidStringIn)
[BR] Get media item from GUID string. Note that the GUID must be enclosed in braces {}. To get item's GUID as a string, see BR_GetMediaItemGUID
.
"""
a=rpr_getfp('BR_GetMediaItemByGUID')
f=CFUNCTYPE(c_uint64,c_uint64,c_char_p)(a)
t=(rpr_packp('ReaProject*',proj),rpr_packsc(guidStringIn))
r=f(t[0],t[1])
return rpr_unpackp('MediaItem*',r)
def BR_GetMediaItemGUID(item,guidStringOut,guidStringOut_sz):
"""
Python: (MediaItem item, String guidStringOut, Int guidStringOut_sz) = BR_GetMediaItemGUID(item, guidStringOut, guidStringOut_sz)
[BR] Get media item GUID as a string (guidStringOut_sz should be at least 64). To get media item back from GUID string, see BR_GetMediaItemByGUID
.
"""
a=rpr_getfp('BR_GetMediaItemGUID')
f=CFUNCTYPE(None,c_uint64,c_char_p,c_int)(a)
t=(rpr_packp('MediaItem*',item),rpr_packs(guidStringOut),c_int(guidStringOut_sz))
f(t[0],t[1],t[2])
return (item,rpr_unpacks(t[1]),guidStringOut_sz)
def BR_GetMediaItemImageResource(item,imageOut,imageOut_sz,imageFlagsOut):
"""
Python: (Boolean retval, MediaItem item, String imageOut, Int imageOut_sz, Int imageFlagsOut) = BR_GetMediaItemImageResource(item, imageOut, imageOut_sz, imageFlagsOut)
[BR] Get currently loaded image resource and it's flags for a given item. Returns false if there is no image resource set. To set image resource, see BR_SetMediaItemImageResource
.
"""
a=rpr_getfp('BR_GetMediaItemImageResource')
f=CFUNCTYPE(c_byte,c_uint64,c_char_p,c_int,c_void_p)(a)
t=(rpr_packp('MediaItem*',item),rpr_packs(imageOut),c_int(imageOut_sz),c_int(imageFlagsOut))
r=f(t[0],t[1],t[2],byref(t[3]))
return (r,item,rpr_unpacks(t[1]),imageOut_sz,int(t[3].value))
def BR_GetMediaItemTakeGUID(take,guidStringOut,guidStringOut_sz):
"""
Python: (MediaItem_Take take, String guidStringOut, Int guidStringOut_sz) = BR_GetMediaItemTakeGUID(take, guidStringOut, guidStringOut_sz)
[BR] Get media item take GUID as a string (guidStringOut_sz should be at least 64). To get take from GUID string, see SNM_GetMediaItemTakeByGUID
.
"""
a=rpr_getfp('BR_GetMediaItemTakeGUID')
f=CFUNCTYPE(None,c_uint64,c_char_p,c_int)(a)
t=(rpr_packp('MediaItem_Take*',take),rpr_packs(guidStringOut),c_int(guidStringOut_sz))
f(t[0],t[1],t[2])
return (take,rpr_unpacks(t[1]),guidStringOut_sz)
def BR_GetMediaSourceProperties(take,sectionOut,startOut,lengthOut,fadeOut,reverseOut):
"""
Python: (Boolean retval, MediaItem_Take take, Boolean sectionOut, Float startOut, Float lengthOut, Float fadeOut, Boolean reverseOut) = BR_GetMediaSourceProperties(take, sectionOut, startOut, lengthOut, fadeOut, reverseOut)
[BR] Get take media source properties as they appear in Item properties
. Returns false if take can't have them (MIDI items etc.).
To set source properties, see BR_SetMediaSourceProperties
.
"""
a=rpr_getfp('BR_GetMediaSourceProperties')
f=CFUNCTYPE(c_byte,c_uint64,c_void_p,c_void_p,c_void_p,c_void_p,c_void_p)(a)
t=(rpr_packp('MediaItem_Take*',take),c_byte(sectionOut),c_double(startOut),c_double(lengthOut),c_double(fadeOut),c_byte(reverseOut))
r=f(t[0],byref(t[1]),byref(t[2]),byref(t[3]),byref(t[4]),byref(t[5]))
return (r,take,int(t[1].value),float(t[2].value),float(t[3].value),float(t[4].value),int(t[5].value))
def BR_GetMediaTrackByGUID(proj,guidStringIn):
"""
Python: MediaTrack BR_GetMediaTrackByGUID(ReaProject proj, String guidStringIn)
[BR] Get media track from GUID string. Note that the GUID must be enclosed in braces {}. To get track's GUID as a string, see BR_GetMediaTrackGUID
.
"""
a=rpr_getfp('BR_GetMediaTrackByGUID')
f=CFUNCTYPE(c_uint64,c_uint64,c_char_p)(a)
t=(rpr_packp('ReaProject*',proj),rpr_packsc(guidStringIn))
r=f(t[0],t[1])
return rpr_unpackp('MediaTrack*',r)
def BR_GetMediaTrackFreezeCount(track):
"""
Python: Int BR_GetMediaTrackFreezeCount(MediaTrack track)
[BR] Get media track freeze count (if track isn't frozen at all, returns 0).
"""
a=rpr_getfp('BR_GetMediaTrackFreezeCount')
f=CFUNCTYPE(c_int,c_uint64)(a)
t=(rpr_packp('MediaTrack*',track),)
r=f(t[0])
return r
def BR_GetMediaTrackGUID(track,guidStringOut,guidStringOut_sz):
"""
Python: (MediaTrack track, String guidStringOut, Int guidStringOut_sz) = BR_GetMediaTrackGUID(track, guidStringOut, guidStringOut_sz)
[BR] Get media track GUID as a string (guidStringOut_sz should be at least 64). To get media track back from GUID string, see BR_GetMediaTrackByGUID
.
"""
a=rpr_getfp('BR_GetMediaTrackGUID')
f=CFUNCTYPE(None,c_uint64,c_char_p,c_int)(a)
t=(rpr_packp('MediaTrack*',track),rpr_packs(guidStringOut),c_int(guidStringOut_sz))
f(t[0],t[1],t[2])
return (track,rpr_unpacks(t[1]),guidStringOut_sz)
def BR_GetMediaTrackLayouts(track,mcpLayoutNameOut,mcpLayoutNameOut_sz,tcpLayoutNameOut,tcpLayoutNameOut_sz):
"""
Python: (MediaTrack track, String mcpLayoutNameOut, Int mcpLayoutNameOut_sz, String tcpLayoutNameOut, Int tcpLayoutNameOut_sz) = BR_GetMediaTrackLayouts(track, mcpLayoutNameOut, mcpLayoutNameOut_sz, tcpLayoutNameOut, tcpLayoutNameOut_sz)
[BR] Deprecated, see GetSetMediaTrackInfo
(REAPER v5.02+). Get media track layouts for MCP and TCP. Empty string ("") means that layout is set to the default layout. To set media track layouts, see BR_SetMediaTrackLayouts
.
"""
a=rpr_getfp('BR_GetMediaTrackLayouts')
f=CFUNCTYPE(None,c_uint64,c_char_p,c_int,c_char_p,c_int)(a)
t=(rpr_packp('MediaTrack*',track),rpr_packs(mcpLayoutNameOut),c_int(mcpLayoutNameOut_sz),rpr_packs(tcpLayoutNameOut),c_int(tcpLayoutNameOut_sz))
f(t[0],t[1],t[2],t[3],t[4])
return (track,rpr_unpacks(t[1]),mcpLayoutNameOut_sz,rpr_unpacks(t[3]),tcpLayoutNameOut_sz)
def BR_GetMediaTrackSendInfo_Envelope(track,category,sendidx,envelopeType):
"""
Python: TrackEnvelope BR_GetMediaTrackSendInfo_Envelope(MediaTrack track, Int category, Int sendidx, Int envelopeType)
[BR] Get track envelope for send/receive/hardware output.
category is <0 for receives, 0=sends, >0 for hardware outputs
sendidx is zero-based (see GetTrackNumSends
to count track sends/receives/hardware outputs)
envelopeType determines which envelope is returned (0=volume, 1=pan, 2=mute)
Note: To get or set other send attributes, see BR_GetSetTrackSendInfo
and BR_GetMediaTrackSendInfo_Track
.
"""
a=rpr_getfp('BR_GetMediaTrackSendInfo_Envelope')
f=CFUNCTYPE(c_uint64,c_uint64,c_int,c_int,c_int)(a)
t=(rpr_packp('MediaTrack*',track),c_int(category),c_int(sendidx),c_int(envelopeType))
r=f(t[0],t[1],t[2],t[3])
return rpr_unpackp('TrackEnvelope*',r)
def BR_GetMediaTrackSendInfo_Track(track,category,sendidx,trackType):
"""
Python: MediaTrack BR_GetMediaTrackSendInfo_Track(MediaTrack track, Int category, Int sendidx, Int trackType)
[BR] Get source or destination media track for send/receive.
category is <0 for receives, 0=sends
sendidx is zero-based (see GetTrackNumSends
to count track sends/receives)
trackType determines which track is returned (0=source track, 1=destination track)
Note: To get or set other send attributes, see BR_GetSetTrackSendInfo
and BR_GetMediaTrackSendInfo_Envelope
.
"""
a=rpr_getfp('BR_GetMediaTrackSendInfo_Track')
f=CFUNCTYPE(c_uint64,c_uint64,c_int,c_int,c_int)(a)
t=(rpr_packp('MediaTrack*',track),c_int(category),c_int(sendidx),c_int(trackType))
r=f(t[0],t[1],t[2],t[3])
return rpr_unpackp('MediaTrack*',r)
def BR_GetMidiSourceLenPPQ(take):
"""
Python: Float BR_GetMidiSourceLenPPQ(MediaItem_Take take)
[BR] Get MIDI take source length in PPQ. In case the take isn't MIDI, return value will be -1.
"""
a=rpr_getfp('BR_GetMidiSourceLenPPQ')
f=CFUNCTYPE(c_double,c_uint64)(a)
t=(rpr_packp('MediaItem_Take*',take),)
r=f(t[0])
return r
def BR_GetMidiTakePoolGUID(take,guidStringOut,guidStringOut_sz):
"""
Python: (Boolean retval, MediaItem_Take take, String guidStringOut, Int guidStringOut_sz) = BR_GetMidiTakePoolGUID(take, guidStringOut, guidStringOut_sz)
[BR] Get MIDI take pool GUID as a string (guidStringOut_sz should be at least 64). Returns true if take is pooled.
"""
a=rpr_getfp('BR_GetMidiTakePoolGUID')
f=CFUNCTYPE(c_byte,c_uint64,c_char_p,c_int)(a)
t=(rpr_packp('MediaItem_Take*',take),rpr_packs(guidStringOut),c_int(guidStringOut_sz))
r=f(t[0],t[1],t[2])
return (r,take,rpr_unpacks(t[1]),guidStringOut_sz)
def BR_GetMidiTakeTempoInfo(take,ignoreProjTempoOut,bpmOut,numOut,denOut):
"""
Python: (Boolean retval, MediaItem_Take take, Boolean ignoreProjTempoOut, Float bpmOut, Int numOut, Int denOut) = BR_GetMidiTakeTempoInfo(take, ignoreProjTempoOut, bpmOut, numOut, denOut)
[BR] Get "ignore project tempo" information for MIDI take. Returns true if take can ignore project tempo (no matter if it's actually ignored), otherwise false.
"""
a=rpr_getfp('BR_GetMidiTakeTempoInfo')
f=CFUNCTYPE(c_byte,c_uint64,c_void_p,c_void_p,c_void_p,c_void_p)(a)
t=(rpr_packp('MediaItem_Take*',take),c_byte(ignoreProjTempoOut),c_double(bpmOut),c_int(numOut),c_int(denOut))
r=f(t[0],byref(t[1]),byref(t[2]),byref(t[3]),byref(t[4]))
return (r,take,int(t[1].value),float(t[2].value),int(t[3].value),int(t[4].value))
def BR_GetMouseCursorContext(windowOut,windowOut_sz,segmentOut,segmentOut_sz,detailsOut,detailsOut_sz):
"""
Python: (String windowOut, Int windowOut_sz, String segmentOut, Int segmentOut_sz, String detailsOut, Int detailsOut_sz) = BR_GetMouseCursorContext(windowOut, windowOut_sz, segmentOut, segmentOut_sz, detailsOut, detailsOut_sz)
[BR] Get mouse cursor context. Each parameter returns information in a form of string as specified in the table below.
To get more info on stuff that was found under mouse cursor see BR_GetMouseCursorContext_Envelope
, BR_GetMouseCursorContext_Item
, BR_GetMouseCursorContext_MIDI
, BR_GetMouseCursorContext_Position
, BR_GetMouseCursorContext_Take
, BR_GetMouseCursorContext_Track
Window Segment Details unknown "" "" ruler region_lane "" marker_lane "" tempo_lane "" timeline "" transport "" "" tcp track "" envelope "" empty "" mcp track "" empty "" arrange track empty,item, item_stretch_marker,env_point, env_segment envelope empty, env_point, env_segment empty "" midi_editor unknown "" ruler "" piano "" notes "" cc_lane cc_selector, cc_lane
"""
a=rpr_getfp('BR_GetMouseCursorContext')
f=CFUNCTYPE(None,c_char_p,c_int,c_char_p,c_int,c_char_p,c_int)(a)
t=(rpr_packs(windowOut),c_int(windowOut_sz),rpr_packs(segmentOut),c_int(segmentOut_sz),rpr_packs(detailsOut),c_int(detailsOut_sz))
f(t[0],t[1],t[2],t[3],t[4],t[5])
return (rpr_unpacks(t[0]),windowOut_sz,rpr_unpacks(t[2]),segmentOut_sz,rpr_unpacks(t[4]),detailsOut_sz)
def BR_GetMouseCursorContext_Envelope(takeEnvelopeOut):
"""
Python: (TrackEnvelope retval, Boolean takeEnvelopeOut) = BR_GetMouseCursorContext_Envelope(takeEnvelopeOut)
[BR] Returns envelope that was captured with the last call to BR_GetMouseCursorContext
. In case the envelope belongs to take, takeEnvelope will be true.
"""
a=rpr_getfp('BR_GetMouseCursorContext_Envelope')
f=CFUNCTYPE(c_uint64,c_void_p)(a)
t=(c_byte(takeEnvelopeOut),)
r=f(byref(t[0]))
return (rpr_unpackp('TrackEnvelope*',r),int(t[0].value))
def BR_GetMouseCursorContext_Item():
"""
Python: MediaItem BR_GetMouseCursorContext_Item()
[BR] Returns item under mouse cursor that was captured with the last call to BR_GetMouseCursorContext
. Note that the function will return item even if mouse cursor is over some other track lane element like stretch marker or envelope. This enables for easier identification of items when you want to ignore elements within the item.
"""
a=rpr_getfp('BR_GetMouseCursorContext_Item')
f=CFUNCTYPE(c_uint64)(a)
r=f()
return rpr_unpackp('MediaItem*',r)
def BR_GetMouseCursorContext_MIDI(inlineEditorOut,noteRowOut,ccLaneOut,ccLaneValOut,ccLaneIdOut):
"""
Python: (void retval, Boolean inlineEditorOut, Int noteRowOut, Int ccLaneOut, Int ccLaneValOut, Int ccLaneIdOut) = BR_GetMouseCursorContext_MIDI(inlineEditorOut, noteRowOut, ccLaneOut, ccLaneValOut, ccLaneIdOut)
[BR] Returns midi editor under mouse cursor that was captured with the last call to BR_GetMouseCursorContext
.
inlineEditor: if mouse was captured in inline MIDI editor, this will be true (consequentially, returned MIDI editor will be NULL)
noteRow: note row or piano key under mouse cursor (0-127)
ccLane: CC lane under mouse cursor (CC0-127=CC, 0x100|(0-31)=14-bit CC, 0x200=velocity, 0x201=pitch, 0x202=program, 0x203=channel pressure, 0x204=bank/program select, 0x205=text, 0x206=sysex, 0x207=off velocity)
ccLaneVal: value in CC lane under mouse cursor (0-127 or 0-16383)
ccLaneId: lane position, counting from the top (0 based)
Note: due to API limitations, if mouse is over inline MIDI editor with some note rows hidden, noteRow will be -1
"""
a=rpr_getfp('BR_GetMouseCursorContext_MIDI')
f=CFUNCTYPE(c_uint64,c_void_p,c_void_p,c_void_p,c_void_p,c_void_p)(a)
t=(c_byte(inlineEditorOut),c_int(noteRowOut),c_int(ccLaneOut),c_int(ccLaneValOut),c_int(ccLaneIdOut))
r=f(byref(t[0]),byref(t[1]),byref(t[2]),byref(t[3]),byref(t[4]))
return (rpr_unpackp('void*',r),int(t[0].value),int(t[1].value),int(t[2].value),int(t[3].value),int(t[4].value))
def BR_GetMouseCursorContext_Position():
"""
Python: Float BR_GetMouseCursorContext_Position()
[BR] Returns project time position in arrange/ruler/midi editor that was captured with the last call to BR_GetMouseCursorContext
.
"""
a=rpr_getfp('BR_GetMouseCursorContext_Position')
f=CFUNCTYPE(c_double)(a)
r=f()
return r
def BR_GetMouseCursorContext_StretchMarker():
"""
Python: Int BR_GetMouseCursorContext_StretchMarker()
[BR] Returns id of a stretch marker under mouse cursor that was captured with the last call to BR_GetMouseCursorContext
.
"""
a=rpr_getfp('BR_GetMouseCursorContext_StretchMarker')
f=CFUNCTYPE(c_int)(a)
r=f()
return r
def BR_GetMouseCursorContext_Take():
"""
Python: MediaItem_Take BR_GetMouseCursorContext_Take()
[BR] Returns take under mouse cursor that was captured with the last call to BR_GetMouseCursorContext
.
"""
a=rpr_getfp('BR_GetMouseCursorContext_Take')
f=CFUNCTYPE(c_uint64)(a)
r=f()
return rpr_unpackp('MediaItem_Take*',r)
def BR_GetMouseCursorContext_Track():
"""
Python: MediaTrack BR_GetMouseCursorContext_Track()
[BR] Returns track under mouse cursor that was captured with the last call to BR_GetMouseCursorContext
.
"""
a=rpr_getfp('BR_GetMouseCursorContext_Track')
f=CFUNCTYPE(c_uint64)(a)
r=f()
return rpr_unpackp('MediaTrack*',r)
def BR_GetNextGridDivision(position):
"""
Python: Float BR_GetNextGridDivision(Float position)
[BR] Get next grid division after the time position. For more grid divisions function, see BR_GetClosestGridDivision
and BR_GetPrevGridDivision
.
"""
a=rpr_getfp('BR_GetNextGridDivision')
f=CFUNCTYPE(c_double,c_double)(a)
t=(c_double(position),)
r=f(t[0])
return r
def BR_GetPrevGridDivision(position):
"""
Python: Float BR_GetPrevGridDivision(Float position)
[BR] Get previous grid division before the time position. For more grid division functions, see BR_GetClosestGridDivision
and BR_GetNextGridDivision
.
"""
a=rpr_getfp('BR_GetPrevGridDivision')
f=CFUNCTYPE(c_double,c_double)(a)
t=(c_double(position),)
r=f(t[0])
return r
def BR_GetSetTrackSendInfo(track,category,sendidx,parmname,setNewValue,newValue):
"""
Python: Float BR_GetSetTrackSendInfo(MediaTrack track, Int category, Int sendidx, String parmname, Boolean setNewValue, Float newValue)
[BR] Get or set send attributes.
category is <0 for receives, 0=sends, >0 for hardware outputs
sendidx is zero-based (see GetTrackNumSends
to count track sends/receives/hardware outputs)
To set attribute, pass setNewValue as true
List of possible parameters:
B_MUTE : send mute state (1.0 if muted, otherwise 0.0)
B_PHASE : send phase state (1.0 if phase is inverted, otherwise 0.0)
B_MONO : send mono state (1.0 if send is set to mono, otherwise 0.0)
D_VOL : send volume (1.0=+0dB etc...)
D_PAN : send pan (-1.0=100%L, 0=center, 1.0=100%R)
D_PANLAW : send pan law (1.0=+0.0db, 0.5=-6dB, -1.0=project default etc...)
I_SENDMODE : send mode (0=post-fader, 1=pre-fx, 2=post-fx(deprecated), 3=post-fx)
I_SRCCHAN : audio source starting channel index or -1 if audio send is disabled (&1024=mono...note that in that case, when reading index, you should do (index XOR 1024) to get starting channel index)
I_DSTCHAN : audio destination starting channel index (&1024=mono (and in case of hardware output &512=rearoute)...note that in that case, when reading index, you should do (index XOR (1024 OR 512)) to get starting channel index)
I_MIDI_SRCCHAN : source MIDI channel, -1 if MIDI send is disabled (0=all, 1-16)
I_MIDI_DSTCHAN : destination MIDI channel, -1 if MIDI send is disabled (0=original, 1-16)
I_MIDI_SRCBUS : source MIDI bus, -1 if MIDI send is disabled (0=all, otherwise bus index)
I_MIDI_DSTBUS : receive MIDI bus, -1 if MIDI send is disabled (0=all, otherwise bus index)
I_MIDI_LINK_VOLPAN : link volume/pan controls to MIDI
Note: To get or set other send attributes, see BR_GetMediaTrackSendInfo_Envelope
and BR_GetMediaTrackSendInfo_Track
.
"""
a=rpr_getfp('BR_GetSetTrackSendInfo')
f=CFUNCTYPE(c_double,c_uint64,c_int,c_int,c_char_p,c_byte,c_double)(a)
t=(rpr_packp('MediaTrack*',track),c_int(category),c_int(sendidx),rpr_packsc(parmname),c_byte(setNewValue),c_double(newValue))
r=f(t[0],t[1],t[2],t[3],t[4],t[5])
return r
def BR_GetTakeFXCount(take):
"""
Python: Int BR_GetTakeFXCount(MediaItem_Take take)
[BR] Returns FX count for supplied take
"""
a=rpr_getfp('BR_GetTakeFXCount')
f=CFUNCTYPE(c_int,c_uint64)(a)
t=(rpr_packp('MediaItem_Take*',take),)
r=f(t[0])
return r
def BR_IsMidiOpenInInlineEditor(take):
"""
Python: Boolean BR_IsMidiOpenInInlineEditor(MediaItem_Take take)
[SWS] Check if take has MIDI inline editor open and returns true or false.
"""
a=rpr_getfp('BR_IsMidiOpenInInlineEditor')
f=CFUNCTYPE(c_byte,c_uint64)(a)
t=(rpr_packp('MediaItem_Take*',take),)
r=f(t[0])
return r
def BR_IsTakeMidi(take,inProjectMidiOut):
"""
Python: (Boolean retval, MediaItem_Take take, Boolean inProjectMidiOut) = BR_IsTakeMidi(take, inProjectMidiOut)
[BR] Check if take is MIDI take, in case MIDI take is in-project MIDI source data, inProjectMidiOut will be true, otherwise false.
"""
a=rpr_getfp('BR_IsTakeMidi')
f=CFUNCTYPE(c_byte,c_uint64,c_void_p)(a)
t=(rpr_packp('MediaItem_Take*',take),c_byte(inProjectMidiOut))
r=f(t[0],byref(t[1]))
return (r,take,int(t[1].value))
def BR_ItemAtMouseCursor(positionOut):
"""
Python: (MediaItem retval, Float positionOut) = BR_ItemAtMouseCursor(positionOut)
[BR] Get media item under mouse cursor. Position is mouse cursor position in arrange.
"""
a=rpr_getfp('BR_ItemAtMouseCursor')
f=CFUNCTYPE(c_uint64,c_void_p)(a)
t=(c_double(positionOut),)
r=f(byref(t[0]))
return (rpr_unpackp('MediaItem*',r),float(t[0].value))
def BR_MIDI_CCLaneRemove(midiEditor,laneId):
"""
Python: Boolean BR_MIDI_CCLaneRemove(HWND midiEditor, Int laneId)
[BR] Remove CC lane in midi editor. Returns true on success
"""
a=rpr_getfp('BR_MIDI_CCLaneRemove')
f=CFUNCTYPE(c_byte,c_uint64,c_int)(a)
t=(rpr_packp('HWND',midiEditor),c_int(laneId))
r=f(t[0],t[1])
return r
def BR_MIDI_CCLaneReplace(midiEditor,laneId,newCC):
"""
Python: Boolean BR_MIDI_CCLaneReplace(HWND midiEditor, Int laneId, Int newCC)
[BR] Replace CC lane in midi editor. Returns true on success.
Valid CC lanes: CC0-127=CC, 0x100|(0-31)=14-bit CC, 0x200=velocity, 0x201=pitch, 0x202=program, 0x203=channel pressure, 0x204=bank/program select, 0x205=text, 0x206=sysex, 0x207
"""
a=rpr_getfp('BR_MIDI_CCLaneReplace')
f=CFUNCTYPE(c_byte,c_uint64,c_int,c_int)(a)
t=(rpr_packp('HWND',midiEditor),c_int(laneId),c_int(newCC))
r=f(t[0],t[1],t[2])
return r
def BR_PositionAtMouseCursor(checkRuler):
"""
Python: Float BR_PositionAtMouseCursor(Boolean checkRuler)
[BR] Get position at mouse cursor. To check ruler along with arrange, pass checkRuler=true. Returns -1 if cursor is not over arrange/ruler.
"""
a=rpr_getfp('BR_PositionAtMouseCursor')
f=CFUNCTYPE(c_double,c_byte)(a)
t=(c_byte(checkRuler),)
r=f(t[0])
return r
def BR_SetArrangeView(proj,startTime,endTime):
"""
Python: BR_SetArrangeView(ReaProject proj, Float startTime, Float endTime)
[BR] Deprecated, see GetSet_ArrangeView2
(REAPER v5.12pre4+) -- Set start and end time position of arrange view. To get arrange view instead, see BR_GetArrangeView
.
"""
a=rpr_getfp('BR_SetArrangeView')
f=CFUNCTYPE(None,c_uint64,c_double,c_double)(a)
t=(rpr_packp('ReaProject*',proj),c_double(startTime),c_double(endTime))
f(t[0],t[1],t[2])
def BR_SetItemEdges(item,startTime,endTime):
"""
Python: Boolean BR_SetItemEdges(MediaItem item, Float startTime, Float endTime)
[BR] Set item start and end edges' position - returns true in case of any changes
"""
a=rpr_getfp('BR_SetItemEdges')
f=CFUNCTYPE(c_byte,c_uint64,c_double,c_double)(a)
t=(rpr_packp('MediaItem*',item),c_double(startTime),c_double(endTime))
r=f(t[0],t[1],t[2])
return r
def BR_SetMediaItemImageResource(item,imageIn,imageFlags):
"""
Python: BR_SetMediaItemImageResource(MediaItem item, String imageIn, Int imageFlags)
[BR] Set image resource and it's flags for a given item. To clear current image resource, pass imageIn as . To get image resource, see BR_GetMediaItemImageResource
.
"""
a=rpr_getfp('BR_SetMediaItemImageResource')
f=CFUNCTYPE(None,c_uint64,c_char_p,c_int)(a)
t=(rpr_packp('MediaItem*',item),rpr_packsc(imageIn),c_int(imageFlags))
f(t[0],t[1],t[2])
def BR_SetMediaSourceProperties(take,section,start,length,fade,reverse):
"""
Python: Boolean BR_SetMediaSourceProperties(MediaItem_Take take, Boolean section, Float start, Float length, Float fade, Boolean reverse)
[BR] Set take media source properties. Returns false if take can't have them (MIDI items etc.). Section parameters have to be valid only when passing section=true.
To get source properties, see BR_GetMediaSourceProperties
.
"""
a=rpr_getfp('BR_SetMediaSourceProperties')
f=CFUNCTYPE(c_byte,c_uint64,c_byte,c_double,c_double,c_double,c_byte)(a)
t=(rpr_packp('MediaItem_Take*',take),c_byte(section),c_double(start),c_double(length),c_double(fade),c_byte(reverse))
r=f(t[0],t[1],t[2],t[3],t[4],t[5])
return r
def BR_SetMediaTrackLayouts(track,mcpLayoutNameIn,tcpLayoutNameIn):
"""
Python: Boolean BR_SetMediaTrackLayouts(MediaTrack track, String mcpLayoutNameIn, String tcpLayoutNameIn)
[BR] Deprecated, see GetSetMediaTrackInfo
(REAPER v5.02+). Set media track layouts for MCP and TCP. To set default layout, pass empty string ("") as layout name. In case layouts were successfully set, returns true (if layouts are already set to supplied layout names, it will return false since no changes were made).
To get media track layouts, see BR_GetMediaTrackLayouts
.
"""
a=rpr_getfp('BR_SetMediaTrackLayouts')
f=CFUNCTYPE(c_byte,c_uint64,c_char_p,c_char_p)(a)
t=(rpr_packp('MediaTrack*',track),rpr_packsc(mcpLayoutNameIn),rpr_packsc(tcpLayoutNameIn))
r=f(t[0],t[1],t[2])
return r
def BR_SetMidiTakeTempoInfo(take,ignoreProjTempo,bpm,num,den):
"""
Python: Boolean BR_SetMidiTakeTempoInfo(MediaItem_Take take, Boolean ignoreProjTempo, Float bpm, Int num, Int den)
[BR] Set "ignore project tempo" information for MIDI take. Returns true in case the take was successfully updated.
"""
a=rpr_getfp('BR_SetMidiTakeTempoInfo')
f=CFUNCTYPE(c_byte,c_uint64,c_byte,c_double,c_int,c_int)(a)
t=(rpr_packp('MediaItem_Take*',take),c_byte(ignoreProjTempo),c_double(bpm),c_int(num),c_int(den))
r=f(t[0],t[1],t[2],t[3],t[4])
return r
def BR_SetTakeSourceFromFile(take,filenameIn,inProjectData):
"""
Python: Boolean BR_SetTakeSourceFromFile(MediaItem_Take take, String filenameIn, Boolean inProjectData)
[BR] Set new take source from file. To import MIDI file as in-project source data pass inProjectData=true. Returns false if failed.
Any take source properties from the previous source will be lost - to preserve them, see BR_SetTakeSourceFromFile2
.
Note: To set source from existing take, see SNM_GetSetSourceState2
.
"""
a=rpr_getfp('BR_SetTakeSourceFromFile')
f=CFUNCTYPE(c_byte,c_uint64,c_char_p,c_byte)(a)
t=(rpr_packp('MediaItem_Take*',take),rpr_packsc(filenameIn),c_byte(inProjectData))
r=f(t[0],t[1],t[2])
return r
def BR_SetTakeSourceFromFile2(take,filenameIn,inProjectData,keepSourceProperties):
"""
Python: Boolean BR_SetTakeSourceFromFile2(MediaItem_Take take, String filenameIn, Boolean inProjectData, Boolean keepSourceProperties)
[BR] Differs from BR_SetTakeSourceFromFile
only that it can also preserve existing take media source properties.
"""
a=rpr_getfp('BR_SetTakeSourceFromFile2')
f=CFUNCTYPE(c_byte,c_uint64,c_char_p,c_byte,c_byte)(a)
t=(rpr_packp('MediaItem_Take*',take),rpr_packsc(filenameIn),c_byte(inProjectData),c_byte(keepSourceProperties))
r=f(t[0],t[1],t[2],t[3])
return r
def BR_TakeAtMouseCursor(positionOut):
"""
Python: (MediaItem_Take retval, Float positionOut) = BR_TakeAtMouseCursor(positionOut)
[BR] Get take under mouse cursor. Position is mouse cursor position in arrange.
"""
a=rpr_getfp('BR_TakeAtMouseCursor')
f=CFUNCTYPE(c_uint64,c_void_p)(a)
t=(c_double(positionOut),)
r=f(byref(t[0]))
return (rpr_unpackp('MediaItem_Take*',r),float(t[0].value))
def BR_TrackAtMouseCursor(contextOut,positionOut):
"""
Python: (MediaTrack retval, Int contextOut, Float positionOut) = BR_TrackAtMouseCursor(contextOut, positionOut)
[BR] Get track under mouse cursor.
Context signifies where the track was found: 0 = TCP, 1 = MCP, 2 = Arrange.
Position will hold mouse cursor position in arrange if applicable.
"""
a=rpr_getfp('BR_TrackAtMouseCursor')
f=CFUNCTYPE(c_uint64,c_void_p,c_void_p)(a)
t=(c_int(contextOut),c_double(positionOut))
r=f(byref(t[0]),byref(t[1]))
return (rpr_unpackp('MediaTrack*',r),int(t[0].value),float(t[1].value))
def BR_TrackFX_GetFXModuleName(track,fx,nameOut,nameOutSz):
"""
Python: (Boolean retval, MediaTrack track, Int fx, String nameOut, Int nameOutSz) = BR_TrackFX_GetFXModuleName(track, fx, nameOut, nameOutSz)
[BR] Get the exact name (like effect.dll, effect.vst3, etc...) of an FX.
"""
a=rpr_getfp('BR_TrackFX_GetFXModuleName')
f=CFUNCTYPE(c_byte,c_uint64,c_int,c_char_p,c_int)(a)
t=(rpr_packp('MediaTrack*',track),c_int(fx),rpr_packs(nameOut),c_int(nameOutSz))
r=f(t[0],t[1],t[2],t[3])
return (r,track,fx,rpr_unpacks(t[2]),nameOutSz)
def BR_Win32_GetPrivateProfileString(sectionName,keyName,defaultString,filePath,stringOut,stringOut_sz):
"""
Python: (Int retval, String sectionName, String keyName, String defaultString, String filePath, String stringOut, Int stringOut_sz) = BR_Win32_GetPrivateProfileString(sectionName, keyName, defaultString, filePath, stringOut, stringOut_sz)
[BR] Equivalent to win32 API GetPrivateProfileString(). For example, you can use this to get values from REAPER.ini
"""
a=rpr_getfp('BR_Win32_GetPrivateProfileString')
f=CFUNCTYPE(c_int,c_char_p,c_char_p,c_char_p,c_char_p,c_char_p,c_int)(a)
t=(rpr_packsc(sectionName),rpr_packsc(keyName),rpr_packsc(defaultString),rpr_packsc(filePath),rpr_packs(stringOut),c_int(stringOut_sz))
r=f(t[0],t[1],t[2],t[3],t[4],t[5])
return (r,sectionName,keyName,defaultString,filePath,rpr_unpacks(t[4]),stringOut_sz)
def BR_Win32_ShellExecute(operation,file,parameters,directory,showFlags):
"""
Python: Int BR_Win32_ShellExecute(String operation, String file, String parameters, String directory, Int showFlags)
[BR] Equivalent to win32 API ShellExecute() with HWND set to main window
"""
a=rpr_getfp('BR_Win32_ShellExecute')
f=CFUNCTYPE(c_int,c_char_p,c_char_p,c_char_p,c_char_p,c_int)(a)
t=(rpr_packsc(operation),rpr_packsc(file),rpr_packsc(parameters),rpr_packsc(directory),c_int(showFlags))
r=f(t[0],t[1],t[2],t[3],t[4])
return r
def BR_Win32_WritePrivateProfileString(sectionName,keyName,value,filePath):
"""
Python: Boolean BR_Win32_WritePrivateProfileString(String sectionName, String keyName, String value, String filePath)
[BR] Equivalent to win32 API WritePrivateProfileString(). For example, you can use this to write to REAPER.ini
"""
a=rpr_getfp('BR_Win32_WritePrivateProfileString')
f=CFUNCTYPE(c_byte,c_char_p,c_char_p,c_char_p,c_char_p)(a)
t=(rpr_packsc(sectionName),rpr_packsc(keyName),rpr_packsc(value),rpr_packsc(filePath))
r=f(t[0],t[1],t[2],t[3])
return r
def CF_GetClipboard(buf,buf_sz):
"""
Python: (String buf, Int buf_sz) = CF_GetClipboard(buf, buf_sz)
Read the contents of the system clipboard (limited to 1023 characters in Lua).
"""
a=rpr_getfp('CF_GetClipboard')
f=CFUNCTYPE(None,c_char_p,c_int)(a)
t=(rpr_packs(buf),c_int(buf_sz))
f(t[0],t[1])
return (rpr_unpacks(t[0]),buf_sz)
def CF_GetClipboardBig(output):
"""
Python: String CF_GetClipboardBig(WDL_FastString output)
Read the contents of the system clipboard. See SNM_CreateFastString
and SNM_DeleteFastString
.
"""
a=rpr_getfp('CF_GetClipboardBig')
f=CFUNCTYPE(c_char_p,c_uint64)(a)
t=(rpr_packp('WDL_FastString*',output),)
r=f(t[0])
return str(r.decode())
def CF_SetClipboard(Str):
"""
Python: CF_SetClipboard(String str)
Write the given string into the system clipboard.
"""
a=rpr_getfp('CF_SetClipboard')