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 / PPMadCommandObject.m  Maximize  Restore  History

Download this file

209 lines (171 with data), 4.5 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

//

// PPMadCommandObject.m

// PPMacho

//

// Created by C.W. Betts on 1/17/13.

//

//

#include <PlayerPROCore/PlayerPROCore.h>

#import "PPMadCommandObject.h"

#include <PlayerPROCore/RDriverInt.h>

#if TARGET_OS_OSX

#import "PPPasteboardHandling.h"

#endif

#define kPPMadCommandInstrument @"PlayerPROKit Cmd Instrument"

#define kPPMadCommandNote @"PlayerPROKit Cmd Note"

#define kPPMadCommandCommand @"PlayerPROKit Cmd Command"

#define kPPMadCommandArgument @"PlayerPROKit Cmd Argument"

#define kPPMadCommandVolume @"PlayerPROKit Cmd Volume"

@implementation PPMadCommandObject

{

@private

Cmd theCommand;

}

#if TARGET_OS_OSX

NSString * const kPPKMADCommandPasteboardUTI = @"net.sourceforge.playerpro.MADCommand";

static NSArray *UTIArray;

static dispatch_once_t initUTIOnceToken;

static const dispatch_block_t initUTIArray = ^{

UTIArray = @[kPPKMADCommandPasteboardUTI];

};

+ (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:kPPKMADCommandPasteboardUTI])

return [NSKeyedArchiver archivedDataWithRootObject:self];

else

return nil;

}

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

{

if ([type isEqualToString:kPPKMADCommandPasteboardUTI])

return NSPasteboardReadingAsKeyedArchive;

else

return NSPasteboardReadingAsData;

}

#endif

@synthesize theCommand;

- (MADByte)instrument

{

return theCommand.ins;

}

- (void)setInstrument:(MADByte)instrument

{

theCommand.ins = instrument;

}

- (MADByte)note

{

return theCommand.note;

}

- (void)setNote:(MADByte)note

{

theCommand.note = note;

}

- (MADEffectID)command

{

return theCommand.cmd;

}

- (void)setCommand:(MADEffectID)command

{

theCommand.cmd = command;

}

- (MADByte)argument

{

return theCommand.arg;

}

- (void)setArgument:(MADByte)argument

{

theCommand.arg = argument;

}

- (MADByte)volume

{

return theCommand.vol;

}

- (void)setVolume:(MADByte)volume

{

theCommand.vol = volume;

}

- (instancetype)init

{

return [self initWithCmdPtr:NULL];

}

- (instancetype)initWithCmd:(Cmd)theCmd

{

Cmd aCmd = theCmd;

return [self initWithCmdPtr:&aCmd];

}

- (instancetype)initWithCmdPtr:(Cmd *)theCmd

{

if (self = [super init]) {

if (!theCmd) {

[self reset];

} else {

theCommand = *theCmd;

}

}

return self;

}

- (id)copyWithZone:(NSZone *)zone

{

return [[[self class] alloc] initWithCmdPtr:&theCommand];

}

- (void)reset

{

[self willChangeValueForKey:@"theCommand"];

MADKillCmd(&theCommand);

[self didChangeValueForKey:@"theCommand"];

}

- (NSString*)description

{

return [NSString stringWithFormat:@"ins: %u note: %u cmd: %u arg: %u vol: %u", theCommand.ins, theCommand.note, theCommand.cmd, theCommand.arg, theCommand.vol];

}

#pragma mark KVO/KVC helpers

+ (NSSet*)keyPathsForValuesAffectingTheCommand

{

return [NSSet setWithObjects:@"instrument", @"note", @"command", @"argument", @"volume", nil];

}

#define keyVal(theVal) \

+ (NSSet*)keyPathsForValuesAffecting ## theVal \

{ \

return [NSSet setWithObject:@"theCommand"]; \

}

keyVal(Instrument)

keyVal(Note)

keyVal(Command)

keyVal(Argument)

keyVal(Volume)

#undef keyVal

#pragma mark NSCoding protocol

+ (BOOL)supportsSecureCoding

{

return YES;

}

- (instancetype)initWithCoder:(NSCoder *)aDecoder

{

if (self = [super init]) {

theCommand.ins = [(NSNumber*)[aDecoder decodeObjectForKey:kPPMadCommandInstrument] unsignedCharValue];

theCommand.arg = [(NSNumber*)[aDecoder decodeObjectForKey:kPPMadCommandArgument] unsignedCharValue];

theCommand.cmd = [(NSNumber*)[aDecoder decodeObjectForKey:kPPMadCommandCommand] unsignedCharValue];

theCommand.note = [(NSNumber*)[aDecoder decodeObjectForKey:kPPMadCommandNote] unsignedCharValue];

theCommand.vol = [(NSNumber*)[aDecoder decodeObjectForKey:kPPMadCommandVolume] unsignedCharValue];

}

return self;

}

- (void)encodeWithCoder:(NSCoder *)aCoder

{

[aCoder encodeObject:@(theCommand.ins) forKey:kPPMadCommandInstrument];

[aCoder encodeObject:@(theCommand.cmd) forKey:kPPMadCommandCommand];

[aCoder encodeObject:@(theCommand.arg) forKey:kPPMadCommandArgument];

[aCoder encodeObject:@(theCommand.note) forKey:kPPMadCommandNote];

[aCoder encodeObject:@(theCommand.vol) forKey:kPPMadCommandVolume];

}

@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