Skip to content

Commit

Permalink
Merge pull request #11 from mabu4ch/develop
Browse files Browse the repository at this point in the history
Merge newest develop branch for beta testing
  • Loading branch information
mabu4ch authored May 8, 2022
2 parents 2290b92 + aea775a commit 71392d9
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 354 deletions.
482 changes: 179 additions & 303 deletions iOSiConfig4Audio/Source/Device/DeviceInfo.cpp

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions iOSiConfig4Audio/Source/Device/DeviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ using GeneSysLib::Info;
using GeneSysLib::MIDIPortRemap;
using GeneSysLib::MIDIPortFilter;

struct DeviceInfo {
struct DeviceInfo

{
DeviceInfo(GeneSysLib::CommPtr comm);
DeviceInfo(GeneSysLib::CommPtr comm, GeneSysLib::DeviceID deviceID,
Word transID);
Expand Down Expand Up @@ -199,6 +201,8 @@ struct DeviceInfo {
void timeout();

private:
void checkUnanswered();
void notifyScreen();
void registerAllHandlers();
void unRegisterHandlerAllHandlers();

Expand All @@ -208,23 +212,17 @@ struct DeviceInfo {

template <typename T>
void addCommand(const T &command) {
//[sendLock lock];
sysexMessages.push(command.sysex());
//[sendLock unlock];
mSysexMessages.push(command.sysex());
}

template <typename T>
void addCommand(const T &&command) {
//[sendLock lock];
sysexMessages.push(command.sysex());
//[sendLock unlock];
mSysexMessages.push(command.sysex());
}

template <typename T, typename... Ts>
void addCommand(Ts... vs) {
//[sendLock lock];
sysexMessages.push(T(deviceID, transID, vs...).sysex());
//[sendLock unlock];
mSysexMessages.push(T(deviceID, transID, vs...).sysex());
}

bool sendNextSysex();
Expand Down Expand Up @@ -262,7 +260,8 @@ struct DeviceInfo {
// Screen performing query
Screen queryScreen;

int maxWriteItems;
NSTimer* mTimeoutTimer;
int mUnansweredMessageCount;

// Current Query
std::list<GeneSysLib::CmdEnum> currentQuery;
Expand All @@ -275,7 +274,10 @@ struct DeviceInfo {
pendingQueries;

// Pending sysex messages
std::queue<Bytes> sysexMessages;
using SysexMessages = std::queue<Bytes>;
SysexMessages mSysexMessages;

SysexMessages::size_type mMaxWriteItems;

// queries attemped
std::set<GeneSysLib::CmdEnum> attemptedQueries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ - (void)tableView:(UITableView *)tableView
if (selectedDevice) {
if ( selectedDevice->getDeviceID().pid() == DevicePID::iConnect2Audio ||
selectedDevice->getDeviceID().pid() == DevicePID::iConnect4Audio ||
selectedDevice->getDeviceID().pid() == DevicePID::iConnect4Plus) {
selectedDevice->getDeviceID().pid() == DevicePID::iConnect4Plus ||
selectedDevice->getDeviceID().pid() == DevicePID::iConnect2Plus) {
const auto &transID = selectedDevice->getTransID();
self.comm->setCurrentOutput(transID);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef void (^ActionBlock)(ICViewController *);
@interface ICMainMenuProvider : NSObject {
NSArray *buttonNames;
NSArray *actionArray;
NSDictionary<NSString*, ButtonActionBlock> *actionDictionary;
id queryNotificationHandler;
}

Expand All @@ -27,6 +28,6 @@ typedef void (^ActionBlock)(ICViewController *);
action:(ActionBlock)action;

- (void)initializeProviderButtons:(ICViewController *)sender;
- (void)onButtonDown:(ICViewController *)sender index:(NSInteger)buttonIndex;
- (bool)onButtonDown:(ICViewController *)sender text:(NSString*)buttonText;

@end
32 changes: 20 additions & 12 deletions iOSiConfig4Audio/Source/General/Providers/ICMainMenuProvider.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,72 +68,80 @@ - (void)initializeProviderButtons:(ICViewController *)sender {
// always add the device information menu item
NSMutableArray *tempButtonNames = [NSMutableArray array];
NSMutableArray *tempActionArray = [NSMutableArray array];
NSMutableDictionary<NSString*, ButtonActionBlock> *tempActionDictionary = [NSMutableDictionary dictionary];

// add a "Device Info" button if there is any device info on the device
if (commandList.contains(Command::GetInfoList) ||
commandList.contains(Command::GetInfo)) {
[tempButtonNames addObject:@"Device Info"];
[tempActionArray addObject:[self createDeviceInfoAction:commandList]];
tempActionDictionary[tempButtonNames.lastObject] = tempActionArray.lastObject;
}

// add an "Audio Info" (V1) button if supported by the device
if (commandList.contains(Command::GetAudioInfo)) {
[tempButtonNames addObject:@"Audio Info"];
[tempActionArray addObject:[self createAudioInfoActionV1:commandList]];
} else if ((commandList.contains(Command::GetAudioGlobalParm)) &&
tempActionDictionary[tempButtonNames.lastObject] = tempActionArray.lastObject;
}
else if ((commandList.contains(Command::GetAudioGlobalParm)) &&
(commandList.contains(Command::GetAudioPortParm)) &&
(commandList.contains(Command::GetAudioDeviceParm)) &&
(commandList.contains(Command::GetAudioClockParm))) {
// add an "Audio Info" (V2) button if supported by the device
[tempButtonNames addObject:@"Audio Info"];
[tempActionArray addObject:[self createAudioInfoActionV2:commandList]];
tempActionDictionary[tempButtonNames.lastObject] = tempActionArray.lastObject;
}

// add an "Audio Patchbay" (V1) button if supported by the device
if (commandList.contains(Command::GetAudioPortInfo) &&
commandList.contains(Command::GetAudioPortPatchbay)) {
[tempButtonNames addObject:@"Audio Patchbay"];
[tempActionArray addObject:[self createAudioPatchbayV1Action]];
tempActionDictionary[tempButtonNames.lastObject] = tempActionArray.lastObject;
}

if ((commandList.contains(Command::GetAudioGlobalParm)) &&
(commandList.contains(Command::GetAudioPatchbayParm))) {
[tempButtonNames addObject:@"Audio Patchbay"];
[tempActionArray addObject:[self createAudioPatchbayV2Action]];
tempActionDictionary[tempButtonNames.lastObject] = tempActionArray.lastObject;
}

// add a "Mixer" button if there is any Mixer Parm on the device
if (commandList.contains(Command::GetMixerParm)) {
[tempButtonNames addObject:@"Audio Mixer"];
[tempActionArray addObject:[self createMixerAction]];
tempActionDictionary[tempButtonNames.lastObject] = tempActionArray.lastObject;
}

// add a "MIDI Info" button if there is any MIDI info on the device
if (commandList.contains(Command::GetMIDIInfo)) {
[tempButtonNames addObject:@"MIDI Info"];
[tempActionArray addObject:[self createMIDIInfoAction:commandList]];
tempActionDictionary[tempButtonNames.lastObject] = tempActionArray.lastObject;
}

// add a "MIDI Info" button if there is any MIDI info on the device
if (commandList.contains(Command::GetMIDIPortRoute)) {
[tempButtonNames addObject:@"MIDI Patchbay"];
[tempActionArray addObject:[self createMIDIPatchbayAction]];
tempActionDictionary[tempButtonNames.lastObject] = tempActionArray.lastObject;
}

buttonNames = tempButtonNames;
actionArray = tempActionArray;
actionDictionary = tempActionDictionary;
}
}
- (NSArray *)buttonNames {
return buttonNames;
}

// This method handles all button presses by calling the action block for the
// corresponding button index
- (void)onButtonDown:(ICViewController *)sender index:(NSInteger)buttonIndex {
// Make sure that the button index is in range
if ((buttonIndex >= 0) && (buttonIndex < [actionArray count])) {

// corresponding button text
- (bool)onButtonDown:(ICViewController *)sender text:(NSString*)buttonText {
ButtonActionBlock action = [actionDictionary objectForKey:buttonText];
if (action != nil)
{
// If there is a query notification handler then remove it so we don't have
// unwanted query listeners
if (queryNotificationHandler) {
Expand All @@ -142,12 +150,12 @@ - (void)onButtonDown:(ICViewController *)sender index:(NSInteger)buttonIndex {
queryNotificationHandler = nil;
}

// Get the corresponding action
ButtonActionBlock action = actionArray[buttonIndex];

// Call the action
action(sender);

return true;
}
return false;
}

// This method returns the number of rows to show
Expand Down
44 changes: 31 additions & 13 deletions iOSiConfig4Audio/Source/General/ViewControllers/ICViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,38 +102,56 @@ - (void)resetBarButtonTints {

- (IBAction)onDeviceInfoButtonTouched:(id)sender {
[self resetBarButtonTints];
[_deviceInfoButton setTintColor:[UIColor redColor]];
[self.provider onButtonDown:self index:0];
NSString* action = [_deviceInfoButton title];
if ([self.provider onButtonDown:self text: action])
{
[_deviceInfoButton setTintColor:[UIColor redColor]];
}
}

- (IBAction)onAudioInfoButtonTouched:(id)sender {
[self resetBarButtonTints];
[_audioInfoButton setTintColor:[UIColor redColor]];
[self.provider onButtonDown:self index:1];
NSString* action = [_audioInfoButton title];
if ([self.provider onButtonDown:self text: action])
{
[_audioInfoButton setTintColor:[UIColor redColor]];
}
}

- (IBAction)onAudioPatchbayButtonTouched:(id)sender {
[self resetBarButtonTints];
[_audioPatchbayButton setTintColor:[UIColor redColor]];
[self.provider onButtonDown:self index:2];
NSString* action = [_audioPatchbayButton title];
if ([self.provider onButtonDown:self text: action])
{
[_audioPatchbayButton setTintColor:[UIColor redColor]];
}
}

- (IBAction)onAudioMixerButtonTouched:(id)sender {
[self resetBarButtonTints];
[_audioMixerButton setTintColor:[UIColor redColor]];
[self.provider onButtonDown:self index:3];
NSString* action = [_audioMixerButton title];
if ([self.provider onButtonDown:self text: action])
{
[_audioMixerButton setTintColor:[UIColor redColor]];
}
}

- (IBAction)onMidiInfoButtonTouched:(id)sender {
[self resetBarButtonTints];
[_midiInfoButton setTintColor:[UIColor redColor]];
[self.provider onButtonDown:self index:4];
NSString* action = [_midiInfoButton title];
if ([self.provider onButtonDown:self text: action])
{
[_midiInfoButton setTintColor:[UIColor redColor]];
}
}

- (IBAction)onMidiPatchbayButtonTouched:(id)sender {
[self resetBarButtonTints];
[_midiPatchbayButton setTintColor:[UIColor redColor]];
[self.provider onButtonDown:self index:5];
NSString* action = [_midiPatchbayButton title];
if ([self.provider onButtonDown:self text: action])
{
[_midiPatchbayButton setTintColor:[UIColor redColor]];
}
}

+ (UIImage *)imageFromColor:(UIColor *)color {
Expand Down Expand Up @@ -321,7 +339,7 @@ - (id)initWithProvider:(ICMainMenuProvider *)provider
isLandscape = UIDeviceOrientationIsLandscape(orientation);

[self.provider initializeProviderButtons:self];
[self.provider onButtonDown:self index:0];
[self.provider onButtonDown:self text:[_deviceInfoButton title]];

[_deviceInfoButton setTintColor:[UIColor redColor]];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ - (NSArray*)options {
for (const auto& option : self.device->usbHostMIDIDeviceDetails) {
if ((option.numMIDIIn() > 0) || (option.numMIDIOut() > 0)) {

const auto& maxPortID = MAX(option.numMIDIIn(), option.numMIDIOut());
const auto maxPortID = MAX(option.numMIDIIn(), option.numMIDIOut());
for (Word portID = 1; portID <= maxPortID; ++portID) {
NSString* portName = [NSString
stringWithFormat:@"%s %s (Port %d)", option.vendorName().c_str(),
Expand Down Expand Up @@ -84,11 +84,12 @@ - (NSInteger)getChoice {
MIDIPortDetail portDetail = self.device->get<MIDIPortDetail>(self.portID);
MIDIPortDetailTypes::USBHost usbHost = portDetail.getUSBHost();

if (!usbHost.isReserved()) {
return 0;
}

NSInteger value = 0;

if (usbHost.isReserved())
{
++value;
}

for (const auto& option : self.device->usbHostMIDIDeviceDetails) {
if ((option.hostedUSBVendorID() == usbHost.hostedUSBVendorID()) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ - (id)initWithMIDIInfo:(MIDIInfo)_midiInfo

assert(device);

const auto& isiPhone = ([[UIDevice currentDevice] userInterfaceIdiom] ==
const auto isiPhone = ([[UIDevice currentDevice] userInterfaceIdiom] ==
UIUserInterfaceIdiomPhone);

if (midiInfo.versionNumber() == 0x01) {
Expand Down Expand Up @@ -158,11 +158,11 @@ - (id)initWithMIDIInfo:(MIDIInfo)_midiInfo
[tempSectionArray addObject:midiInfoArray];

int numPorts = device->typeCount<MIDIPortInfo>();
for (int portID = 1; portID <= numPorts; ++portID) {
for (Word portID = 1; portID <= numPorts; ++portID) {
// title
{
MIDIPortInfo& port = device->get<MIDIPortInfo>(portID);
const auto& portInfo = port.portInfo();
const auto portInfo = port.portInfo();
NSMutableString* title = [NSMutableString
stringWithFormat:@"Port Information %d\n", portID];

Expand Down
4 changes: 2 additions & 2 deletions iOSiConfig4Audio/reConfig4Audio.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = H28D8P2T32;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Source/Info.plist;
Expand Down Expand Up @@ -1986,7 +1986,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = H28D8P2T32;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Source/Info.plist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@
CODE_SIGN_ENTITLEMENTS = iOSiConfig2.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = H28D8P2T32;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Source/Info.plist;
Expand Down Expand Up @@ -1952,7 +1952,7 @@
CODE_SIGN_ENTITLEMENTS = iOSiConfig2.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = H28D8P2T32;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Source/Info.plist;
Expand Down

0 comments on commit 71392d9

Please sign in to comment.