Skip to content

Commit

Permalink
Big refactoring: moved SMPortOrVirtual{Output}Stream over to SysExLib…
Browse files Browse the repository at this point in the history
…rarian, squished back into one class, renamed it SSECombinationOutputStream, and made it use a protocol for "destinations" rather than a bunch of dictionaries.

It all builds cleanly but needs a little bit of work, and hasn't been tested at all...
  • Loading branch information
krevis committed Sep 3, 2002
1 parent 7014fc7 commit f79023f
Show file tree
Hide file tree
Showing 10 changed files with 649 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// SMDestinationEndpoint-SSEOutputStreamDestination.h
// SysExLibrarian
//
// Created by Kurt Revis on Tue Sep 03 2002.
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
//

#import <SnoizeMIDI/SnoizeMIDI.h>
#import "SSEOutputStreamDestination.h"


@interface SMDestinationEndpoint (SSEOutputStreamDestination) <SSEOutputStreamDestination>

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// SMDestinationEndpoint-SSEOutputStreamDestination.m
// SysExLibrarian
//
// Created by Kurt Revis on Tue Sep 03 2002.
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
//

#import "SMDestinationEndpoint-SSEOutputStreamDestination.h"


@implementation SMDestinationEndpoint (SSEOutputStreamDestination)

- (NSString *)outputStreamDestinationName;
{
return [self uniqueName];
}

- (NSArray *)outputStreamDestinationExternalDeviceNames;
{
return [[self connectedExternalDevices] arrayByPerformingSelector:@selector(name)];
}

- (BOOL)outputStreamDestinationNeedsSysExWorkaround;
{
return [self needsSysExWorkaround];
}

@end
60 changes: 60 additions & 0 deletions Applications/SysExLibrarian/SSECombinationOutputStream.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// Copyright 2001-2002 Kurt Revis. All rights reserved.
//

#import <OmniFoundation/OFObject.h>
#import <Foundation/Foundation.h>
#import <SnoizeMIDI/SnoizeMIDI.h>
#import "SSEOutputStreamDestination.h"


@interface SSECombinationOutputStream : OFObject <SMMessageDestination>
{
SMVirtualOutputStream *virtualStream;
SMPortOutputStream *portStream;

SSESimpleOutputStreamDestination *virtualStreamDestination;
SInt32 virtualEndpointUniqueID;
NSString *virtualEndpointName;

struct {
unsigned int ignoresTimeStamps:1;
unsigned int sendsSysExAsynchronously:1;
} flags;
}

- (NSArray *)destinations;
- (id <SSEOutputStreamDestination>)selectedDestination;
- (void)setSelectedDestination:(id <SSEOutputStreamDestination>)aDestination;

// TODO see if we can get rid of these
- (void)setVirtualEndpointName:(NSString *)newName;
- (void)setVirtualDisplayName:(NSString *)newName;

- (NSDictionary *)persistentSettings;
- (NSString *)takePersistentSettings:(NSDictionary *)settings;
// If the endpoint indicated by the persistent settings couldn't be found, its name is returned

- (id)stream;
// Returns the actual stream in use (either virtualStream or portStream)


// Methods which are passed on to the relevant stream:

- (BOOL)ignoresTimeStamps;
- (void)setIgnoresTimeStamps:(BOOL)value;
// If YES, then ignore the timestamps in the messages we receive, and send immediately instead

- (BOOL)sendsSysExAsynchronously;
- (void)setSendsSysExAsynchronously:(BOOL)value;
// If YES, then use MIDISendSysex() to send sysex messages. Otherwise, use plain old MIDI packets.
// (This can only work on port streams, not virtual ones.)
- (BOOL)canSendSysExAsynchronously;

- (void)cancelPendingSysExSendRequests;
- (SMSysExSendRequest *)currentSysExSendRequest;

@end

// Notifications
extern NSString *SSECombinationOutputStreamEndpointDisappearedNotification;
Loading

0 comments on commit f79023f

Please sign in to comment.