diff --git a/CHANGELOG.md b/CHANGELOG.md index 0da01fce..8a620f2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ UNRELEASED +Note: This release bumps the minimum required REAPER version from v6.11 to v6.37 * Fix occasional crash bug in start up of Binaural Monitoring plugin [#277](https://github.com/ebu/ear-production-suite/issues/277) [#278](https://github.com/ebu/ear-production-suite/pull/278) +* Fix fail to render when non-VST plugins are in FX chains [#279](https://github.com/ebu/ear-production-suite/issues/279) [#280](https://github.com/ebu/ear-production-suite/pull/280) Version 1.1.0b diff --git a/reaper-adm-extension/src/reaper_adm/reaper_plugin_functions.h b/reaper-adm-extension/src/reaper_adm/reaper_plugin_functions.h index 6aea01ad..fd2a1bc2 100644 --- a/reaper-adm-extension/src/reaper_adm/reaper_plugin_functions.h +++ b/reaper-adm-extension/src/reaper_adm/reaper_plugin_functions.h @@ -1,8 +1,15 @@ +/* +* PLEASE NOTE! +* This is a MODIFIED version of the v6.37 header!!! +* It addresses this bug; +* https://forum.cockos.com/showthread.php?p=2548853 +*/ + #ifndef _REAPER_PLUGIN_FUNCTIONS_H_ #define _REAPER_PLUGIN_FUNCTIONS_H_ // REAPER API functions -// Generated by REAPER v6.11/x64 +// Generated by REAPER v6.37/win64 /* * Copyright 2006 and later, Cockos Incorporated @@ -461,7 +468,7 @@ REAPERAPI_DEF //============================================== // CountTracks // count the number of tracks in the project (proj=0 for active project) - int (*CountTracks)(ReaProject* proj); + int (*CountTracks)(ReaProject* projOptional); #endif #if defined(REAPERAPI_WANT_CreateLocalOscHandler) || !defined(REAPERAPI_MINIMAL) @@ -1118,7 +1125,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_EnumerateFiles) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // EnumerateFiles -// List the files in the "path" directory. Returns NULL (or empty string, in Lua) when all files have been listed. See EnumerateSubdirectories +// List the files in the "path" directory. Returns NULL/nil when all files have been listed. Use fileindex = -1 to force re-read of directory (invalidate cache). See EnumerateSubdirectories const char* (*EnumerateFiles)(const char* path, int fileindex); #endif @@ -1126,7 +1133,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_EnumerateSubdirectories) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // EnumerateSubdirectories -// List the subdirectories in the "path" directory. Returns NULL (or empty string, in Lua) when all subdirectories have been listed. See EnumerateFiles +// List the subdirectories in the "path" directory. Use subdirindex = -1 to force re-read of directory (invalidate cache). Returns NULL/nil when all subdirectories have been listed. See EnumerateFiles const char* (*EnumerateSubdirectories)(const char* path, int subdirindex); #endif @@ -1392,6 +1399,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_GetAppVersion) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // GetAppVersion +// Returns app version which may include an OS/arch signifier, such as: "6.17" (windows 32-bit), "6.17/x64" (windows 64-bit), "6.17/OSX64" (macOS 64-bit Intel), "6.17/OSX" (macOS 32-bit), "6.17/macOS-arm64", "6.17/linux-x86_64", "6.17/linux-i686", "6.17/linux-aarch64", "6.17/linux-armv7l", etc const char* (*GetAppVersion)(); #endif @@ -1452,7 +1460,7 @@ REAPERAPI_DEF //============================================== // GetAudioDeviceInfo // get information about the currently open audio device. attribute can be MODE, IDENT_IN, IDENT_OUT, BSIZE, SRATE, BPS. returns false if unknown attribute or device not open. - bool (*GetAudioDeviceInfo)(const char* attribute, char* desc, int desc_sz); + bool (*GetAudioDeviceInfo)(const char* attribute, char* descOut, int descOut_sz); #endif #if defined(REAPERAPI_WANT_GetColorTheme) || !defined(REAPERAPI_MINIMAL) @@ -1547,9 +1555,20 @@ REAPERAPI_DEF //============================================== REAPERAPI_DEF //============================================== // GetEnvelopeInfo_Value // Gets an envelope numerical-value attribute: -// I_TCPY : int *, Y offset of envelope relative to parent track (may be separate lane or overlap with track contents)I_TCPH : int *, visible height of envelopeI_TCPY_USED : int *, Y offset of envelope relative to parent track, exclusive of paddingI_TCPH_USED : int *, visible height of envelope, exclusive of paddingP_TRACK : MediaTrack *, parent track pointer (if any)P_ITEM : MediaItem *, parent item pointer (if any)P_TAKE : MediaItem_Take *, parent take pointer (if any) +// I_TCPY : int : Y offset of envelope relative to parent track (may be separate lane or overlap with track contents) +// I_TCPH : int : visible height of envelope +// I_TCPY_USED : int : Y offset of envelope relative to parent track, exclusive of padding +// I_TCPH_USED : int : visible height of envelope, exclusive of padding +// P_TRACK : MediaTrack * : parent track pointer (if any) +// P_DESTTRACK : MediaTrack * : destination track pointer, if on a send +// P_ITEM : MediaItem * : parent item pointer (if any) +// P_TAKE : MediaItem_Take * : parent take pointer (if any) +// I_SEND_IDX : int : 1-based index of send in P_TRACK, or 0 if not a send +// I_HWOUT_IDX : int : 1-based index of hardware output in P_TRACK or 0 if not a hardware output +// I_RECV_IDX : int : 1-based index of receive in P_DESTTRACK or 0 if not a send/receive +// - double (*GetEnvelopeInfo_Value)(TrackEnvelope* tr, const char* parmname); + double (*GetEnvelopeInfo_Value)(TrackEnvelope* env, const char* parmname); #endif #if defined(REAPERAPI_WANT_GetEnvelopeName) || !defined(REAPERAPI_MINIMAL) @@ -1636,11 +1655,19 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_GetFocusedFX) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // GetFocusedFX -// Returns 1 if a track FX window has focus or was the last focused and still open, 2 if an item FX window has focus or was the last focused and still open, 0 if no FX window has focus. tracknumber==0 means the master track, 1 means track 1, etc. itemnumber and fxnumber are zero-based. If item FX, fxnumber will have the high word be the take index, the low word the FX index. See GetLastTouchedFX. +// This function is deprecated (returns GetFocusedFX2()&3), see GetFocusedFX2. int (*GetFocusedFX)(int* tracknumberOut, int* itemnumberOut, int* fxnumberOut); #endif +#if defined(REAPERAPI_WANT_GetFocusedFX2) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// GetFocusedFX2 +// Return value has 1 set if track FX, 2 if take/item FX, 4 set if FX is no longer focused but still open. tracknumber==0 means the master track, 1 means track 1, etc. itemnumber is zero-based (or -1 if not an item). For interpretation of fxnumber, see GetLastTouchedFX. + + int (*GetFocusedFX2)(int* tracknumberOut, int* itemnumberOut, int* fxnumberOut); +#endif + #if defined(REAPERAPI_WANT_GetFreeDiskSpaceForRecordPath) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // GetFreeDiskSpaceForRecordPath @@ -1723,7 +1750,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_GetItemFromPoint) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // GetItemFromPoint -// Returns the first item at the screen coordinates specified. If allow_locked is false, locked items are ignored. If takeOutOptional specified, returns the take hit. +// Returns the first item at the screen coordinates specified. If allow_locked is false, locked items are ignored. If takeOutOptional specified, returns the take hit. See GetThingFromPoint. MediaItem* (*GetItemFromPoint)(int screen_x, int screen_y, bool allow_locked, MediaItem_Take** takeOutOptional); #endif @@ -1761,7 +1788,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_GetLastTouchedFX) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // GetLastTouchedFX -// Returns true if the last touched FX parameter is valid, false otherwise. The low word of tracknumber is the 1-based track index -- 0 means the master track, 1 means track 1, etc. If the high word of tracknumber is nonzero, it refers to the 1-based item index (1 is the first item on the track, etc). For track FX, the low 24 bits of fxnumber refer to the FX index in the chain, and if the next 8 bits are 01, then the FX is record FX. For item FX, the low word defines the FX index in the chain, and the high word defines the take number. See GetFocusedFX. +// Returns true if the last touched FX parameter is valid, false otherwise. The low word of tracknumber is the 1-based track index -- 0 means the master track, 1 means track 1, etc. If the high word of tracknumber is nonzero, it refers to the 1-based item index (1 is the first item on the track, etc). For track FX, the low 24 bits of fxnumber refer to the FX index in the chain, and if the next 8 bits are 01, then the FX is record FX. For item FX, the low word defines the FX index in the chain, and the high word defines the take number. bool (*GetLastTouchedFX)(int* tracknumberOut, int* fxnumberOut, int* paramnumberOut); #endif @@ -1798,7 +1825,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_GetMasterTrackVisibility) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // GetMasterTrackVisibility -// returns &1 if the master track is visible in the TCP, &2 if visible in the mixer. See SetMasterTrackVisibility. +// returns &1 if the master track is visible in the TCP, &2 if NOT visible in the mixer. See SetMasterTrackVisibility. int (*GetMasterTrackVisibility)(); #endif @@ -1818,6 +1845,14 @@ REAPERAPI_DEF //============================================== int (*GetMaxMidiOutputs)(); #endif +#if defined(REAPERAPI_WANT_GetMediaFileMetadata) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// GetMediaFileMetadata +// Get text-based metadata from a media file for a given identifier. Call with identifier="" to list all identifiers contained in the file, separated by newlines. May return "[Binary data]" for metadata that REAPER doesn't handle. + + int (*GetMediaFileMetadata)(PCM_source* mediaSource, const char* identifier, char* bufOutNeedBig, int bufOutNeedBig_sz); +#endif + #if defined(REAPERAPI_WANT_GetMediaItem) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // GetMediaItem @@ -1838,7 +1873,9 @@ REAPERAPI_DEF //============================================== REAPERAPI_DEF //============================================== // GetMediaItemInfo_Value // Get media item numerical-value attributes. -// B_MUTE : bool * : muted +// B_MUTE : bool * : muted (item solo overrides). setting this value will clear C_MUTE_SOLO. +// B_MUTE_ACTUAL : bool * : muted (ignores solo). setting this value will not affect C_MUTE_SOLO. +// C_MUTE_SOLO : char * : solo override (-1=soloed, 0=no override, 1=unsoloed). note that this API does not automatically unsolo other items when soloing (nor clear the unsolos when clearing the last soloed item), it must be done by the caller via action or via this API. // B_LOOPSRC : bool * : loop source // B_ALLTAKESPLAY : bool * : all takes play // B_UISEL : bool * : selected in arrange view @@ -1858,14 +1895,14 @@ REAPERAPI_DEF //============================================== // C_FADEINSHAPE : int * : fadein shape, 0..6, 0=linear // C_FADEOUTSHAPE : int * : fadeout shape, 0..6, 0=linear // I_GROUPID : int * : group ID, 0=no group -// I_LASTY : int * : Y-position of track in pixels (read-only) -// I_LASTH : int * : height in track in pixels (read-only) +// I_LASTY : int * : Y-position (relative to top of track) in pixels (read-only) +// I_LASTH : int * : height in pixels (read-only) // I_CUSTOMCOLOR : int * : custom color, OS dependent color|0x100000 (i.e. ColorToNative(r,g,b)|0x100000). If you do not |0x100000, then it will not be used, but will store the color // I_CURTAKE : int * : active take number -// IP_ITEMNUMBER : int, item number on this track (read-only, returns the item number directly) +// IP_ITEMNUMBER : int : item number on this track (read-only, returns the item number directly) // F_FREEMODE_Y : float * : free item positioning Y-position, 0=top of track, 1=bottom of track (will never be 1) // F_FREEMODE_H : float * : free item positioning height, 0=no height, 1=full height of track (will never be 0) -// P_TRACK : MediaTrack * (read-only) +// P_TRACK : MediaTrack * : (read-only) // double (*GetMediaItemInfo_Value)(MediaItem* item, const char* parmname); @@ -1935,6 +1972,8 @@ REAPERAPI_DEF //============================================== // D_PLAYRATE : double * : take playback rate, 0.5=half speed, 1=normal, 2=double speed, etc // D_PITCH : double * : take pitch adjustment in semitones, -12=one octave down, 0=normal, +12=one octave up, etc // B_PPITCH : bool * : preserve pitch when changing playback rate +// I_LASTY : int * : Y-position (relative to top of track) in pixels (read-only) +// I_LASTH : int * : height in pixels (read-only) // I_CHANMODE : int * : channel mode, 0=normal, 1=reverse stereo, 2=downmix, 3=left, 4=right // I_PITCHMODE : int * : pitch shifter mode, -1=projext default, otherwise high 2 bytes=shifter, low 2 bytes=parameter // I_CUSTOMCOLOR : int * : custom color, OS dependent color|0x100000 (i.e. ColorToNative(r,g,b)|0x100000). If you do not |0x100000, then it will not be used, but will store the color @@ -1959,7 +1998,7 @@ REAPERAPI_DEF //============================================== // GetMediaSourceFileName // Copies the media source filename to typebuf. Note that in-project MIDI media sources have no associated filename. See GetMediaSourceParent. - void (*GetMediaSourceFileName)(PCM_source* source, char* filenamebuf, int filenamebuf_sz); + void (*GetMediaSourceFileName)(PCM_source* source, char* filenamebufOut, int filenamebufOut_sz); #endif #if defined(REAPERAPI_WANT_GetMediaSourceLength) || !defined(REAPERAPI_MINIMAL) @@ -1999,7 +2038,7 @@ REAPERAPI_DEF //============================================== // GetMediaSourceType // copies the media source type ("WAV", "MIDI", etc) to typebuf - void (*GetMediaSourceType)(PCM_source* source, char* typebuf, int typebuf_sz); + void (*GetMediaSourceType)(PCM_source* source, char* typebufOut, int typebufOut_sz); #endif #if defined(REAPERAPI_WANT_GetMediaTrackInfo_Value) || !defined(REAPERAPI_MINIMAL) @@ -2008,14 +2047,18 @@ REAPERAPI_DEF //============================================== // Get track numerical-value attributes. // B_MUTE : bool * : muted // B_PHASE : bool * : track phase inverted +// B_RECMON_IN_EFFECT : bool * : record monitoring in effect (current audio-thread playback state, read-only) // IP_TRACKNUMBER : int : track number 1-based, 0=not found, -1=master track (read-only, returns the int directly) // I_SOLO : int * : soloed, 0=not soloed, 1=soloed, 2=soloed in place, 5=safe soloed, 6=safe soloed in place +// B_SOLO_DEFEAT : bool * : when set, if anything else is soloed and this track is not muted, this track acts soloed // I_FXEN : int * : fx enabled, 0=bypassed, !0=fx active // I_RECARM : int * : record armed, 0=not record armed, 1=record armed -// I_RECINPUT : int * : record input, <0=no input, 0..n=mono hardware input, 512+n=rearoute input, &1024=stereo input pair. &4096=MIDI input, if set then low 5 bits represent channel (0=all, 1-16=only chan), next 6 bits represent physical input (63=all, 62=VKB) +// I_RECINPUT : int * : record input, <0=no input. if 4096 set, input is MIDI and low 5 bits represent channel (0=all, 1-16=only chan), next 6 bits represent physical input (63=all, 62=VKB). If 4096 is not set, low 10 bits (0..1023) are input start channel (ReaRoute/Loopback start at 512). If 2048 is set, input is multichannel input (using track channel count), or if 1024 is set, input is stereo input, otherwise input is mono. // I_RECMODE : int * : record mode, 0=input, 1=stereo out, 2=none, 3=stereo out w/latency compensation, 4=midi output, 5=mono out, 6=mono out w/ latency compensation, 7=midi overdub, 8=midi replace // I_RECMON : int * : record monitoring, 0=off, 1=normal, 2=not when playing (tape style) // I_RECMONITEMS : int * : monitor items while recording, 0=off, 1=on +// B_AUTO_RECARM : bool * : automatically set record arm when selected (does not immediately affect recarm state, script should set directly if desired) +// I_VUMODE : int * : track vu mode, &1=disabled, 0=stereo peaks, 2=multichannel peaks, 4=stereo RMS, 8=combined RMS, 12=LUFS-M, 16=LUFS-S (readout=max), 20=LUFS-S (readout=current) // I_AUTOMODE : int * : track automation mode, 0=trim/off, 1=read, 2=touch, 3=write, 4=latch // I_NCHAN : int * : number of track channels, 2-64, even numbers only // I_SELECTED : int * : track selected, 0=unselected, 1=selected @@ -2040,15 +2083,18 @@ REAPERAPI_DEF //============================================== // D_DUALPANR : double * : dualpan position 2, -1..1, only if I_PANMODE==6 // I_PANMODE : int * : pan mode, 0=classic 3.x, 3=new balance, 5=stereo pan, 6=dual pan // D_PANLAW : double * : pan law of track, <0=project default, 1=+0dB, etc -// P_ENV:0 for hardware outputs // sendidx is 0..n (to enumerate, iterate over sendidx until it returns NULL) // parameter names: -// P_DESTTRACK : read only, returns MediaTrack *, destination track, only applies for sends/recvs -// P_SRCTRACK : read only, returns MediaTrack *, source track, only applies for sends/recvs -// P_ENV:0 for hardware outputs // parameter names: // B_MUTE : bool * -// B_PHASE : bool *, true to flip phase +// B_PHASE : bool * : true to flip phase // B_MONO : bool * -// D_VOL : double *, 1.0 = +0dB etc -// D_PAN : double *, -1..+1 -// D_PANLAW : double *,1.0=+0.0db, 0.5=-6dB, -1.0 = projdef etc -// I_SENDMODE : int *, 0=post-fader, 1=pre-fx, 2=post-fx (deprecated), 3=post-fx +// D_VOL : double * : 1.0 = +0dB etc +// D_PAN : double * : -1..+1 +// D_PANLAW : double * : 1.0=+0.0db, 0.5=-6dB, -1.0 = projdef etc +// I_SENDMODE : int * : 0=post-fader, 1=pre-fx, 2=post-fx (deprecated), 3=post-fx // I_AUTOMODE : int * : automation mode (-1=use track automode, 0=trim/off, 1=read, 2=touch, 3=write, 4=latch) -// I_SRCCHAN : int *, index,&1024=mono, -1 for none -// I_DSTCHAN : int *, index, &1024=mono, otherwise stereo pair, hwout:&512=rearoute -// I_MIDIFLAGS : int *, low 5 bits=source channel 0=all, 1-16, next 5 bits=dest channel, 0=orig, 1-16=chanP_DESTTRACK : read only, returns MediaTrack *, destination track, only applies for sends/recvs -// P_SRCTRACK : read only, returns MediaTrack *, source track, only applies for sends/recvs -// P_ENV:=0 for hw ouputs, >=nb_of_hw_ouputs for sends. See GetTrackReceiveName. - bool (*GetTrackSendName)(MediaTrack* track, int send_index, char* buf, int buf_sz); + bool (*GetTrackSendName)(MediaTrack* track, int send_index, char* bufOut, int bufOut_sz); #endif #if defined(REAPERAPI_WANT_GetTrackSendUIMute) || !defined(REAPERAPI_MINIMAL) @@ -3441,7 +3524,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_InsertMedia) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // InsertMedia -// mode: 0=add to current track, 1=add new track, 3=add to selected items as takes, &4=stretch/loop to fit time sel, &8=try to match tempo 1x, &16=try to match tempo 0.5x, &32=try to match tempo 2x, &64=don't preserve pitch when matching tempo, &128=no loop/section if startpct/endpct set, &256=force loop regardless of global preference for looping imported items. &512=use high word as absolute track index if mode&3==0. +// mode: 0=add to current track, 1=add new track, 3=add to selected items as takes, &4=stretch/loop to fit time sel, &8=try to match tempo 1x, &16=try to match tempo 0.5x, &32=try to match tempo 2x, &64=don't preserve pitch when matching tempo, &128=no loop/section if startpct/endpct set, &256=force loop regardless of global preference for looping imported items, &512=use high word as absolute track index if mode&3==0, &1024=insert into reasamplomatic on a new track, &2048=insert into open reasamplomatic instance, &4096=move to source preferred position (BWF start offset), &8192=reverse int (*InsertMedia)(const char* file, int mode); #endif @@ -3449,6 +3532,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_InsertMediaSection) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // InsertMediaSection +// See InsertMedia. int (*InsertMediaSection)(const char* file, int mode, double startpct, double endpct, double pitchshift); #endif @@ -4040,6 +4124,15 @@ REAPERAPI_DEF //============================================== void (*LICE_SimpleFill)(LICE_IBitmap* dest, int x, int y, LICE_pixel newcolor, LICE_pixel comparemask, LICE_pixel keepmask); #endif +// START MODIFIED SECTION - MISSING FROM ORIGINAL 6.37 HEADER!!! FIXES https://forum.cockos.com/showthread.php?p=2548853 +#if defined(REAPERAPI_WANT_LICE_ThickFLine) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// LICE_ThickFLine + +void (*LICE_ThickFLine)(LICE_IBitmap* dest, double x1, double y1, double x2, double y2, LICE_pixel color, float alpha, int mode, int wid); +#endif +// END MODIFIED SECTION + #endif // !REAPERAPI_NO_LICE #if defined(REAPERAPI_WANT_LocalizeString) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== @@ -4274,7 +4367,7 @@ REAPERAPI_DEF //============================================== // For tick intervals longer than a 32 bit word can represent, zero-length meta events may be placed between valid events. // See MIDI_SetAllEvts. - bool (*MIDI_GetAllEvts)(MediaItem_Take* take, char* bufNeedBig, int* bufNeedBig_sz); + bool (*MIDI_GetAllEvts)(MediaItem_Take* take, char* bufOutNeedBig, int* bufOutNeedBig_sz); #endif #if defined(REAPERAPI_WANT_MIDI_GetCC) || !defined(REAPERAPI_MINIMAL) @@ -4298,7 +4391,7 @@ REAPERAPI_DEF //============================================== // MIDI_GetEvt // Get MIDI event properties. - bool (*MIDI_GetEvt)(MediaItem_Take* take, int evtidx, bool* selectedOut, bool* mutedOut, double* ppqposOut, char* msg, int* msg_sz); + bool (*MIDI_GetEvt)(MediaItem_Take* take, int evtidx, bool* selectedOut, bool* mutedOut, double* ppqposOut, char* msgOut, int* msgOut_sz); #endif #if defined(REAPERAPI_WANT_MIDI_GetGrid) || !defined(REAPERAPI_MINIMAL) @@ -4314,7 +4407,7 @@ REAPERAPI_DEF //============================================== // MIDI_GetHash // Get a string that only changes when the MIDI data changes. If notesonly==true, then the string changes only when the MIDI notes change. See MIDI_GetTrackHash - bool (*MIDI_GetHash)(MediaItem_Take* take, bool notesonly, char* hash, int hash_sz); + bool (*MIDI_GetHash)(MediaItem_Take* take, bool notesonly, char* hashOut, int hashOut_sz); #endif #if defined(REAPERAPI_WANT_MIDI_GetNote) || !defined(REAPERAPI_MINIMAL) @@ -4378,7 +4471,7 @@ REAPERAPI_DEF //============================================== // MIDI_GetScale // Get the active scale in the media source, if any. root 0=C, 1=C#, etc. scale &0x1=root, &0x2=minor 2nd, &0x4=major 2nd, &0x8=minor 3rd, &0xF=fourth, etc. - bool (*MIDI_GetScale)(MediaItem_Take* take, int* rootOut, int* scaleOut, char* name, int name_sz); + bool (*MIDI_GetScale)(MediaItem_Take* take, int* rootOut, int* scaleOut, char* nameOut, int nameOut_sz); #endif #if defined(REAPERAPI_WANT_MIDI_GetTextSysexEvt) || !defined(REAPERAPI_MINIMAL) @@ -4394,7 +4487,7 @@ REAPERAPI_DEF //============================================== // MIDI_GetTrackHash // Get a string that only changes when the MIDI data changes. If notesonly==true, then the string changes only when the MIDI notes change. See MIDI_GetHash - bool (*MIDI_GetTrackHash)(MediaTrack* track, bool notesonly, char* hash, int hash_sz); + bool (*MIDI_GetTrackHash)(MediaTrack* track, bool notesonly, char* hashOut, int hashOut_sz); #endif #if defined(REAPERAPI_WANT_MIDI_InsertCC) || !defined(REAPERAPI_MINIMAL) @@ -4516,6 +4609,14 @@ REAPERAPI_DEF //============================================== void (*MIDI_Sort)(MediaItem_Take* take); #endif +#if defined(REAPERAPI_WANT_MIDIEditor_EnumTakes) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// MIDIEditor_EnumTakes +// list the takes that are currently being edited in this MIDI editor, starting with the active take. See MIDIEditor_GetTake + + MediaItem_Take* (*MIDIEditor_EnumTakes)(HWND midieditor, int takeindex, bool editable_only); +#endif + #if defined(REAPERAPI_WANT_MIDIEditor_GetActive) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // MIDIEditor_GetActive @@ -4569,7 +4670,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_MIDIEditor_GetTake) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // MIDIEditor_GetTake -// get the take that is currently being edited in this MIDI editor +// get the take that is currently being edited in this MIDI editor. see MIDIEditor_EnumTakes MediaItem_Take* (*MIDIEditor_GetTake)(HWND midieditor); #endif @@ -4826,6 +4927,14 @@ REAPERAPI_DEF //============================================== HWND (*PCM_Sink_ShowConfig)(const char* cfg, int cfg_sz, HWND hwndParent); #endif +#if defined(REAPERAPI_WANT_PCM_Source_BuildPeaks) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// PCM_Source_BuildPeaks +// Calls and returns PCM_source::PeaksBuild_Begin() if mode=0, PeaksBuild_Run() if mode=1, and PeaksBuild_Finish() if mode=2. Normal use is to call PCM_Source_BuildPeaks(src,0), and if that returns nonzero, call PCM_Source_BuildPeaks(src,1) repeatedly until it returns zero (it will process a block of time each time you call it, and return the percentage of the file remaining), then call PCM_Source_BuildPeaks(src,2) to finalize. If PCM_Source_BuildPeaks(src,0) returns zero, then no further action is necessary. + + int (*PCM_Source_BuildPeaks)(PCM_source* src, int mode); +#endif + #if defined(REAPERAPI_WANT_PCM_Source_CreateFromFile) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // PCM_Source_CreateFromFile @@ -4925,9 +5034,9 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_PlayPreviewEx) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // PlayPreviewEx -// return nonzero on success +// return nonzero on success. bufflags &1=buffer source, &2=treat length changes in source as varispeed and adjust internal state accordingly if buffering. measure_align<0=play immediately, >0=align playback with measure start - int (*PlayPreviewEx)(preview_register_t* preview, int bufflags, double MSI); + int (*PlayPreviewEx)(preview_register_t* preview, int bufflags, double measure_align); #endif #if defined(REAPERAPI_WANT_PlayTrackPreview) || !defined(REAPERAPI_MINIMAL) @@ -4949,9 +5058,9 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_PlayTrackPreview2Ex) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // PlayTrackPreview2Ex -// return nonzero on success,in these,m_out_chan is a track index (0-n) +// return nonzero on success,in these,m_out_chan is a track index (0-n). see PlayPreviewEx - int (*PlayTrackPreview2Ex)(ReaProject* proj, preview_register_t* preview, int flags, double msi); + int (*PlayTrackPreview2Ex)(ReaProject* proj, preview_register_t* preview, int flags, double measure_align); #endif #if defined(REAPERAPI_WANT_plugin_getapi) || !defined(REAPERAPI_MINIMAL) @@ -4980,48 +5089,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_plugin_register) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // plugin_register -// like rec->Register -// -// if you have a function called myfunction(..) that you want to expose to other extensions or plug-ins, -// use register("API_myfunction",funcaddress), and "-API_myfunction" to remove. -// Other extensions then use GetFunc("myfunction") to get the function pointer. -// REAPER will also export the function address to ReaScript, so your extension could supply -// a Python module that provides a wrapper called RPR_myfunction(..). -// register("APIdef_myfunction",defstring) will include your function declaration and help -// in the auto-generated REAPER API header and ReaScript documentation. -// defstring is four null-separated fields: return type, argument types, argument names, and help. -// Example: double myfunction(char* str, int flag) would have -// defstring="double\0char*,int\0str,flag\0help text for myfunction" -// -// another thing you can register is "hookcommand", which you pass a callback: -// NON_API: bool runCommand(int command, int flag); -// register("hookcommand",runCommand); -// which returns TRUE to eat (process) the command. -// flag is usually 0 but can sometimes have useful info depending on the message. -// note: it's OK to call Main_OnCommand() within your runCommand, however you MUST check for recursion if doing so! -// in fact, any use of this hook should benefit from a simple reentrancy test... -// -// to get notified when an action of the main section is performed, -// you can register "hookpostcommand", which you pass a callback: -// NON_API: void postCommand(int command, int flag); -// register("hookpostcommand",postCommand); -// -// you can also register "hookcommand2", which you pass a callback: -// NON_API: bool onAction(KbdSectionInfo *sec, int command, int val, int valhw, int relmode, HWND hwnd); -// register("hookcommand2",onAction); -// which returns TRUE to eat (process) the command. -// val/valhw are used for actions learned with MIDI/OSC. -// val = [0..127] and valhw = -1 for MIDI CC, -// valhw >=0 for MIDI pitch or OSC with value = (valhw|val<<7)/16383.0, -// relmode absolute(0) or 1/2/3 for relative adjust modes -// -// you can also register command IDs for actions, -// register with "command_id", parameter is a unique string with only A-Z, 0-9, -// returns command ID (or 0 if not supported/out of actions) -// -// register("command_id_lookup", unique_string) will look up the integer ID of the named action -// without registering the string if it doesn't already exist. -// +// Alias for reaper_plugin_info_t::Register, see reaper_plugin.h for documented uses. int (*plugin_register)(const char* name, void* infostruct); #endif @@ -5056,6 +5124,14 @@ REAPERAPI_DEF //============================================== int (*projectconfig_var_getoffs)(const char* name, int* szOut); #endif +#if defined(REAPERAPI_WANT_PromptForAction) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// PromptForAction +// Uses the action list to choose an action. Call with session_mode=1 to create a session (init_id will be the initial action to select, or 0), then poll with session_mode=0, checking return value for user-selected action (will return 0 if no action selected yet, or -1 if the action window is no longer available). When finished, call with session_mode=-1. + + int (*PromptForAction)(int session_mode, int init_id, int section_id); +#endif + #if defined(REAPERAPI_WANT_realloc_cmd_ptr) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // realloc_cmd_ptr @@ -5075,7 +5151,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_ReaScriptError) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // ReaScriptError -// Causes REAPER to display the error message after the current ReaScript finishes. +// Causes REAPER to display the error message after the current ReaScript finishes. If called within a Lua context and errmsg has a ! prefix, script execution will be terminated. void (*ReaScriptError)(const char* errmsg); #endif @@ -5174,6 +5250,14 @@ REAPERAPI_DEF //============================================== void (*resolve_fn2)(const char* in, char* out, int out_sz, const char* checkSubDirOptional); #endif +#if defined(REAPERAPI_WANT_ResolveRenderPattern) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// ResolveRenderPattern +// Resolve a wildcard pattern into a set of nul-separated, double-nul terminated render target filenames. Returns the length of the string buffer needed for the returned file list. Call with path=NULL to suppress filtering out illegal pathnames, call with targets=NULL to get just the string buffer length. + + int (*ResolveRenderPattern)(ReaProject* project, const char* path, const char* pattern, char* targets, int targets_sz); +#endif + #if defined(REAPERAPI_WANT_ReverseNamedCommandLookup) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // ReverseNamedCommandLookup @@ -5364,7 +5448,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_SetMasterTrackVisibility) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // SetMasterTrackVisibility -// set &1 to show the master track in the TCP, &2 to show in the mixer. Returns the previous visibility state. See GetMasterTrackVisibility. +// set &1 to show the master track in the TCP, &2 to HIDE in the mixer. Returns the previous visibility state. See GetMasterTrackVisibility. int (*SetMasterTrackVisibility)(int flag); #endif @@ -5373,7 +5457,9 @@ REAPERAPI_DEF //============================================== REAPERAPI_DEF //============================================== // SetMediaItemInfo_Value // Set media item numerical-value attributes. -// B_MUTE : bool * : muted +// B_MUTE : bool * : muted (item solo overrides). setting this value will clear C_MUTE_SOLO. +// B_MUTE_ACTUAL : bool * : muted (ignores solo). setting this value will not affect C_MUTE_SOLO. +// C_MUTE_SOLO : char * : solo override (-1=soloed, 0=no override, 1=unsoloed). note that this API does not automatically unsolo other items when soloing (nor clear the unsolos when clearing the last soloed item), it must be done by the caller via action or via this API. // B_LOOPSRC : bool * : loop source // B_ALLTAKESPLAY : bool * : all takes play // B_UISEL : bool * : selected in arrange view @@ -5393,11 +5479,11 @@ REAPERAPI_DEF //============================================== // C_FADEINSHAPE : int * : fadein shape, 0..6, 0=linear // C_FADEOUTSHAPE : int * : fadeout shape, 0..6, 0=linear // I_GROUPID : int * : group ID, 0=no group -// I_LASTY : int * : Y-position of track in pixels (read-only) -// I_LASTH : int * : height in track in pixels (read-only) +// I_LASTY : int * : Y-position (relative to top of track) in pixels (read-only) +// I_LASTH : int * : height in pixels (read-only) // I_CUSTOMCOLOR : int * : custom color, OS dependent color|0x100000 (i.e. ColorToNative(r,g,b)|0x100000). If you do not |0x100000, then it will not be used, but will store the color // I_CURTAKE : int * : active take number -// IP_ITEMNUMBER : int, item number on this track (read-only, returns the item number directly) +// IP_ITEMNUMBER : int : item number on this track (read-only, returns the item number directly) // F_FREEMODE_Y : float * : free item positioning Y-position, 0=top of track, 1=bottom of track (will never be 1) // F_FREEMODE_H : float * : free item positioning height, 0=no height, 1=full height of track (will never be 0) // @@ -5449,6 +5535,8 @@ REAPERAPI_DEF //============================================== // D_PLAYRATE : double * : take playback rate, 0.5=half speed, 1=normal, 2=double speed, etc // D_PITCH : double * : take pitch adjustment in semitones, -12=one octave down, 0=normal, +12=one octave up, etc // B_PPITCH : bool * : preserve pitch when changing playback rate +// I_LASTY : int * : Y-position (relative to top of track) in pixels (read-only) +// I_LASTH : int * : height in pixels (read-only) // I_CHANMODE : int * : channel mode, 0=normal, 1=reverse stereo, 2=downmix, 3=left, 4=right // I_PITCHMODE : int * : pitch shifter mode, -1=projext default, otherwise high 2 bytes=shifter, low 2 bytes=parameter // I_CUSTOMCOLOR : int * : custom color, OS dependent color|0x100000 (i.e. ColorToNative(r,g,b)|0x100000). If you do not |0x100000, then it will not be used, but will store the color @@ -5464,14 +5552,18 @@ REAPERAPI_DEF //============================================== // Set track numerical-value attributes. // B_MUTE : bool * : muted // B_PHASE : bool * : track phase inverted +// B_RECMON_IN_EFFECT : bool * : record monitoring in effect (current audio-thread playback state, read-only) // IP_TRACKNUMBER : int : track number 1-based, 0=not found, -1=master track (read-only, returns the int directly) // I_SOLO : int * : soloed, 0=not soloed, 1=soloed, 2=soloed in place, 5=safe soloed, 6=safe soloed in place +// B_SOLO_DEFEAT : bool * : when set, if anything else is soloed and this track is not muted, this track acts soloed // I_FXEN : int * : fx enabled, 0=bypassed, !0=fx active // I_RECARM : int * : record armed, 0=not record armed, 1=record armed -// I_RECINPUT : int * : record input, <0=no input, 0..n=mono hardware input, 512+n=rearoute input, &1024=stereo input pair. &4096=MIDI input, if set then low 5 bits represent channel (0=all, 1-16=only chan), next 6 bits represent physical input (63=all, 62=VKB) +// I_RECINPUT : int * : record input, <0=no input. if 4096 set, input is MIDI and low 5 bits represent channel (0=all, 1-16=only chan), next 6 bits represent physical input (63=all, 62=VKB). If 4096 is not set, low 10 bits (0..1023) are input start channel (ReaRoute/Loopback start at 512). If 2048 is set, input is multichannel input (using track channel count), or if 1024 is set, input is stereo input, otherwise input is mono. // I_RECMODE : int * : record mode, 0=input, 1=stereo out, 2=none, 3=stereo out w/latency compensation, 4=midi output, 5=mono out, 6=mono out w/ latency compensation, 7=midi overdub, 8=midi replace // I_RECMON : int * : record monitoring, 0=off, 1=normal, 2=not when playing (tape style) // I_RECMONITEMS : int * : monitor items while recording, 0=off, 1=on +// B_AUTO_RECARM : bool * : automatically set record arm when selected (does not immediately affect recarm state, script should set directly if desired) +// I_VUMODE : int * : track vu mode, &1=disabled, 0=stereo peaks, 2=multichannel peaks, 4=stereo RMS, 8=combined RMS, 12=LUFS-M, 16=LUFS-S (readout=max), 20=LUFS-S (readout=current) // I_AUTOMODE : int * : track automation mode, 0=trim/off, 1=read, 2=touch, 3=write, 4=latch // I_NCHAN : int * : number of track channels, 2-64, even numbers only // I_SELECTED : int * : track selected, 0=unselected, 1=selected @@ -5496,15 +5588,18 @@ REAPERAPI_DEF //============================================== // D_DUALPANR : double * : dualpan position 2, -1..1, only if I_PANMODE==6 // I_PANMODE : int * : pan mode, 0=classic 3.x, 3=new balance, 5=stereo pan, 6=dual pan // D_PANLAW : double * : pan law of track, <0=project default, 1=+0dB, etc -// P_ENV:0 for hardware outputs // parameter names: // B_MUTE : bool * -// B_PHASE : bool *, true to flip phase +// B_PHASE : bool * : true to flip phase // B_MONO : bool * -// D_VOL : double *, 1.0 = +0dB etc -// D_PAN : double *, -1..+1 -// D_PANLAW : double *,1.0=+0.0db, 0.5=-6dB, -1.0 = projdef etc -// I_SENDMODE : int *, 0=post-fader, 1=pre-fx, 2=post-fx (deprecated), 3=post-fx +// D_VOL : double * : 1.0 = +0dB etc +// D_PAN : double * : -1..+1 +// D_PANLAW : double * : 1.0=+0.0db, 0.5=-6dB, -1.0 = projdef etc +// I_SENDMODE : int * : 0=post-fader, 1=pre-fx, 2=post-fx (deprecated), 3=post-fx // I_AUTOMODE : int * : automation mode (-1=use track automode, 0=trim/off, 1=read, 2=touch, 3=write, 4=latch) -// I_SRCCHAN : int *, index,&1024=mono, -1 for none -// I_DSTCHAN : int *, index, &1024=mono, otherwise stereo pair, hwout:&512=rearoute -// I_MIDIFLAGS : int *, low 5 bits=source channel 0=all, 1-16, next 5 bits=dest channel, 0=orig, 1-16=chanSee CreateTrackSend, RemoveTrackSend, GetTrackNumSends. +// I_SRCCHAN : int * : index,&1024=mono, -1 for none +// I_DSTCHAN : int * : index, &1024=mono, otherwise stereo pair, hwout:&512=rearoute +// I_MIDIFLAGS : int * : low 5 bits=source channel 0=all, 1-16, next 5 bits=dest channel, 0=orig, 1-16=chan +// See CreateTrackSend, RemoveTrackSend, GetTrackNumSends. bool (*SetTrackSendInfo_Value)(MediaTrack* tr, int category, int sendidx, const char* parmname, double newvalue); #endif @@ -5883,7 +5979,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_TakeFX_AddByName) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // TakeFX_AddByName -// Adds or queries the position of a named FX in a take. Specify a negative value for instantiate to always create a new effect, 0 to only query the first instance of an effect, or a positive value to add an instance if one is not found. +// Adds or queries the position of a named FX in a take. See TrackFX_AddByName() for information on fxname and instantiate. int (*TakeFX_AddByName)(MediaItem_Take* take, const char* fxname, int instantiate); #endif @@ -5891,7 +5987,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_TakeFX_CopyToTake) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // TakeFX_CopyToTake -// Copies (or moves) FX from src_take to dest_take. Can be used with src_track=dest_track to reorder. +// Copies (or moves) FX from src_take to dest_take. Can be used with src_take=dest_take to reorder. void (*TakeFX_CopyToTake)(MediaItem_Take* src_take, int src_fx, MediaItem_Take* dest_take, int dest_fx, bool is_move); #endif @@ -5899,7 +5995,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_TakeFX_CopyToTrack) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // TakeFX_CopyToTrack -// Copies (or moves) FX from src_take to dest_track. dest_fx can have 0x1000000 set to reference input FX. +// Copies (or moves) FX from src_take to dest_track. dest_fx can have 0x1000000 set to reference input FX. void (*TakeFX_CopyToTrack)(MediaItem_Take* src_take, int src_fx, MediaTrack* dest_track, int dest_fx, bool is_move); #endif @@ -5924,7 +6020,7 @@ REAPERAPI_DEF //============================================== // TakeFX_FormatParamValue // Note: only works with FX that support Cockos VST extensions. - bool (*TakeFX_FormatParamValue)(MediaItem_Take* take, int fx, int param, double val, char* buf, int buf_sz); + bool (*TakeFX_FormatParamValue)(MediaItem_Take* take, int fx, int param, double val, char* bufOut, int bufOut_sz); #endif #if defined(REAPERAPI_WANT_TakeFX_FormatParamValueNormalized) || !defined(REAPERAPI_MINIMAL) @@ -5978,7 +6074,7 @@ REAPERAPI_DEF //============================================== REAPERAPI_DEF //============================================== // TakeFX_GetFormattedParamValue - bool (*TakeFX_GetFormattedParamValue)(MediaItem_Take* take, int fx, int param, char* buf, int buf_sz); + bool (*TakeFX_GetFormattedParamValue)(MediaItem_Take* take, int fx, int param, char* bufOut, int bufOut_sz); #endif #if defined(REAPERAPI_WANT_TakeFX_GetFXGUID) || !defined(REAPERAPI_MINIMAL) @@ -5992,7 +6088,7 @@ REAPERAPI_DEF //============================================== REAPERAPI_DEF //============================================== // TakeFX_GetFXName - bool (*TakeFX_GetFXName)(MediaItem_Take* take, int fx, char* buf, int buf_sz); + bool (*TakeFX_GetFXName)(MediaItem_Take* take, int fx, char* bufOut, int bufOut_sz); #endif #if defined(REAPERAPI_WANT_TakeFX_GetIOSize) || !defined(REAPERAPI_MINIMAL) @@ -6055,11 +6151,27 @@ REAPERAPI_DEF //============================================== double (*TakeFX_GetParamEx)(MediaItem_Take* take, int fx, int param, double* minvalOut, double* maxvalOut, double* midvalOut); #endif +#if defined(REAPERAPI_WANT_TakeFX_GetParamFromIdent) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// TakeFX_GetParamFromIdent +// gets the parameter index from an identifying string (:wet, :bypass, or a string returned from GetParamIdent), or -1 if unknown. + + int (*TakeFX_GetParamFromIdent)(MediaItem_Take* take, int fx, const char* ident_str); +#endif + +#if defined(REAPERAPI_WANT_TakeFX_GetParamIdent) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// TakeFX_GetParamIdent +// gets an identifying string for the parameter + + bool (*TakeFX_GetParamIdent)(MediaItem_Take* take, int fx, int param, char* bufOut, int bufOut_sz); +#endif + #if defined(REAPERAPI_WANT_TakeFX_GetParamName) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // TakeFX_GetParamName - bool (*TakeFX_GetParamName)(MediaItem_Take* take, int fx, int param, char* buf, int buf_sz); + bool (*TakeFX_GetParamName)(MediaItem_Take* take, int fx, int param, char* bufOut, int bufOut_sz); #endif #if defined(REAPERAPI_WANT_TakeFX_GetParamNormalized) || !defined(REAPERAPI_MINIMAL) @@ -6082,7 +6194,7 @@ REAPERAPI_DEF //============================================== // TakeFX_GetPreset // Get the name of the preset currently showing in the REAPER dropdown, or the full path to a factory preset file for VST3 plug-ins (.vstpreset). Returns false if the current FX parameters do not exactly match the preset (in other words, if the user loaded the preset but moved the knobs afterward). See TakeFX_SetPreset. - bool (*TakeFX_GetPreset)(MediaItem_Take* take, int fx, char* presetname, int presetname_sz); + bool (*TakeFX_GetPreset)(MediaItem_Take* take, int fx, char* presetnameOut, int presetnameOut_sz); #endif #if defined(REAPERAPI_WANT_TakeFX_GetPresetIndex) || !defined(REAPERAPI_MINIMAL) @@ -6097,7 +6209,7 @@ REAPERAPI_DEF //============================================== REAPERAPI_DEF //============================================== // TakeFX_GetUserPresetFilename - void (*TakeFX_GetUserPresetFilename)(MediaItem_Take* take, int fx, char* fn, int fn_sz); + void (*TakeFX_GetUserPresetFilename)(MediaItem_Take* take, int fx, char* fnOut, int fnOut_sz); #endif #if defined(REAPERAPI_WANT_TakeFX_NavigatePresets) || !defined(REAPERAPI_MINIMAL) @@ -6385,6 +6497,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_Track_GetPeakHoldDB) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // Track_GetPeakHoldDB +// Returns meter hold state, in dB*0.01 (0 = +0dB, -0.01 = -1dB, 0.02 = +2dB, etc). If clear is set, clears the meter hold. If channel==1024 or channel==1025, returns loudness values if this is the master track or this track's VU meters are set to display loudness. double (*Track_GetPeakHoldDB)(MediaTrack* track, int channel, bool clear); #endif @@ -6392,6 +6505,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_Track_GetPeakInfo) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // Track_GetPeakInfo +// Returns peak meter value (1.0=+0dB, 0.0=-inf) for channel. If channel==1024 or channel==1025, returns loudness values if this is the master track or this track's VU meters are set to display loudness. double (*Track_GetPeakInfo)(MediaTrack* track, int channel); #endif @@ -6407,7 +6521,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_TrackFX_AddByName) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // TrackFX_AddByName -// Adds or queries the position of a named FX from the track FX chain (recFX=false) or record input FX/monitoring FX (recFX=true, monitoring FX are on master track). Specify a negative value for instantiate to always create a new effect, 0 to only query the first instance of an effect, or a positive value to add an instance if one is not found. fxname can have prefix to specify type: VST3:,VST2:,VST:,AU:,JS:, or DX:. +// Adds or queries the position of a named FX from the track FX chain (recFX=false) or record input FX/monitoring FX (recFX=true, monitoring FX are on master track). Specify a negative value for instantiate to always create a new effect, 0 to only query the first instance of an effect, or a positive value to add an instance if one is not found. If instantiate is <= -1000, it is used for the insertion position (-1000 is first item in chain, -1001 is second, etc). fxname can have prefix to specify type: VST3:,VST2:,VST:,AU:,JS:, or DX:, or FXADD: which adds selected items from the currently-open FX browser, FXADD:2 to limit to 2 FX added, or FXADD:2e to only succeed if exactly 2 FX are selected. Returns -1 on failure or the new position in chain on success. int (*TrackFX_AddByName)(MediaTrack* track, const char* fxname, bool recFX, int instantiate); #endif @@ -6415,7 +6529,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_TrackFX_CopyToTake) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // TrackFX_CopyToTake -// Copies (or moves) FX from src_track to dest_take. src_fx can have 0x1000000 set to reference input FX. +// Copies (or moves) FX from src_track to dest_take. src_fx can have 0x1000000 set to reference input FX. void (*TrackFX_CopyToTake)(MediaTrack* src_track, int src_fx, MediaItem_Take* dest_take, int dest_fx, bool is_move); #endif @@ -6423,7 +6537,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_TrackFX_CopyToTrack) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // TrackFX_CopyToTrack -// Copies (or moves) FX from src_track to dest_track. Can be used with src_track=dest_track to reorder, FX indices have 0x1000000 set to reference input FX. +// Copies (or moves) FX from src_track to dest_track. Can be used with src_track=dest_track to reorder, FX indices have 0x1000000 set to reference input FX. void (*TrackFX_CopyToTrack)(MediaTrack* src_track, int src_fx, MediaTrack* dest_track, int dest_fx, bool is_move); #endif @@ -6448,7 +6562,7 @@ REAPERAPI_DEF //============================================== // TrackFX_FormatParamValue // Note: only works with FX that support Cockos VST extensions. - bool (*TrackFX_FormatParamValue)(MediaTrack* track, int fx, int param, double val, char* buf, int buf_sz); + bool (*TrackFX_FormatParamValue)(MediaTrack* track, int fx, int param, double val, char* bufOut, int bufOut_sz); #endif #if defined(REAPERAPI_WANT_TrackFX_FormatParamValueNormalized) || !defined(REAPERAPI_MINIMAL) @@ -6534,7 +6648,7 @@ REAPERAPI_DEF //============================================== REAPERAPI_DEF //============================================== // TrackFX_GetFormattedParamValue - bool (*TrackFX_GetFormattedParamValue)(MediaTrack* track, int fx, int param, char* buf, int buf_sz); + bool (*TrackFX_GetFormattedParamValue)(MediaTrack* track, int fx, int param, char* bufOut, int bufOut_sz); #endif #if defined(REAPERAPI_WANT_TrackFX_GetFXGUID) || !defined(REAPERAPI_MINIMAL) @@ -6548,7 +6662,7 @@ REAPERAPI_DEF //============================================== REAPERAPI_DEF //============================================== // TrackFX_GetFXName - bool (*TrackFX_GetFXName)(MediaTrack* track, int fx, char* buf, int buf_sz); + bool (*TrackFX_GetFXName)(MediaTrack* track, int fx, char* bufOut, int bufOut_sz); #endif #if defined(REAPERAPI_WANT_TrackFX_GetInstrument) || !defined(REAPERAPI_MINIMAL) @@ -6570,7 +6684,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_TrackFX_GetNamedConfigParm) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // TrackFX_GetNamedConfigParm -// gets plug-in specific named configuration value (returns true on success). Special values: 'pdc' returns PDC latency. 'in_pin_0' returns name of first input pin (if available), 'out_pin_0' returns name of first output pin (if available), etc. +// gets plug-in specific named configuration value (returns true on success). Special values: 'pdc' returns PDC latency. 'in_pin_0' returns name of first input pin (if available), 'out_pin_0' returns name of first output pin (if available), etc. 'fx_type' returns type string, 'fx_ident' returns type-specific identifier, 'fx_name' returns pre-aliased name. bool (*TrackFX_GetNamedConfigParm)(MediaTrack* track, int fx, const char* parmname, char* bufOut, int bufOut_sz); #endif @@ -6619,11 +6733,27 @@ REAPERAPI_DEF //============================================== double (*TrackFX_GetParamEx)(MediaTrack* track, int fx, int param, double* minvalOut, double* maxvalOut, double* midvalOut); #endif +#if defined(REAPERAPI_WANT_TrackFX_GetParamFromIdent) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// TrackFX_GetParamFromIdent +// gets the parameter index from an identifying string (:wet, :bypass, or a string returned from GetParamIdent), or -1 if unknown. + + int (*TrackFX_GetParamFromIdent)(MediaTrack* track, int fx, const char* ident_str); +#endif + +#if defined(REAPERAPI_WANT_TrackFX_GetParamIdent) || !defined(REAPERAPI_MINIMAL) +REAPERAPI_DEF //============================================== +// TrackFX_GetParamIdent +// gets an identifying string for the parameter + + bool (*TrackFX_GetParamIdent)(MediaTrack* track, int fx, int param, char* bufOut, int bufOut_sz); +#endif + #if defined(REAPERAPI_WANT_TrackFX_GetParamName) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // TrackFX_GetParamName - bool (*TrackFX_GetParamName)(MediaTrack* track, int fx, int param, char* buf, int buf_sz); + bool (*TrackFX_GetParamName)(MediaTrack* track, int fx, int param, char* bufOut, int bufOut_sz); #endif #if defined(REAPERAPI_WANT_TrackFX_GetParamNormalized) || !defined(REAPERAPI_MINIMAL) @@ -6646,7 +6776,7 @@ REAPERAPI_DEF //============================================== // TrackFX_GetPreset // Get the name of the preset currently showing in the REAPER dropdown, or the full path to a factory preset file for VST3 plug-ins (.vstpreset). Returns false if the current FX parameters do not exactly match the preset (in other words, if the user loaded the preset but moved the knobs afterward). See TrackFX_SetPreset. - bool (*TrackFX_GetPreset)(MediaTrack* track, int fx, char* presetname, int presetname_sz); + bool (*TrackFX_GetPreset)(MediaTrack* track, int fx, char* presetnameOut, int presetnameOut_sz); #endif #if defined(REAPERAPI_WANT_TrackFX_GetPresetIndex) || !defined(REAPERAPI_MINIMAL) @@ -6677,7 +6807,7 @@ REAPERAPI_DEF //============================================== REAPERAPI_DEF //============================================== // TrackFX_GetUserPresetFilename - void (*TrackFX_GetUserPresetFilename)(MediaTrack* track, int fx, char* fn, int fn_sz); + void (*TrackFX_GetUserPresetFilename)(MediaTrack* track, int fx, char* fnOut, int fnOut_sz); #endif #if defined(REAPERAPI_WANT_TrackFX_NavigatePresets) || !defined(REAPERAPI_MINIMAL) @@ -6910,7 +7040,7 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_update_disk_counters) || !defined(REAPERAPI_MINIMAL) REAPERAPI_DEF //============================================== // update_disk_counters -// Updates disk I/O statistics with bytes transferred since last call. +// Updates disk I/O statistics with bytes transferred since last call. notify REAPER of a write error by calling with readamt=0, writeamt=-101010110 for unknown or -101010111 for disk full void (*update_disk_counters)(int readamt, int writeamt); #endif @@ -7564,6 +7694,9 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_GetFocusedFX) || !defined(REAPERAPI_MINIMAL) {(void**)&GetFocusedFX,"GetFocusedFX"}, #endif + #if defined(REAPERAPI_WANT_GetFocusedFX2) || !defined(REAPERAPI_MINIMAL) + {(void**)&GetFocusedFX2,"GetFocusedFX2"}, + #endif #if defined(REAPERAPI_WANT_GetFreeDiskSpaceForRecordPath) || !defined(REAPERAPI_MINIMAL) {(void**)&GetFreeDiskSpaceForRecordPath,"GetFreeDiskSpaceForRecordPath"}, #endif @@ -7633,6 +7766,9 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_GetMaxMidiOutputs) || !defined(REAPERAPI_MINIMAL) {(void**)&GetMaxMidiOutputs,"GetMaxMidiOutputs"}, #endif + #if defined(REAPERAPI_WANT_GetMediaFileMetadata) || !defined(REAPERAPI_MINIMAL) + {(void**)&GetMediaFileMetadata,"GetMediaFileMetadata"}, + #endif #if defined(REAPERAPI_WANT_GetMediaItem) || !defined(REAPERAPI_MINIMAL) {(void**)&GetMediaItem,"GetMediaItem"}, #endif @@ -7954,6 +8090,9 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_GetThemeColor) || !defined(REAPERAPI_MINIMAL) {(void**)&GetThemeColor,"GetThemeColor"}, #endif + #if defined(REAPERAPI_WANT_GetThingFromPoint) || !defined(REAPERAPI_MINIMAL) + {(void**)&GetThingFromPoint,"GetThingFromPoint"}, + #endif #if defined(REAPERAPI_WANT_GetToggleCommandState) || !defined(REAPERAPI_MINIMAL) {(void**)&GetToggleCommandState,"GetToggleCommandState"}, #endif @@ -8356,6 +8495,9 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_LICE_SimpleFill) || !defined(REAPERAPI_MINIMAL) {(void**)&LICE_SimpleFill,"LICE_SimpleFill"}, #endif + #if defined(REAPERAPI_WANT_LICE_ThickFLine) || !defined(REAPERAPI_MINIMAL) + {(void**)&LICE_ThickFLine,"LICE_ThickFLine"}, + #endif #endif // !REAPERAPI_NO_LICE @@ -8533,6 +8675,9 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_MIDI_Sort) || !defined(REAPERAPI_MINIMAL) {(void**)&MIDI_Sort,"MIDI_Sort"}, #endif + #if defined(REAPERAPI_WANT_MIDIEditor_EnumTakes) || !defined(REAPERAPI_MINIMAL) + {(void**)&MIDIEditor_EnumTakes,"MIDIEditor_EnumTakes"}, + #endif #if defined(REAPERAPI_WANT_MIDIEditor_GetActive) || !defined(REAPERAPI_MINIMAL) {(void**)&MIDIEditor_GetActive,"MIDIEditor_GetActive"}, #endif @@ -8641,6 +8786,9 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_PCM_Sink_ShowConfig) || !defined(REAPERAPI_MINIMAL) {(void**)&PCM_Sink_ShowConfig,"PCM_Sink_ShowConfig"}, #endif + #if defined(REAPERAPI_WANT_PCM_Source_BuildPeaks) || !defined(REAPERAPI_MINIMAL) + {(void**)&PCM_Source_BuildPeaks,"PCM_Source_BuildPeaks"}, + #endif #if defined(REAPERAPI_WANT_PCM_Source_CreateFromFile) || !defined(REAPERAPI_MINIMAL) {(void**)&PCM_Source_CreateFromFile,"PCM_Source_CreateFromFile"}, #endif @@ -8713,6 +8861,9 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_projectconfig_var_getoffs) || !defined(REAPERAPI_MINIMAL) {(void**)&projectconfig_var_getoffs,"projectconfig_var_getoffs"}, #endif + #if defined(REAPERAPI_WANT_PromptForAction) || !defined(REAPERAPI_MINIMAL) + {(void**)&PromptForAction,"PromptForAction"}, + #endif #if defined(REAPERAPI_WANT_realloc_cmd_ptr) || !defined(REAPERAPI_MINIMAL) {(void**)&realloc_cmd_ptr,"realloc_cmd_ptr"}, #endif @@ -8758,6 +8909,9 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_resolve_fn2) || !defined(REAPERAPI_MINIMAL) {(void**)&resolve_fn2,"resolve_fn2"}, #endif + #if defined(REAPERAPI_WANT_ResolveRenderPattern) || !defined(REAPERAPI_MINIMAL) + {(void**)&ResolveRenderPattern,"ResolveRenderPattern"}, + #endif #if defined(REAPERAPI_WANT_ReverseNamedCommandLookup) || !defined(REAPERAPI_MINIMAL) {(void**)&ReverseNamedCommandLookup,"ReverseNamedCommandLookup"}, #endif @@ -9055,6 +9209,12 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_TakeFX_GetParamEx) || !defined(REAPERAPI_MINIMAL) {(void**)&TakeFX_GetParamEx,"TakeFX_GetParamEx"}, #endif + #if defined(REAPERAPI_WANT_TakeFX_GetParamFromIdent) || !defined(REAPERAPI_MINIMAL) + {(void**)&TakeFX_GetParamFromIdent,"TakeFX_GetParamFromIdent"}, + #endif + #if defined(REAPERAPI_WANT_TakeFX_GetParamIdent) || !defined(REAPERAPI_MINIMAL) + {(void**)&TakeFX_GetParamIdent,"TakeFX_GetParamIdent"}, + #endif #if defined(REAPERAPI_WANT_TakeFX_GetParamName) || !defined(REAPERAPI_MINIMAL) {(void**)&TakeFX_GetParamName,"TakeFX_GetParamName"}, #endif @@ -9268,6 +9428,12 @@ REAPERAPI_DEF //============================================== #if defined(REAPERAPI_WANT_TrackFX_GetParamEx) || !defined(REAPERAPI_MINIMAL) {(void**)&TrackFX_GetParamEx,"TrackFX_GetParamEx"}, #endif + #if defined(REAPERAPI_WANT_TrackFX_GetParamFromIdent) || !defined(REAPERAPI_MINIMAL) + {(void**)&TrackFX_GetParamFromIdent,"TrackFX_GetParamFromIdent"}, + #endif + #if defined(REAPERAPI_WANT_TrackFX_GetParamIdent) || !defined(REAPERAPI_MINIMAL) + {(void**)&TrackFX_GetParamIdent,"TrackFX_GetParamIdent"}, + #endif #if defined(REAPERAPI_WANT_TrackFX_GetParamName) || !defined(REAPERAPI_MINIMAL) {(void**)&TrackFX_GetParamName,"TrackFX_GetParamName"}, #endif diff --git a/reaper-adm-extension/src/reaper_adm/reaperapi.h b/reaper-adm-extension/src/reaper_adm/reaperapi.h index 16945417..b110c8d0 100644 --- a/reaper-adm-extension/src/reaper_adm/reaperapi.h +++ b/reaper-adm-extension/src/reaper_adm/reaperapi.h @@ -194,9 +194,6 @@ class ReaperAPI { virtual void CleanFXName(std::string& name) const = 0; virtual int TrackFX_PositionByActualName(MediaTrack* track, const std::string& fxName) const = 0; virtual int TrackFX_AddByActualName(MediaTrack* track, const char* fxname, bool recFX, int instantiate) const = 0; - virtual std::vector> GetVSTElementsFromTrackStateChunk(const std::string& fullChunk) const = 0; - virtual std::vector SplitVSTElement(const std::string& elm, bool stripBoundingQuotes, bool includeSeperators) const = 0; - virtual std::string GetTrackStateChunkStr(MediaTrack* track) const = 0; virtual int GetDawChannelCount() const = 0; }; diff --git a/reaper-adm-extension/src/reaper_adm/reaperapiimpl.cpp b/reaper-adm-extension/src/reaper_adm/reaperapiimpl.cpp index a9036869..eb493d1b 100644 --- a/reaper-adm-extension/src/reaper_adm/reaperapiimpl.cpp +++ b/reaper-adm-extension/src/reaper_adm/reaperapiimpl.cpp @@ -824,186 +824,37 @@ std::optional> admplug::ReaperAPIImpl::getTrackAudioBo return std::optional>(); } -std::vector> admplug::ReaperAPIImpl::GetVSTElementsFromTrackStateChunk(const std::string& fullChunk) const -{ - std::vector> vst3Elements; - - const std::vector quoteMarks{ '\'', '`', '"' }; - int elmStart = -1; - - for (int pos = 0; pos < fullChunk.length(); ++pos) { - - bool escapedQuote = false; - for (auto quote : quoteMarks) { - if (fullChunk[pos] == quote) { - // Entered a quote mark - if (pos == fullChunk.length() - 1) { - // Already at EOF - don't attempt to find - escapedQuote = true; - break; - } - // Find end quote mark - auto newPos = fullChunk.find(quote, pos + 1); - if (newPos == std::string::npos) { - // End not found to EOF - abort - escapedQuote = true; - break; - } - pos = newPos; - } - } - if (escapedQuote) { - break; - } - - if (elmStart == -1) { - // Not in an element - check if at start of one - if (fullChunk.substr(pos, 5) == "") { - vst3Elements.push_back(std::make_pair( - elmStart, - fullChunk.substr(elmStart, pos - elmStart + 1)) - ); - elmStart = -1; - } - } - } - - return vst3Elements; -} - -std::vector admplug::ReaperAPIImpl::SplitVSTElement(const std::string& elm, bool stripBoundingQuotes, bool includeSeperators) const -{ - std::vector sec; - - const std::vector quoteMarks{ '\'', '`', '"' }; - const std::vector splitMarks{ ' ', '\r', '\n' }; - int secStart = 5; - - for (int pos = 5; pos < elm.length(); ++pos) { - - bool escapedQuote = false; - for (auto quote : quoteMarks) { - if (elm[pos] == quote) { - // Entered a quote mark - if (pos == elm.length() - 1) { - // Already at EOF - don't attempt to find - escapedQuote = true; - break; - } - // Find end quote mark - auto newPos = elm.find(quote, pos + 1); - if (newPos == std::string::npos) { - // End not found to EOF - abort - escapedQuote = true; - break; - } - pos = newPos; - } - } - if (escapedQuote) { - break; - } - - for (auto splitMark : splitMarks) { - if (elm[pos] == splitMark) { - // Close this section and start a new one - sec.push_back(elm.substr(secStart, pos - secStart)); - if (includeSeperators) { - sec.push_back(std::string{ splitMark }); - } - secStart = pos + 1; - break; - } - } - } - - if (stripBoundingQuotes) { - for (auto& s : sec) { - if (s.length() >= 2) { - for (auto quote : quoteMarks) { - if (s[0] == quote && s[s.length() - 1] == quote) { - s = s.substr(1, s.length() - 2); - break; - } - } - } - } - } - - return sec; -} - -std::string admplug::ReaperAPIImpl::GetTrackStateChunkStr(MediaTrack* track) const -{ - const size_t chunkMaxLen = 65535; // Should be plenty - char chunk[chunkMaxLen]; - auto res = GetTrackStateChunk(track, chunk, chunkMaxLen, false); - if (!res) return std::string(); - std::string fullChunk{ chunk, strnlen(chunk, chunkMaxLen) }; - return fullChunk; -} - int admplug::ReaperAPIImpl::GetDawChannelCount() const { return GetReaperChannelCount(GetAppVersion()); } -bool admplug::ReaperAPIImpl::TrackFX_GetActualFXName(MediaTrack* track, int fx, std::string& name) const +bool admplug::ReaperAPIImpl::TrackFX_GetActualFXName(MediaTrack* track, int fxNum, std::string& name) const { - // Note that; - // TrackFX_GetNamedConfigParm( track, 0, "fx_name" ) - // can get the pre-aliased name but is only supported from v6.37 - // Also does not support FX renamed in FX selection window - // (although neither does this) - - auto chunk = GetTrackStateChunkStr(track); - - auto vst3Elements = GetVSTElementsFromTrackStateChunk(chunk); - if (fx >= vst3Elements.size()) { - return false; - } - - const int nameSectionNum = 0; - - auto vst3Sections = SplitVSTElement(vst3Elements[fx].second, true, false); - if (vst3Sections.size() <= nameSectionNum) { - return false; - } - - name = vst3Sections[nameSectionNum];; + const size_t fxNameMaxLen = 1024; // Should be plenty + char fxName[fxNameMaxLen]; + auto fxNameRes = TrackFX_GetNamedConfigParm(track, fxNum, "fx_name", fxName, fxNameMaxLen); + if (!fxNameRes) return false; + name = std::string{ fxName, strnlen(fxName, fxNameMaxLen) }; return true; } std::vector admplug::ReaperAPIImpl::TrackFX_GetActualFXNames(MediaTrack* track) const { - // Only gets and parses state chunk once - // More efficient when you want to query every plugin on the track - - std::vector names; - - auto chunk = GetTrackStateChunkStr(track); - - auto vst3Elements = GetVSTElementsFromTrackStateChunk(chunk); - - const int nameSectionNum = 0; - - for (auto const& elmPair : vst3Elements) { - auto vst3Sections = SplitVSTElement(elmPair.second, true, false); - if (vst3Sections.size() <= nameSectionNum) { - names.push_back(""); + std::vector fxNames; + auto numFx = TrackFX_GetCount(track); + for (int fxNum = 0; fxNum < numFx; fxNum++) { + const size_t fxNameMaxLen = 1024; // Should be plenty + char fxName[fxNameMaxLen]; + auto fxNameRes = TrackFX_GetNamedConfigParm(track, fxNum, "fx_name", fxName, fxNameMaxLen); + if (fxNameRes) { + fxNames.push_back(std::string{ fxName, strnlen(fxName, fxNameMaxLen) }); } else { - names.push_back(vst3Sections[nameSectionNum]); + fxNames.push_back(""); } } - - return names; + return fxNames; } void admplug::ReaperAPIImpl::CleanFXName(std::string& fxName) const diff --git a/reaper-adm-extension/src/reaper_adm/reaperapiimpl.h b/reaper-adm-extension/src/reaper_adm/reaperapiimpl.h index 38f576a3..52d00586 100644 --- a/reaper-adm-extension/src/reaper_adm/reaperapiimpl.h +++ b/reaper-adm-extension/src/reaper_adm/reaperapiimpl.h @@ -144,9 +144,6 @@ class ReaperAPIImpl : public ReaperAPI void CleanFXName(std::string& name) const override; int TrackFX_PositionByActualName(MediaTrack* track, const std::string& fxName) const override; int TrackFX_AddByActualName(MediaTrack* track, const char* fxname, bool recFX, int instantiate) const override; - std::vector> GetVSTElementsFromTrackStateChunk(const std::string& fullChunk) const override; - std::vector SplitVSTElement(const std::string& elm, bool stripBoundingQuotes, bool includeSeperators) const override; - std::string GetTrackStateChunkStr(MediaTrack* track) const override; int GetDawChannelCount() const override; private: diff --git a/reaper-adm-extension/test/reaper_adm/mocks/reaperapi.h b/reaper-adm-extension/test/reaper_adm/mocks/reaperapi.h index f18be660..60a712f4 100644 --- a/reaper-adm-extension/test/reaper_adm/mocks/reaperapi.h +++ b/reaper-adm-extension/test/reaper_adm/mocks/reaperapi.h @@ -236,9 +236,6 @@ class MockReaperAPI : public ReaperAPI { MOCK_CONST_METHOD1(CleanFXName, void(std::string& name)); MOCK_CONST_METHOD2(TrackFX_PositionByActualName, int(MediaTrack* track, const std::string& fxName)); MOCK_CONST_METHOD4(TrackFX_AddByActualName, int(MediaTrack* track, const char* fxname, bool recFX, int instantiate)); - MOCK_CONST_METHOD1(GetVSTElementsFromTrackStateChunk, std::vector>(const std::string& fullChunk)); - MOCK_CONST_METHOD3(SplitVSTElement, std::vector(const std::string& elm, bool stripBoundingQuotes, bool includeSeperators)); - MOCK_CONST_METHOD1(GetTrackStateChunkStr, std::string(MediaTrack* track)); MOCK_CONST_METHOD0(GetDawChannelCount, int()); }; diff --git a/reaper-adm-extension/test/reaper_adm/pluginrenametests.cpp b/reaper-adm-extension/test/reaper_adm/pluginrenametests.cpp index 0f47b35b..f514c1e6 100644 --- a/reaper-adm-extension/test/reaper_adm/pluginrenametests.cpp +++ b/reaper-adm-extension/test/reaper_adm/pluginrenametests.cpp @@ -2,129 +2,8 @@ #include #include -const std::string trackState = -R"STATESTRING( -PRESETNAME "Program 1" -FLOATPOS 1944 -62 616 512 -FXID {159FD704-E101-42BC-A4D2-8F3F263F5160} -WAK 0 0 -BYPASS 0 0 0 - -PRESETNAME "Program 1" -FLOATPOS 1944 -62 742 738 -FXID {66EFE191-C8CE-4786-8C38-4BE42D751146} -WAK 0 0 -BYPASS 0 0 0 - -PRESETNAME "Program 1" -FLOATPOS 1944 -62 742 738 -FXID {24D3CD65-1A9A-44D6-B8A1-5FBC65C39DD5} -WAK 0 0 -BYPASS 0 0 0 - -PRESETNAME "Program 1" -FLOATPOS 1944 -62 742 738 -FXID {493829B3-8224-4E57-AC50-ED2C5E652E31} -WAK 0 0 -BYPASS 0 0 0 - -PRESETNAME "Program 1" -FLOATPOS 1944 -62 742 738 -FXID {17FB49CB-DDA3-41B4-BAF3-9365DF7AC29C} -WAK 0 0 -> ->)STATESTRING"; - using namespace admplug; -TEST_CASE("Track State Chunk Parsing") { - - reaper_plugin_info_t info{}; - admplug::ReaperAPIImpl api(info); - - auto vst3Elements = api.GetVSTElementsFromTrackStateChunk(trackState); - - REQUIRE(vst3Elements.size() == 5); - - for (int i = 0; i < vst3Elements.size(); ++i) { - auto el = vst3Elements[i]; - auto s = api.SplitVSTElement(el.second, true, false); - - REQUIRE(s.size() >= 6); - REQUIRE(s[0] == "VST3: EAR Object (EBU)"); - REQUIRE(s[1] == "EAR Object.vst3"); - - if (i == 0) REQUIRE(s[3] == "Custom Name"); - if (i == 1) REQUIRE(s[3] == "SingleWord"); - if (i == 2) REQUIRE(s[3] == "'quote' \"Marks\" 'lol'"); - if (i == 3) REQUIRE(s[3] == "\"just in quotes\""); - if (i == 4) REQUIRE(s[3] == ""); - } - -} - TEST_CASE("Clean Plugin Name") { reaper_plugin_info_t info{};