Join/Login

Business Software

Open Source Software

For Vendors

Blog

About

More

Articles

Create

SourceForge Podcast

Site Documentation

Subscribe to our Newsletter

Support Request

For Vendors Help Create Join Login

Business Software

Open Source Software

SourceForge Podcast

Resources

Articles

Case Studies

Blog

Menu

Help

Create

Join

Login

Home

Browse

PlayerPro music editor and SoundTracker

Code

PlayerPro music editor and SoundTracker Code

Play SoundTracker media on your computer.

Brought to you by: madd_the_sane, rossetantoine, sandrobilbeisi

Summary

Files

Reviews

Support

Mailing Lists

Tickets ▾

Bugs

Support Requests

Patches

Feature Requests

News

Discussion

Code

Menu ▾ ▴

Browse Commits

Fork

Merge Requests 0

Branches

master

Classic

NSPreferences

PP5-CPlusPlusRewrite

PPPcmd

PlayerPRO5

SDLAudio

XPCMIDI

XPCMIDI-noObjC

audioToolbox-plugrewrite

More Branches

Tags

5.10-Developer-Preview-1

5.10-Developer-Preview-2

5.10-Developer-Preview-3

5.10-Developer-Preview-4

5.10-Developer-Preview-5

5.10-Developer-Preview-6

5.10-Developer-Preview-7

PP6-pre_split

PPlayer-1.0

PPlayer-1.0.1

More Tags

[b65532]: / PlayerPROKit / PPFXSetObject.m  Maximize  Restore  History

Download this file

305 lines (256 with data), 6.9 kB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304

//

// PPFXSetObject.m

// PPMacho

//

// Created by C.W. Betts on 1/8/14.

//

//

#include <PlayerPROCore/PlayerPROCore.h>

#import "PPFXSetObject.h"

#if TARGET_OS_OSX

#import "PPPasteboardHandling.h"

#endif

#define kPPTrack @"PlayerPROKit FXSets Track"

#define kPPIdentifier @"PlayerPROKit FXSets Identifier"

#define kPPFXIdentifier @"PlayerPROKit FXSets FXIdentifier"

#define kPPArgumentNumbers @"PlayerPROKit FXSets Argument Numbers"

#define kPPValues @"PlayerPROKit FXSets Values"

#define kPPName @"PlayerPROKit FXSets Name"

@interface PPFXSetObject ()

@property (readwrite, nonatomic, strong) NSMutableArray *sets;

- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;

@end

@implementation PPFXSetObject

@synthesize theSet;

@synthesize name = _name;

#if TARGET_OS_OSX

NSString * const kPPKFXSetPasteboardUTI = @"net.sourceforge.playerpro.FXSet";

static NSArray *UTIArray;

static dispatch_once_t initUTIOnceToken;

static const dispatch_block_t initUTIArray = ^{

UTIArray = @[kPPKFXSetPasteboardUTI];

};

+ (NSArray *)readableTypesForPasteboard:(NSPasteboard *)pasteboard

{

dispatch_once(&initUTIOnceToken, initUTIArray);

return UTIArray;

}

