Skip to content

Commit b8be289

Browse files
committed
Report source type in item navigation
When navigating through items, the source type (audio, video, midi) is announced when reporting take information (see issue #1066).
1 parent 7b0814d commit b8be289

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/reaper_osara.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -3157,6 +3157,13 @@ void cmdGoToMasterTrack(Command* command){
31573157
postGoToTrack(0);
31583158
}
31593159

3160+
string getReportableSourceType(const char* type) {
3161+
if((!type)||(!*type)) return "";
3162+
string reported_type=type;
3163+
if((reported_type=="VIDEO")||(reported_type=="MIDI")) return reported_type;
3164+
return "AUDIO";
3165+
}
3166+
31603167
void moveToItem(int direction, bool clearSelection=true, bool select=true) {
31613168
unsigned int undoMask = getConfigUndoMask();
31623169
bool makeUndoPoint = undoMask&1;
@@ -3236,6 +3243,9 @@ void moveToItem(int direction, bool clearSelection=true, bool select=true) {
32363243
}
32373244
MediaItem_Take* take = GetActiveTake(item);
32383245
if (take) {
3246+
if (auto* source = (PCM_source*)GetSetMediaItemTakeInfo(take, "P_SOURCE", nullptr)) {
3247+
s << " " << getReportableSourceType(source->GetType());
3248+
}
32393249
s << " " << GetTakeName(take);
32403250
}
32413251
int takeCount = CountTakes(item);
@@ -3583,6 +3593,25 @@ void cmdUnselAllTracksItemsPoints(Command* command) {
35833593
outputMessage(translate("unselected tracks/items/envelope points"));
35843594
}
35853595

3596+
void reportTempoTimeSig() {
3597+
ReaProject* proj=EnumProjects(-1, nullptr, 0);
3598+
if(proj==nullptr) return;
3599+
double tempo=0;
3600+
int timesig_num=0;
3601+
int timesig_denom=0;
3602+
double pos=GetPlayPosition();
3603+
TimeMap_GetTimeSigAtTime(proj, pos, &timesig_num, &timesig_denom, &tempo);
3604+
outputMessage(format("{}, {}/{}", formatDouble(tempo, 1, false), timesig_num, timesig_denom));
3605+
}
3606+
3607+
void cmdManageTempoTimeSigMarkers(Command* command) {
3608+
if(lastCommandRepeatCount==0) {
3609+
reportTempoTimeSig();
3610+
return;
3611+
}
3612+
Main_OnCommand(40256, 0); // Tempo envelope: Insert tempo/time signature change marker at edit cursor...
3613+
}
3614+
35863615
void cmdSwitchProjectTab(Command* command) {
35873616
ReaProject* oldProj = EnumProjects(-1, nullptr, 0);
35883617
Main_OnCommand(command->gaccel.accel.cmd, 0);
@@ -4852,6 +4881,7 @@ Command COMMANDS[] = {
48524881
{MAIN_SECTION, {DEFACCEL, _t("OSARA: Configure REAPER for optimal screen reader accessibility")}, "OSARA_CONFIGREAPEROPTIMAL", cmdConfigReaperOptimal},
48534882
{MAIN_SECTION, {DEFACCEL, _t("OSARA: Check for update")}, "OSARA_UPDATE", cmdCheckForUpdate},
48544883
{MAIN_SECTION, {DEFACCEL, _t("OSARA: Open online documentation")}, "OSARA_OPENDOC", cmdOpenDoc},
4884+
{MAIN_SECTION, {DEFACCEL, _t("OSARA: Report tempo and time signature at play cursor (press twice to add/edit tempo marker)")}, "OSARA_MANAGETEMPOTIMESIGMARKERS", cmdManageTempoTimeSigMarkers},
48554885
{MIDI_EDITOR_SECTION, {DEFACCEL, _t("OSARA: Enable noncontiguous selection/toggle selection of current chord/note")}, "OSARA_MIDITOGGLESEL", cmdMidiToggleSelection},
48564886
{MIDI_EDITOR_SECTION, {DEFACCEL, _t("OSARA: Move to next chord")}, "OSARA_NEXTCHORD", cmdMidiMoveToNextChord},
48574887
{MIDI_EDITOR_SECTION, {DEFACCEL, _t("OSARA: Move to previous chord")}, "OSARA_PREVCHORD", cmdMidiMoveToPreviousChord},

0 commit comments

Comments
 (0)