Setting Repeat One will now direct all synthesizing decoders to run forever, rather than merely restarting repeatedly. Playptmod now cuts off length detection after half an hour, in case some files' loops are not detected.
This commit is contained in:
parent
7531b3324f
commit
9cd138384d
13 changed files with 57 additions and 10 deletions
|
@ -22,6 +22,11 @@ typedef enum {
|
||||||
RepeatAll
|
RepeatAll
|
||||||
} RepeatMode;
|
} RepeatMode;
|
||||||
|
|
||||||
|
static BOOL IsRepeatOneSet()
|
||||||
|
{
|
||||||
|
return [[NSUserDefaults standardUserDefaults] integerForKey:@"repeat"] == RepeatOne;
|
||||||
|
}
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ShuffleOff = 0,
|
ShuffleOff = 0,
|
||||||
ShuffleAlbums,
|
ShuffleAlbums,
|
||||||
|
|
|
@ -96,6 +96,7 @@
|
||||||
83527EE918243029002F170E /* mo3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mo3.h; path = mo3/mo3.h; sourceTree = "<group>"; };
|
83527EE918243029002F170E /* mo3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mo3.h; path = mo3/mo3.h; sourceTree = "<group>"; };
|
||||||
83527EEA18243069002F170E /* mo3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mo3.c; path = mo3/mo3.c; sourceTree = "<group>"; };
|
83527EEA18243069002F170E /* mo3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mo3.c; path = mo3/mo3.c; sourceTree = "<group>"; };
|
||||||
8384912B1808155E00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
|
8384912B1808155E00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
|
||||||
|
83FAF8A418ADD45600057CAF /* PlaylistController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlaylistController.h; path = ../../Playlist/PlaylistController.h; sourceTree = "<group>"; };
|
||||||
8D5B49B6048680CD000E48DA /* Dumb.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Dumb.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
8D5B49B6048680CD000E48DA /* Dumb.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Dumb.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
||||||
|
@ -150,6 +151,7 @@
|
||||||
08FB77AFFE84173DC02AAC07 /* Classes */ = {
|
08FB77AFFE84173DC02AAC07 /* Classes */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
83FAF8A418ADD45600057CAF /* PlaylistController.h */,
|
||||||
8337AAE317FFA0000081AFF8 /* archive */,
|
8337AAE317FFA0000081AFF8 /* archive */,
|
||||||
8384912B1808155E00E7332D /* Logging.h */,
|
8384912B1808155E00E7332D /* Logging.h */,
|
||||||
8335FF6517FF6FD9002D8DD2 /* DumbContainer.h */,
|
8335FF6517FF6FD9002D8DD2 /* DumbContainer.h */,
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
#import "PlaylistController.h"
|
||||||
|
|
||||||
@implementation DumbDecoder
|
@implementation DumbDecoder
|
||||||
|
|
||||||
struct MEMANDFREEFILE
|
struct MEMANDFREEFILE
|
||||||
|
@ -260,7 +262,7 @@ int callbackLoop(void *data)
|
||||||
((float *)buf)[(total * 2) + i] = (float)sampptr[0][i] * scale;
|
((float *)buf)[(total * 2) + i] = (float)sampptr[0][i] * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( loops >= 2 ) {
|
if ( !IsRepeatOneSet() && loops >= 2 ) {
|
||||||
float * sampleBuf = ( float * ) buf + total * 2;
|
float * sampleBuf = ( float * ) buf + total * 2;
|
||||||
long fadeEnd = fadeRemain - rendered;
|
long fadeEnd = fadeRemain - rendered;
|
||||||
if ( fadeEnd < 0 )
|
if ( fadeEnd < 0 )
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
17DA34B90CC052030003F6B2 /* GameMetadataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameMetadataReader.m; sourceTree = "<group>"; };
|
17DA34B90CC052030003F6B2 /* GameMetadataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameMetadataReader.m; sourceTree = "<group>"; };
|
||||||
32DBCF630370AF2F00C91783 /* GME_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GME_Prefix.pch; sourceTree = "<group>"; };
|
32DBCF630370AF2F00C91783 /* GME_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GME_Prefix.pch; sourceTree = "<group>"; };
|
||||||
8384912E1808175400E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
|
8384912E1808175400E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
|
||||||
|
83FAF8A518ADD4D100057CAF /* PlaylistController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlaylistController.h; path = ../../Playlist/PlaylistController.h; sourceTree = "<group>"; };
|
||||||
8D5B49B6048680CD000E48DA /* GME.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GME.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
8D5B49B6048680CD000E48DA /* GME.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GME.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
||||||
|
@ -120,6 +121,7 @@
|
||||||
08FB77AFFE84173DC02AAC07 /* Classes */ = {
|
08FB77AFFE84173DC02AAC07 /* Classes */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
83FAF8A518ADD4D100057CAF /* PlaylistController.h */,
|
||||||
8384912E1808175400E7332D /* Logging.h */,
|
8384912E1808175400E7332D /* Logging.h */,
|
||||||
17C8F3470CBED3C7008D969D /* Plugin.h */,
|
17C8F3470CBED3C7008D969D /* Plugin.h */,
|
||||||
17C8F33B0CBED3BE008D969D /* GameContainer.h */,
|
17C8F33B0CBED3BE008D969D /* GameContainer.h */,
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#import "Logging.h"
|
#import "Logging.h"
|
||||||
|
|
||||||
|
#import "PlaylistController.h"
|
||||||
|
|
||||||
@implementation GameDecoder
|
@implementation GameDecoder
|
||||||
|
|
||||||
gme_err_t readCallback( void* data, void* out, long count )
|
gme_err_t readCallback( void* data, void* out, long count )
|
||||||
|
@ -103,8 +105,6 @@ gme_err_t readCallback( void* data, void* out, long count )
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
gme_set_fade( emu, length, 8000 );
|
|
||||||
|
|
||||||
length += 8000;
|
length += 8000;
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,6 +135,11 @@ gme_err_t readCallback( void* data, void* out, long count )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( IsRepeatOneSet() )
|
||||||
|
gme_set_fade( emu, INT_MAX, 0 );
|
||||||
|
else
|
||||||
|
gme_set_fade( emu, length - 8000, 8000 );
|
||||||
|
|
||||||
gme_play(emu, numSamples, (short int *)buf);
|
gme_play(emu, numSamples, (short int *)buf);
|
||||||
|
|
||||||
//Some formats support length, but we'll add that in the future.
|
//Some formats support length, but we'll add that in the future.
|
||||||
|
|
|
@ -181,6 +181,7 @@
|
||||||
83D4481B18ACA5AD000F443A /* lazyusf */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = lazyusf; path = ../../ThirdParty/lazyusf/lazyusf; sourceTree = "<group>"; };
|
83D4481B18ACA5AD000F443A /* lazyusf */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = lazyusf; path = ../../ThirdParty/lazyusf/lazyusf; sourceTree = "<group>"; };
|
||||||
83DE0C34180A9BD400269051 /* vio2sf.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = vio2sf.xcodeproj; path = ../../Frameworks/vio2sf/vio2sf.xcodeproj; sourceTree = "<group>"; };
|
83DE0C34180A9BD400269051 /* vio2sf.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = vio2sf.xcodeproj; path = ../../Frameworks/vio2sf/vio2sf.xcodeproj; sourceTree = "<group>"; };
|
||||||
83DE0CBF180B27C200269051 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
|
83DE0CBF180B27C200269051 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
|
||||||
|
83FAF8A318ADD27F00057CAF /* PlaylistController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlaylistController.h; path = ../../../Playlist/PlaylistController.h; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -283,6 +284,7 @@
|
||||||
8360EEED17F92AC8005208A4 /* HighlyComplete */ = {
|
8360EEED17F92AC8005208A4 /* HighlyComplete */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
83FAF8A318ADD27F00057CAF /* PlaylistController.h */,
|
||||||
8324C584181513A10046F78F /* circular_buffer.h */,
|
8324C584181513A10046F78F /* circular_buffer.h */,
|
||||||
834379A717F9818400584396 /* HCDecoder.mm */,
|
834379A717F9818400584396 /* HCDecoder.mm */,
|
||||||
8343786117F944BD00584396 /* hebios.h */,
|
8343786117F944BD00584396 /* hebios.h */,
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
#import "PlaylistController.h"
|
||||||
|
|
||||||
// #define USF_LOG
|
// #define USF_LOG
|
||||||
|
|
||||||
@interface psf_file_container : NSObject {
|
@interface psf_file_container : NSObject {
|
||||||
|
@ -1428,6 +1430,8 @@ static int usf_info(void * context, const char * name, const char * value)
|
||||||
long frames_left = totalFrames - framesRead - silence_test_buffer.data_available() / 2;
|
long frames_left = totalFrames - framesRead - silence_test_buffer.data_available() / 2;
|
||||||
if ( partial ) frames_left = 1024;
|
if ( partial ) frames_left = 1024;
|
||||||
long free_space = silence_test_buffer.free_space() / 2;
|
long free_space = silence_test_buffer.free_space() / 2;
|
||||||
|
if ( IsRepeatOneSet() )
|
||||||
|
frames_left = free_space;
|
||||||
if ( free_space > frames_left )
|
if ( free_space > frames_left )
|
||||||
free_space = frames_left;
|
free_space = frames_left;
|
||||||
while ( free_space > 0 )
|
while ( free_space > 0 )
|
||||||
|
@ -1550,14 +1554,14 @@ static int usf_info(void * context, const char * name, const char * value)
|
||||||
unsigned long written = silence_test_buffer.data_available() / 2;
|
unsigned long written = silence_test_buffer.data_available() / 2;
|
||||||
if ( written > frames )
|
if ( written > frames )
|
||||||
written = frames;
|
written = frames;
|
||||||
if ( written > totalFrames - framesRead )
|
if ( !IsRepeatOneSet() && written > totalFrames - framesRead )
|
||||||
written = totalFrames - framesRead;
|
written = totalFrames - framesRead;
|
||||||
if ( written == 0 )
|
if ( written == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
silence_test_buffer.read( (int16_t *) buf, written * 2 );
|
silence_test_buffer.read( (int16_t *) buf, written * 2 );
|
||||||
|
|
||||||
if ( framesRead + written > framesLength ) {
|
if ( !IsRepeatOneSet() && framesRead + written > framesLength ) {
|
||||||
long fadeStart = (framesLength > framesRead) ? framesLength : framesRead;
|
long fadeStart = (framesLength > framesRead) ? framesLength : framesRead;
|
||||||
long fadeEnd = framesRead + written;
|
long fadeEnd = framesRead + written;
|
||||||
long fadeTotal = totalFrames - framesLength;
|
long fadeTotal = totalFrames - framesLength;
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
831C7F6918ADD73F00CE4A69 /* PlaylistController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlaylistController.h; path = ../../../Playlist/PlaylistController.h; sourceTree = "<group>"; };
|
||||||
836FB52D1820538700B3AD2D /* Hively.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Hively.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
836FB52D1820538700B3AD2D /* Hively.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Hively.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
836FB5301820538700B3AD2D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
836FB5301820538700B3AD2D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
||||||
836FB5331820538700B3AD2D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
836FB5331820538700B3AD2D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||||
|
@ -118,6 +119,7 @@
|
||||||
836FB5361820538700B3AD2D /* Hively */ = {
|
836FB5361820538700B3AD2D /* Hively */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
831C7F6918ADD73F00CE4A69 /* PlaylistController.h */,
|
||||||
836FB5A31820557E00B3AD2D /* Plugin.h */,
|
836FB5A31820557E00B3AD2D /* Plugin.h */,
|
||||||
836FB59A1820556F00B3AD2D /* HVLDecoder.h */,
|
836FB59A1820556F00B3AD2D /* HVLDecoder.h */,
|
||||||
836FB59B1820556F00B3AD2D /* HVLDecoder.m */,
|
836FB59B1820556F00B3AD2D /* HVLDecoder.m */,
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#import "HVLDecoder.h"
|
#import "HVLDecoder.h"
|
||||||
|
|
||||||
|
#import "PlaylistController.h"
|
||||||
|
|
||||||
@implementation HVLDecoder
|
@implementation HVLDecoder
|
||||||
|
|
||||||
void oneTimeInit()
|
void oneTimeInit()
|
||||||
|
@ -99,7 +101,9 @@ void oneTimeInit()
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames
|
- (int)readAudio:(void *)buf frames:(UInt32)frames
|
||||||
{
|
{
|
||||||
if (framesRead >= totalFrames)
|
BOOL repeatone = IsRepeatOneSet();
|
||||||
|
|
||||||
|
if (!repeatone && framesRead >= totalFrames)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int total = 0;
|
int total = 0;
|
||||||
|
@ -128,7 +132,7 @@ void oneTimeInit()
|
||||||
framesInBuffer = 44100 / 50;
|
framesInBuffer = 44100 / 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( framesRead + total > framesLength ) {
|
if ( !repeatone && framesRead + total > framesLength ) {
|
||||||
long fadeStart = (framesLength > framesRead) ? framesLength : framesRead;
|
long fadeStart = (framesLength > framesRead) ? framesLength : framesRead;
|
||||||
long fadeEnd = (framesRead + total) > totalFrames ? totalFrames : (framesRead + total);
|
long fadeEnd = (framesRead + total) > totalFrames ? totalFrames : (framesRead + total);
|
||||||
long fadePos;
|
long fadePos;
|
||||||
|
|
|
@ -99,6 +99,7 @@
|
||||||
83C35701180EDB74007E9DF0 /* MIDIContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIDIContainer.h; sourceTree = "<group>"; };
|
83C35701180EDB74007E9DF0 /* MIDIContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIDIContainer.h; sourceTree = "<group>"; };
|
||||||
83C35703180EDD1C007E9DF0 /* MIDIMetadataReader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MIDIMetadataReader.mm; sourceTree = "<group>"; };
|
83C35703180EDD1C007E9DF0 /* MIDIMetadataReader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MIDIMetadataReader.mm; sourceTree = "<group>"; };
|
||||||
83C35704180EDD1C007E9DF0 /* MIDIMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIDIMetadataReader.h; sourceTree = "<group>"; };
|
83C35704180EDD1C007E9DF0 /* MIDIMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIDIMetadataReader.h; sourceTree = "<group>"; };
|
||||||
|
83FAF8A618ADD60100057CAF /* PlaylistController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlaylistController.h; path = ../../../Playlist/PlaylistController.h; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -162,6 +163,7 @@
|
||||||
83B06690180D5668008E3612 /* MIDI */ = {
|
83B06690180D5668008E3612 /* MIDI */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
83FAF8A618ADD60100057CAF /* PlaylistController.h */,
|
||||||
83C35703180EDD1C007E9DF0 /* MIDIMetadataReader.mm */,
|
83C35703180EDD1C007E9DF0 /* MIDIMetadataReader.mm */,
|
||||||
83C35704180EDD1C007E9DF0 /* MIDIMetadataReader.h */,
|
83C35704180EDD1C007E9DF0 /* MIDIMetadataReader.h */,
|
||||||
83C35700180EDB74007E9DF0 /* MIDIContainer.mm */,
|
83C35700180EDB74007E9DF0 /* MIDIContainer.mm */,
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#import <midi_processing/midi_processor.h>
|
#import <midi_processing/midi_processor.h>
|
||||||
|
|
||||||
|
#import "PlaylistController.h"
|
||||||
|
|
||||||
@implementation MIDIDecoder
|
@implementation MIDIDecoder
|
||||||
|
|
||||||
+ (NSInteger)testExtensions:(NSString *)pathMinusExtension extensions:(NSArray *)extensionsToTest
|
+ (NSInteger)testExtensions:(NSString *)pathMinusExtension extensions:(NSArray *)extensionsToTest
|
||||||
|
@ -148,7 +150,9 @@
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames
|
- (int)readAudio:(void *)buf frames:(UInt32)frames
|
||||||
{
|
{
|
||||||
if ( framesRead >= totalFrames )
|
BOOL repeatone = IsRepeatOneSet();
|
||||||
|
|
||||||
|
if ( !repeatone && framesRead >= totalFrames )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !soundFontsAssigned ) {
|
if ( !soundFontsAssigned ) {
|
||||||
|
@ -163,7 +167,7 @@
|
||||||
|
|
||||||
player->Play( (float *) buf, frames );
|
player->Play( (float *) buf, frames );
|
||||||
|
|
||||||
if ( framesRead + frames > framesLength ) {
|
if ( !repeatone && framesRead + frames > framesLength ) {
|
||||||
if ( framesFade ) {
|
if ( framesFade ) {
|
||||||
long fadeStart = (framesLength > framesRead) ? framesLength : framesRead;
|
long fadeStart = (framesLength > framesRead) ? framesLength : framesRead;
|
||||||
long fadeEnd = (framesRead + frames > totalFrames) ? totalFrames : (framesRead + frames);
|
long fadeEnd = (framesRead + frames > totalFrames) ? totalFrames : (framesRead + frames);
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
83A0F4DD1816D09000119DB4 /* ptmodDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ptmodDecoder.m; sourceTree = "<group>"; };
|
83A0F4DD1816D09000119DB4 /* ptmodDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ptmodDecoder.m; sourceTree = "<group>"; };
|
||||||
83A0F4DF1816D0AF00119DB4 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../../Audio/Plugin.h; sourceTree = "<group>"; };
|
83A0F4DF1816D0AF00119DB4 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../../Audio/Plugin.h; sourceTree = "<group>"; };
|
||||||
83A0F4E01816D13000119DB4 /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../../Utils/Logging.h; sourceTree = "<group>"; };
|
83A0F4E01816D13000119DB4 /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../../Utils/Logging.h; sourceTree = "<group>"; };
|
||||||
|
83FAF8A718ADD65200057CAF /* PlaylistController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlaylistController.h; path = ../../../Playlist/PlaylistController.h; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -113,6 +114,7 @@
|
||||||
83A0F4781816CE5E00119DB4 /* playptmod */ = {
|
83A0F4781816CE5E00119DB4 /* playptmod */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
83FAF8A718ADD65200057CAF /* PlaylistController.h */,
|
||||||
83A0F4E01816D13000119DB4 /* Logging.h */,
|
83A0F4E01816D13000119DB4 /* Logging.h */,
|
||||||
83A0F4DF1816D0AF00119DB4 /* Plugin.h */,
|
83A0F4DF1816D0AF00119DB4 /* Plugin.h */,
|
||||||
83A0F4DC1816D09000119DB4 /* ptmodDecoder.h */,
|
83A0F4DC1816D09000119DB4 /* ptmodDecoder.h */,
|
||||||
|
|
|
@ -31,12 +31,23 @@ BOOL probe_length( unsigned long * intro_length, unsigned long * loop_length, in
|
||||||
unsigned long length_total = 0;
|
unsigned long length_total = 0;
|
||||||
unsigned long length_saved;
|
unsigned long length_saved;
|
||||||
|
|
||||||
while ( playptmod_LoopCounter( ptmod ) < 1 )
|
const long length_safety = 44100 * 60 * 30;
|
||||||
|
|
||||||
|
while ( playptmod_LoopCounter( ptmod ) < 1 && length_total < length_safety )
|
||||||
{
|
{
|
||||||
playptmod_Render( ptmod, NULL, 512 );
|
playptmod_Render( ptmod, NULL, 512 );
|
||||||
length_total += 512;
|
length_total += 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( playptmod_LoopCounter( ptmod ) < 1 )
|
||||||
|
{
|
||||||
|
*loop_length = 0;
|
||||||
|
*intro_length = 44100 * 60 * 3;
|
||||||
|
playptmod_Stop( ptmod );
|
||||||
|
playptmod_Free( ptmod );
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
length_saved = length_total;
|
length_saved = length_total;
|
||||||
|
|
||||||
while ( playptmod_LoopCounter( ptmod ) < 2 )
|
while ( playptmod_LoopCounter( ptmod ) < 2 )
|
||||||
|
|
Loading…
Reference in a new issue