Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UADE integration #17

Merged
merged 5 commits into from
Nov 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 56 additions & 10 deletions 4champ.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
45AA90F520FF2F6600794147 /* RESTRoutes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45AA90F420FF2F6600794147 /* RESTRoutes.swift */; };
45AA910220FF36C200794147 /* Replay.m in Sources */ = {isa = PBXBuildFile; fileRef = 45AA90F720FF36C200794147 /* Replay.m */; };
45AA910320FF36C200794147 /* hvl_replay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45AA90F920FF36C200794147 /* hvl_replay.cpp */; };
45AA910420FF36C200794147 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 45AA90FA20FF36C200794147 /* LICENSE */; };
45AA910520FF36C200794147 /* HVLReplayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 45AA90FB20FF36C200794147 /* HVLReplayer.mm */; };
45AA910620FF36C200794147 /* MPTReplayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 45AA910120FF36C200794147 /* MPTReplayer.m */; };
45AA910E20FF5E8A00794147 /* Structs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45AA910D20FF5E8A00794147 /* Structs.swift */; };
Expand All @@ -94,9 +93,26 @@
735A2742264FDFDE004EAC0C /* SwiftyBeaver in Frameworks */ = {isa = PBXBuildFile; productRef = 735A2741264FDFDE004EAC0C /* SwiftyBeaver */; };
735A2746264FE01D004EAC0C /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 735A2745264FE01D004EAC0C /* Alamofire */; };
73759FD228EB34DF00535F8E /* libopenmpt.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73759FD128EB34DF00535F8E /* libopenmpt.xcframework */; };
7397C1DE29091504002D5CDB /* UADEReplayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7397C1DC29091504002D5CDB /* UADEReplayer.m */; };
7397C1E629091D9D002D5CDB /* uade_ios.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7397C1E129091BC3002D5CDB /* uade_ios.xcframework */; };
7397C1E729091D9D002D5CDB /* uade_ios.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7397C1E129091BC3002D5CDB /* uade_ios.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
739B4BF42720850200C2D69F /* RadioSessionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 739B4BF32720850200C2D69F /* RadioSessionCell.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
7397C1E829091D9D002D5CDB /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
7397C1E729091D9D002D5CDB /* uade_ios.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
4509EA43226251EF0031408D /* ModuleInfo+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ModuleInfo+CoreDataClass.swift"; sourceTree = "<group>"; };
4509EA44226251EF0031408D /* ModuleInfo+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ModuleInfo+CoreDataProperties.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -208,6 +224,9 @@
45D61F6220E1863600869814 /* Gzip.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Gzip.framework; path = Carthage/Build/iOS/Gzip.framework; sourceTree = "<group>"; };
735A274D264FE9EA004EAC0C /* AmpCDModel 9 (imports).xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "AmpCDModel 9 (imports).xcdatamodel"; sourceTree = "<group>"; };
73759FD128EB34DF00535F8E /* libopenmpt.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = libopenmpt.xcframework; path = ../openmpt/libopenmpt.xcframework; sourceTree = "<group>"; };
7397C1DA29091504002D5CDB /* UADEReplayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UADEReplayer.h; sourceTree = "<group>"; };
7397C1DC29091504002D5CDB /* UADEReplayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UADEReplayer.m; sourceTree = "<group>"; };
7397C1E129091BC3002D5CDB /* uade_ios.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = uade_ios.xcframework; path = "../uade-ios/uade_ios.xcframework"; sourceTree = "<group>"; };
739B4BF32720850200C2D69F /* RadioSessionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSessionCell.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -216,6 +235,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7397C1E629091D9D002D5CDB /* uade_ios.xcframework in Frameworks */,
73759FD228EB34DF00535F8E /* libopenmpt.xcframework in Frameworks */,
735A2746264FE01D004EAC0C /* Alamofire in Frameworks */,
735A273E264FDFAD004EAC0C /* Gzip in Frameworks */,
Expand Down Expand Up @@ -383,6 +403,7 @@
45AA90FE20FF36C200794147 /* Replay.h */,
45AA90F820FF36C200794147 /* Hively */,
45AA90FF20FF36C200794147 /* OpenMPT */,
7397C1D929091504002D5CDB /* UADE */,
);
path = Replay;
sourceTree = "<group>";
Expand Down Expand Up @@ -497,6 +518,7 @@
45D61F5E20E17D9600869814 /* Frameworks */ = {
isa = PBXGroup;
children = (
7397C1E129091BC3002D5CDB /* uade_ios.xcframework */,
73759FD128EB34DF00535F8E /* libopenmpt.xcframework */,
455CC0A52104A0E20094A5D3 /* SwiftyBeaver.framework */,
45D61F6220E1863600869814 /* Gzip.framework */,
Expand All @@ -505,6 +527,15 @@
name = Frameworks;
sourceTree = "<group>";
};
7397C1D929091504002D5CDB /* UADE */ = {
isa = PBXGroup;
children = (
7397C1DA29091504002D5CDB /* UADEReplayer.h */,
7397C1DC29091504002D5CDB /* UADEReplayer.m */,
);
path = UADE;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand All @@ -515,6 +546,7 @@
45D3929D20B1DDEC00EEF4E3 /* Sources */,
45D3929E20B1DDEC00EEF4E3 /* Frameworks */,
45D3929F20B1DDEC00EEF4E3 /* Resources */,
7397C1E829091D9D002D5CDB /* Embed Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -586,7 +618,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
45AA910420FF36C200794147 /* LICENSE in Resources */,
45D392B120B1DDEE00EEF4E3 /* LaunchScreen.storyboard in Resources */,
454F520C21610E94007011F3 /* ModuleCell.xib in Resources */,
454F520E21610F70007011F3 /* GroupCell.xib in Resources */,
Expand Down Expand Up @@ -629,6 +660,7 @@
451ED0B2241E8A83006CE4E8 /* PlaylistInteractor.swift in Sources */,
45D61F5320E1647300869814 /* RadioRouter.swift in Sources */,
453D9BBA241BF286002EEBAB /* PlaylistSelectorRouter.swift in Sources */,
7397C1DE29091504002D5CDB /* UADEReplayer.m in Sources */,
453D9BBD241BF286002EEBAB /* PlaylistSelectorInteractor.swift in Sources */,
45CEA1DF2413C8E300930A72 /* SceneDelegate.swift in Sources */,
4535A4682114BB2D005FBB8B /* SearchViewController.swift in Sources */,
Expand Down Expand Up @@ -861,18 +893,25 @@
CODE_SIGN_ENTITLEMENTS = ampplayer.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 27;
CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = 2G92PSCBJ9;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
HEADER_SEARCH_PATHS = ../openmpt/libopenmpt;
HEADER_SEARCH_PATHS = (
../openmpt/libopenmpt,
"../uade-ios/src/frontends/include",
"../uade-ios/src/include",
);
INFOPLIST_FILE = "$(SRCROOT)/4champ/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = ../openmpt;
MARKETING_VERSION = 3.4;
LIBRARY_SEARCH_PATHS = (
../openmpt,
"../uade-ios",
);
MARKETING_VERSION = 3.5;
PRODUCT_BUNDLE_IDENTIFIER = com.boogiesoftware.ampplayer;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -890,18 +929,25 @@
CODE_SIGN_ENTITLEMENTS = ampplayer.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 27;
CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = 2G92PSCBJ9;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
HEADER_SEARCH_PATHS = ../openmpt/libopenmpt;
HEADER_SEARCH_PATHS = (
../openmpt/libopenmpt,
"../uade-ios/src/frontends/include",
"../uade-ios/src/include",
);
INFOPLIST_FILE = "$(SRCROOT)/4champ/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = ../openmpt;
MARKETING_VERSION = 3.4;
LIBRARY_SEARCH_PATHS = (
../openmpt,
"../uade-ios",
);
MARKETING_VERSION = 3.5;
PRODUCT_BUNDLE_IDENTIFIER = com.boogiesoftware.ampplayer;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion 4champ/Data/Structs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct MMD: Identifiable {
init() {
}

static let supportedTypes: [String] = "669, AMF, AMS, DBM, DIGI, DMF, DSM, DTM, FAR, IT, GDM, ST26, IMF, J2B, M15, MED, MDL, MOD, MTM, NST, OCT, OKT, OSS, PTM, PSM, S3M, STM, SFX, SFX2, ULT, UMX, WOW, XM, FST, STK, MMCMP, MMS, MO3, MPTM, OK, PLM, PPM, PT36, AHX, THX, HVL".split(separator: ",").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
static let supportedTypes: [String] = Replay.supportedFormats

init(cdi: ModuleInfo) {
self.init()
Expand Down
9 changes: 7 additions & 2 deletions 4champ/Replay/Hively/HVLReplayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ @implementation HVLReplayer {

int hvlStereoSeparation;
}


static int iHivelyBufPos = 0;

+ (NSArray<NSString*>*)supportedFormats {
return @[@"THX", @"AHX", @"HVL"];
}

- (HVLReplayer*) init {
self = [super init];
Expand Down Expand Up @@ -59,6 +60,10 @@ defstereo is the stereo seperation for playing AHX tunes (HVL tunes override
}

- (void)dealloc {
NSLog(@"HVLReplayer deallocated");
}

- (void) cleanup {
if (currentHVLtune) {
hvl_FreeTune(currentHVLtune);
free(leftByte);
Expand Down
58 changes: 55 additions & 3 deletions 4champ/Replay/OpenMPT/MPTReplayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,71 @@ @implementation MPTReplayer {
openmpt_module* currentOMPTFile;
}

+ (NSArray<NSString*>*)supportedFormats {
return @[@"669",
@"AMF",
@"AMS",
@"DBM",
@"DIGI",
@"DMF",
@"DSM",
@"DTM",
@"FAR",
@"IT",
@"GDM",
@"ST26",
@"IMF",
@"J2B",
@"M15",
//@"MED", Handled by UADE
@"MDL",
@"MOD",
@"MT2",
@"MTM",
@"NST",
@"OCT",
@"OKT",
@"OSS",
@"PTM",
@"PSM",
@"S3M",
@"STM",
@"SFX",
@"SFX2",
@"ULT",
@"UMX",
@"WOW",
@"XM",
@"FST",
@"STK",
@"MMCMP",
@"MMS",
@"MO3",
@"MPTM",
@"OK",
@"PLM",
@"PPM",
@"PT36"];
}

- (bool) loadModule:(NSString *)path type:(NSString*)type {
NSData* data = [[NSFileManager defaultManager] contentsAtPath:path];
if (!data) return false;

[self cleanup];
currentOMPTFile = openmpt_module_create_from_memory2(data.bytes, (uint32_t)data.length, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (!currentOMPTFile) return false;
return true;
}

- (void)dealloc {
if (currentOMPTFile) {
openmpt_module_destroy(currentOMPTFile);
}
NSLog(@"MTPReplayer deallocated");
}

- (void) cleanup {
if (currentOMPTFile) {
openmpt_module_destroy(currentOMPTFile);
}
}

- (int) readFrames:(size_t)count bufLeft:(int16_t*)bufLeft bufRight:(int16_t*)bufRight {
Expand Down
19 changes: 16 additions & 3 deletions 4champ/Replay/Replay.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@

#import <Foundation/Foundation.h>

/// The Replay control API
@protocol ReplayControl <NSObject>
// Control API

/**
Supported @formats
*/
@property (class, nonatomic, strong, readonly) NSArray<NSString*>* supportedFormats;

/**
Loads module for playback from given path.
@param path identifies the module file. Path extension can identify format (type)
Expand All @@ -35,10 +41,16 @@
in libpopenmpt.h
*/
- (void) setInterpolationFilterLength:(NSInteger)value;

/**
Free replayer resources
*/
- (void) cleanup;

@end

/// Visualisation API getters
@protocol ReplayInformation <NSObject>
// Visualisation API getters
- (int) currentPosition; //returns current position in current module
- (int) moduleLength; //returns current mod length in seconds
- (NSInteger) volumeOnChannel:(NSInteger)channel; //returns current volume on requested channel
Expand All @@ -47,14 +59,15 @@
- (NSArray<NSString*>*) getInstruments; //returns instrument names of current mod
@end

/// Stream API for getting rendered frames for output
@protocol ReplayerStream <NSObject>
// Stream API
- (int) readFrames:(size_t)count bufLeft:(int16_t*)bufLeft bufRight:(int16_t*)bufRight;
@end

@class Replay;

@protocol ReplayStreamDelegate <NSObject>

/**
Called when replay reaches end of the module
@param replay identifies the Replay object
Expand Down
Loading