- (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard

{

dispatch_once(&initUTIOnceToken, initUTIArray);

return UTIArray;

}

- (id)pasteboardPropertyListForType:(NSString *)type

{

if ([type isEqualToString:kPPKFXSetPasteboardUTI])

return [NSKeyedArchiver archivedDataWithRootObject:self];

else

return nil;

}

+ (NSPasteboardReadingOptions)readingOptionsForType:(NSString *)type pasteboard:(NSPasteboard *)pasteboard

{

if ([type isEqualToString:kPPKFXSetPasteboardUTI])

return NSPasteboardReadingAsKeyedArchive;

else

return NSPasteboardReadingAsData;

}

#endif

- (NSString*)name

{

if (!_name) {

_name = CFBridgingRelease(CFStringCreateWithPascalString(kCFAllocatorDefault, theSet.name, kCFStringEncodingMacRoman));

if (!_name) {

_name = @"";

memset(theSet.name, 0, sizeof(theSet.name));

}

}

return _name;

}

- (void)setName:(NSString *)name

{

if (![name isEqualToString:_name]) {

if (CFStringGetPascalString((__bridge CFStringRef)name, theSet.name, 63, kCFStringEncodingMacRoman) == false) {

memset(theSet.name, 0, sizeof(theSet.name));

}

_name = CFBridgingRelease(CFStringCreateWithPascalString(kCFAllocatorDefault, theSet.name, kCFStringEncodingMacRoman));

}

}

- (instancetype)init

{

FXSets tmpSets = {0};

if (self = [self initWithFXSet:&tmpSets]) {

}

return self;

}

- (instancetype)initWithFXSet:(FXSets*)theSett

{

if (self = [super init]) {

if (!theSett) {

return nil;

}

theSet = *theSett;

_sets = [[NSMutableArray alloc] initWithCapacity:100];

for (int i = 0; i < 100; i++) {

[self.sets addObject:@(theSet.values[i])];

}

}

return self;

}

- (short)track

{

return theSet.track;

}

- (void)setTrack:(short)track

{

theSet.track = track;

}

- (short)identifier

{

return theSet.id;

}

- (void)setIdentifier:(short)identifier

{

theSet.id = identifier;

}

- (int)effectIdentifier

{

return theSet.FXID;

}

- (void)setEffectIdentifier:(int)fxIdentifier

{

theSet.FXID = fxIdentifier;

}

- (short)countOfArguments

{

return theSet.noArg;

}

- (void)setCountOfArguments:(short)argumentNumbers

{

theSet.noArg = argumentNumbers;

}

- (NSArray*)effectValues

{

return [NSArray arrayWithArray:_sets];

}

- (FXSets)theSet

{

return theSet;

}

- (void)replaceEffectValueAtIndex:(NSInteger)theLoc withFloat:(float)theNum

{

[self replaceEffectValueAtIndex:theLoc withNumber:@(theNum)];

}

- (void)replaceEffectValueAtIndex:(NSInteger)theLoc withDouble:(double)theNum

{

[self replaceEffectValueAtIndex:theLoc withNumber:@(theNum)];

}

- (void)replaceEffectValueAtIndex:(NSInteger)theLoc withInt:(int)theNum

{

[self replaceEffectValueAtIndex:theLoc withNumber:@(theNum)];

}

- (void)replaceEffectValueAtIndex:(NSInteger)theLoc withInteger:(NSInteger)theNum

{

[self replaceEffectValueAtIndex:theLoc withNumber:@(theNum)];

}

- (void)replaceEffectValueAtIndex:(NSInteger)theLoc withNumber:(NSNumber*)theNum

{

NSParameterAssert(theLoc < 100 && theLoc > -1);

NSIndexSet *tmpIdx = [NSIndexSet indexSetWithIndex:theLoc];

[self willChange:NSKeyValueChangeReplacement valuesAtIndexes:tmpIdx forKey:@"sets"];

self.sets[theLoc] = theNum;

theSet.values[theLoc] = [theNum floatValue];

[self didChange:NSKeyValueChangeReplacement valuesAtIndexes:tmpIdx forKey:@"sets"];

}

- (void)setSets:(NSMutableArray<NSNumber*> *)sets

{

_sets = sets;

for (int i = 0; i < 100; i++) {

theSet.values[i] = [_sets[i] floatValue];

}

}

- (float)effectValueAtIndex:(NSInteger)idx

{

return [_sets[idx] floatValue];

}

- (NSInteger)countOfValues

{

return 100;

}

#pragma mark Equatable function

- (BOOL)isEqual:(id)anObj

{

if (anObj == NULL) {

return NO;

}

if ([anObj isKindOfClass:[PPFXSetObject class]]) {

PPFXSetObject *unwrapped = anObj;

if (unwrapped.track != self.track) {

return NO;

}

if (unwrapped.identifier != self.identifier) {

return NO;

}

if (unwrapped.effectIdentifier != self.effectIdentifier) {

return NO;

}

if (unwrapped.countOfArguments != self.countOfArguments) {

return NO;

}

if ([unwrapped.name isEqualToString:self.name]) {

return NO;

}

for (int i = 0; i < self.countOfArguments; i++) {

if ([self effectValueAtIndex:i] != [unwrapped effectValueAtIndex:i]) {

return NO;

}

}

return YES;

}

return NO;

}

#pragma mark KVO/KVC helpers

+ (NSSet*)keyPathsForValuesAffectingTheSet

{

return [NSSet setWithObjects:@"track", @"identifier", @"fxIdentifier", @"argumentNumbers", @"effectValues", @"name", @"sets", nil];

}

+ (NSSet *)keyPathsforValuesAffectingEffectValues

{

return [NSSet setWithObject:@"sets"];

}

#pragma mark NSCopying protocol

- (id)copyWithZone:(NSZone *)zone

{

PPFXSetObject *new = [[[self class] alloc] initWithFXSet:&theSet];

if (new) {

new.sets = [_sets mutableCopy];

new.name = _name;

}

return new;

}

#pragma mark NSCoding protocol

+ (BOOL)supportsSecureCoding

{

return YES;

}

- (instancetype)initWithCoder:(NSCoder *)aDecoder

{

if (self = [super init]) {

self.name = [aDecoder decodeObjectForKey:kPPName];

self.effectIdentifier = [aDecoder decodeIntForKey:kPPFXIdentifier];

self.sets = [(NSArray*)[aDecoder decodeObjectForKey:kPPValues] mutableCopy];

self.track = [aDecoder decodeIntForKey:kPPTrack];

self.identifier = [aDecoder decodeIntForKey:kPPIdentifier];

self.countOfArguments = [aDecoder decodeIntForKey:kPPArgumentNumbers];

}

return self;

}

- (void)encodeWithCoder:(NSCoder *)aCoder

{

[aCoder encodeObject:self.name forKey:kPPName];

[aCoder encodeObject:_sets forKey:kPPValues];

[aCoder encodeInt:self.effectIdentifier forKey:kPPFXIdentifier];

[aCoder encodeInt:self.track forKey:kPPTrack];

[aCoder encodeInt:self.countOfArguments forKey:kPPArgumentNumbers];

[aCoder encodeInt:self.identifier forKey:kPPIdentifier];

}

@end

SourceForge

Create a Project

Open Source Software

Business Software

Top Downloaded Projects

Company

About

Team

SourceForge Headquarters
225 Broadway Suite 1600
San Diego, CA 92101
+1 (858) 422-6466

Resources

Support

Site Documentation

Site Status

SourceForge Reviews

© 2025 Slashdot Media. All Rights Reserved.

Terms Privacy Opt Out Advertise

×
Want the latest updates on software, tech news, and AI?

Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.

Submit