Cleaned up minor warnings and removed unnecessary imports
parent
d20973235b
commit
a3dfee75f8
|
@ -63,7 +63,6 @@
|
||||||
836FB59E1820556F00B3AD2D /* HVLContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HVLContainer.h; sourceTree = "<group>"; };
|
836FB59E1820556F00B3AD2D /* HVLContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HVLContainer.h; sourceTree = "<group>"; };
|
||||||
836FB59F1820556F00B3AD2D /* HVLContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HVLContainer.m; sourceTree = "<group>"; };
|
836FB59F1820556F00B3AD2D /* HVLContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HVLContainer.m; sourceTree = "<group>"; };
|
||||||
836FB5A31820557E00B3AD2D /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../../Audio/Plugin.h; sourceTree = "<group>"; };
|
836FB5A31820557E00B3AD2D /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../../Audio/Plugin.h; sourceTree = "<group>"; };
|
||||||
836FB5A41820558900B3AD2D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../../Utils/Logging.h; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -119,7 +118,6 @@
|
||||||
836FB5361820538700B3AD2D /* Hively */ = {
|
836FB5361820538700B3AD2D /* Hively */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
836FB5A41820558900B3AD2D /* Logging.h */,
|
|
||||||
836FB5A31820557E00B3AD2D /* Plugin.h */,
|
836FB5A31820557E00B3AD2D /* Plugin.h */,
|
||||||
836FB59A1820556F00B3AD2D /* HVLDecoder.h */,
|
836FB59A1820556F00B3AD2D /* HVLDecoder.h */,
|
||||||
836FB59B1820556F00B3AD2D /* HVLDecoder.m */,
|
836FB59B1820556F00B3AD2D /* HVLDecoder.m */,
|
||||||
|
@ -371,6 +369,7 @@
|
||||||
836FB5411820538700B3AD2D /* Release */,
|
836FB5411820538700B3AD2D /* Release */,
|
||||||
);
|
);
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#import "HVLContainer.h"
|
#import "HVLContainer.h"
|
||||||
#import "HVLDecoder.h"
|
#import "HVLDecoder.h"
|
||||||
|
|
||||||
#import "Logging.h"
|
|
||||||
|
|
||||||
@implementation HVLContainer
|
@implementation HVLContainer
|
||||||
|
|
||||||
+ (NSArray *)fileTypes
|
+ (NSArray *)fileTypes
|
||||||
|
@ -43,10 +41,13 @@
|
||||||
long size = [source tell];
|
long size = [source tell];
|
||||||
[source seek:0 whence:SEEK_SET];
|
[source seek:0 whence:SEEK_SET];
|
||||||
|
|
||||||
|
if ( size > UINT_MAX )
|
||||||
|
return nil;
|
||||||
|
|
||||||
void * data = malloc(size);
|
void * data = malloc(size);
|
||||||
[source read:data amount:size];
|
[source read:data amount:size];
|
||||||
|
|
||||||
struct hvl_tune * tune = hvl_LoadTune( data, size, 44100, 2 );
|
struct hvl_tune * tune = hvl_LoadTune( data, (uint32_t) size, 44100, 2 );
|
||||||
free( data );
|
free( data );
|
||||||
if ( !tune )
|
if ( !tune )
|
||||||
return nil;
|
return nil;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
@interface HVLDecoder : NSObject <CogDecoder> {
|
@interface HVLDecoder : NSObject <CogDecoder> {
|
||||||
struct hvl_tune *tune;
|
struct hvl_tune *tune;
|
||||||
int32_t *buffer;
|
int32_t *buffer;
|
||||||
long trackNumber;
|
int trackNumber;
|
||||||
|
|
||||||
long totalFrames;
|
long totalFrames;
|
||||||
long framesLength;
|
long framesLength;
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
#import "HVLDecoder.h"
|
#import "HVLDecoder.h"
|
||||||
|
|
||||||
#import "Logging.h"
|
|
||||||
|
|
||||||
@implementation HVLDecoder
|
@implementation HVLDecoder
|
||||||
|
|
||||||
void oneTimeInit()
|
void oneTimeInit()
|
||||||
|
@ -34,10 +32,13 @@ void oneTimeInit()
|
||||||
long size = [s tell];
|
long size = [s tell];
|
||||||
[s seek:0 whence:SEEK_SET];
|
[s seek:0 whence:SEEK_SET];
|
||||||
|
|
||||||
|
if (size > UINT_MAX)
|
||||||
|
return NO;
|
||||||
|
|
||||||
void * data = malloc(size);
|
void * data = malloc(size);
|
||||||
[s read:data amount:size];
|
[s read:data amount:size];
|
||||||
|
|
||||||
tune = hvl_LoadTune( data, size, 44100, 2 );
|
tune = hvl_LoadTune( data, (uint32_t) size, 44100, 2 );
|
||||||
free( data );
|
free( data );
|
||||||
if ( !tune )
|
if ( !tune )
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -88,9 +89,9 @@ void oneTimeInit()
|
||||||
[NSNumber numberWithInt:0], @"bitrate",
|
[NSNumber numberWithInt:0], @"bitrate",
|
||||||
[NSNumber numberWithFloat:44100], @"sampleRate",
|
[NSNumber numberWithFloat:44100], @"sampleRate",
|
||||||
[NSNumber numberWithDouble:totalFrames], @"totalFrames",
|
[NSNumber numberWithDouble:totalFrames], @"totalFrames",
|
||||||
[NSNumber numberWithInt:32], @"bitsPerSample", //Samples are short
|
[NSNumber numberWithInt:32], @"bitsPerSample",
|
||||||
[NSNumber numberWithBool:YES], @"floatingPoint",
|
[NSNumber numberWithBool:YES], @"floatingPoint",
|
||||||
[NSNumber numberWithInt:2], @"channels", //output from gme_play is in stereo
|
[NSNumber numberWithInt:2], @"channels",
|
||||||
[NSNumber numberWithBool:YES], @"seekable",
|
[NSNumber numberWithBool:YES], @"seekable",
|
||||||
@"host", @"endian",
|
@"host", @"endian",
|
||||||
nil];
|
nil];
|
||||||
|
@ -98,6 +99,9 @@ void oneTimeInit()
|
||||||
|
|
||||||
- (int)readAudio:(void *)buf frames:(UInt32)frames
|
- (int)readAudio:(void *)buf frames:(UInt32)frames
|
||||||
{
|
{
|
||||||
|
if (framesRead >= totalFrames)
|
||||||
|
return 0;
|
||||||
|
|
||||||
int total = 0;
|
int total = 0;
|
||||||
while ( total < frames ) {
|
while ( total < frames ) {
|
||||||
if ( framesInBuffer )
|
if ( framesInBuffer )
|
||||||
|
@ -105,7 +109,7 @@ void oneTimeInit()
|
||||||
float * outbuffer = (( float * ) buf) + total * 2;
|
float * outbuffer = (( float * ) buf) + total * 2;
|
||||||
int framesToCopy = frames - total;
|
int framesToCopy = frames - total;
|
||||||
if ( framesToCopy > framesInBuffer )
|
if ( framesToCopy > framesInBuffer )
|
||||||
framesToCopy = framesInBuffer;
|
framesToCopy = (int) framesInBuffer;
|
||||||
for ( int i = 0; i < framesToCopy; ++i )
|
for ( int i = 0; i < framesToCopy; ++i )
|
||||||
{
|
{
|
||||||
outbuffer[ 0 ] = buffer[ i * 2 + 0 ] * (1.0f / 16777216.0f);
|
outbuffer[ 0 ] = buffer[ i * 2 + 0 ] * (1.0f / 16777216.0f);
|
||||||
|
@ -120,7 +124,7 @@ void oneTimeInit()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hvl_DecodeFrame( tune, buffer, buffer + 1, 8 );
|
hvl_DecodeFrame( tune, (int8_t *) buffer, ((int8_t *) buffer) + 4, 8 );
|
||||||
framesInBuffer = 44100 / 50;
|
framesInBuffer = 44100 / 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +144,7 @@ void oneTimeInit()
|
||||||
fadeScale -= fadeStep;
|
fadeScale -= fadeStep;
|
||||||
if (fadeScale <= 0.0) break;
|
if (fadeScale <= 0.0) break;
|
||||||
}
|
}
|
||||||
total = fadePos - fadeStart;
|
total = (int)(fadePos - fadeStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
framesRead += total;
|
framesRead += total;
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#import "HVLMetadataReader.h"
|
#import "HVLMetadataReader.h"
|
||||||
#import "HVLDecoder.h"
|
#import "HVLDecoder.h"
|
||||||
|
|
||||||
#import "Logging.H"
|
|
||||||
|
|
||||||
@implementation HVLMetadataReader
|
@implementation HVLMetadataReader
|
||||||
|
|
||||||
+ (NSArray *)fileTypes
|
+ (NSArray *)fileTypes
|
||||||
|
@ -38,10 +36,13 @@
|
||||||
long size = [source tell];
|
long size = [source tell];
|
||||||
[source seek:0 whence:SEEK_SET];
|
[source seek:0 whence:SEEK_SET];
|
||||||
|
|
||||||
|
if ( size > UINT_MAX )
|
||||||
|
return nil;
|
||||||
|
|
||||||
void * data = malloc(size);
|
void * data = malloc(size);
|
||||||
[source read:data amount:size];
|
[source read:data amount:size];
|
||||||
|
|
||||||
struct hvl_tune * tune = hvl_LoadTune( data, size, 44100, 2 );
|
struct hvl_tune * tune = hvl_LoadTune( data, (uint32_t) size, 44100, 2 );
|
||||||
free( data );
|
free( data );
|
||||||
if ( !tune )
|
if ( !tune )
|
||||||
return nil;
|
return nil;
|
||||||
|
|
Loading…
Reference in New Issue