Skip to content

Commit

Permalink
Resolves #50 - Aux Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffeyDev committed Oct 27, 2017
1 parent ef1128b commit 2c3721e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
25 changes: 25 additions & 0 deletions atemOSC/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ - (void)switcherConnected
IBMDSwitcherMixEffectBlockIterator* iterator = NULL;
IBMDSwitcherMediaPlayerIterator* mediaPlayerIterator = NULL;
IBMDSwitcherSuperSourceBoxIterator* superSourceIterator = NULL;
IBMDSwitcherInputIterator* inputIterator = NULL;
isConnectedToATEM = YES;

if ([[NSProcessInfo processInfo] respondsToSelector:@selector(beginActivityWithOptions:reason:)])
Expand Down Expand Up @@ -230,6 +231,30 @@ - (void)switcherConnected
[self logMessage:@"Could not get the first IBMDSwitcherMixEffectBlock"];
return;
}
// Create an InputMonitor for each input so we can catch any changes to input names
result = mSwitcher->CreateIterator(IID_IBMDSwitcherInputIterator, (void**)&inputIterator);
if (SUCCEEDED(result))
{
IBMDSwitcherInput* input = NULL;

// For every input, install a callback to monitor property changes on the input
while (S_OK == inputIterator->Next(&input))
{
IBMDSwitcherInputAux* auxObj;
result = input->QueryInterface(IID_IBMDSwitcherInputAux, (void**)&auxObj);
if (SUCCEEDED(result))
{
BMDSwitcherInputId auxId;
result = auxObj->GetInputSource(&auxId);
if (SUCCEEDED(result))
{
mSwitcherInputAuxList.push_back(auxObj);
}
}
}
inputIterator->Release();
inputIterator = NULL;
}


//Upstream Keyer
Expand Down
7 changes: 5 additions & 2 deletions atemOSC/OSCReceiver.mm
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ - (void) receivedOSCMessage:(OSCMessage *)m
else if ([[address objectAtIndex:2] isEqualToString:@"aux"])
{
int auxToChange = [[address objectAtIndex:3] intValue];
int source = [[m value] intValue];
int source = [[m value] floatValue];
[self handleAuxSource:auxToChange channel:source];
}

Expand Down Expand Up @@ -294,7 +294,10 @@ - (void) changeTransitionSelection:(int)t select:(bool) select
- (void) handleAuxSource:(int)auxToChange channel:(int)channel
{
BMDSwitcherInputId inputId = channel;
[appDel mSwitcherInputAuxList][auxToChange-1]->SetInputSource(inputId);
if (auxToChange-1 < [appDel mSwitcherInputAuxList].size())
[appDel mSwitcherInputAuxList][auxToChange-1]->SetInputSource(inputId);
else
[appDel logMessage:[NSString stringWithFormat:@"Aux number %d not available on your switcher", channel]];
}

- (void) handleMacros:(OSCMessage *)m address:(NSArray*)address
Expand Down

0 comments on commit 2c3721e

Please sign in to comment.