Cleaned up minor warnings and removed unnecessary imports

CQTexperiment
Chris Moeller 2013-10-29 17:32:41 -07:00
parent d20973235b
commit a3dfee75f8
5 changed files with 22 additions and 17 deletions

View File

@ -63,7 +63,6 @@
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>"; };
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 */
/* Begin PBXFrameworksBuildPhase section */
@ -119,7 +118,6 @@
836FB5361820538700B3AD2D /* Hively */ = {
isa = PBXGroup;
children = (
836FB5A41820558900B3AD2D /* Logging.h */,
836FB5A31820557E00B3AD2D /* Plugin.h */,
836FB59A1820556F00B3AD2D /* HVLDecoder.h */,
836FB59B1820556F00B3AD2D /* HVLDecoder.m */,
@ -371,6 +369,7 @@
836FB5411820538700B3AD2D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};

View File

@ -9,8 +9,6 @@
#import "HVLContainer.h"
#import "HVLDecoder.h"
#import "Logging.h"
@implementation HVLContainer
+ (NSArray *)fileTypes
@ -43,10 +41,13 @@
long size = [source tell];
[source seek:0 whence:SEEK_SET];
if ( size > UINT_MAX )
return nil;
void * data = malloc(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 );
if ( !tune )
return nil;

View File

@ -15,7 +15,7 @@
@interface HVLDecoder : NSObject <CogDecoder> {
struct hvl_tune *tune;
int32_t *buffer;
long trackNumber;
int trackNumber;
long totalFrames;
long framesLength;

View File

@ -8,8 +8,6 @@
#import "HVLDecoder.h"
#import "Logging.h"
@implementation HVLDecoder
void oneTimeInit()
@ -34,10 +32,13 @@ void oneTimeInit()
long size = [s tell];
[s seek:0 whence:SEEK_SET];
if (size > UINT_MAX)
return NO;
void * data = malloc(size);
[s read:data amount:size];
tune = hvl_LoadTune( data, size, 44100, 2 );
tune = hvl_LoadTune( data, (uint32_t) size, 44100, 2 );
free( data );
if ( !tune )
return NO;
@ -88,9 +89,9 @@ void oneTimeInit()
[NSNumber numberWithInt:0], @"bitrate",
[NSNumber numberWithFloat:44100], @"sampleRate",
[NSNumber numberWithDouble:totalFrames], @"totalFrames",
[NSNumber numberWithInt:32], @"bitsPerSample", //Samples are short
[NSNumber numberWithInt:32], @"bitsPerSample",
[NSNumber numberWithBool:YES], @"floatingPoint",
[NSNumber numberWithInt:2], @"channels", //output from gme_play is in stereo
[NSNumber numberWithInt:2], @"channels",
[NSNumber numberWithBool:YES], @"seekable",
@"host", @"endian",
nil];
@ -98,6 +99,9 @@ void oneTimeInit()
- (int)readAudio:(void *)buf frames:(UInt32)frames
{
if (framesRead >= totalFrames)
return 0;
int total = 0;
while ( total < frames ) {
if ( framesInBuffer )
@ -105,7 +109,7 @@ void oneTimeInit()
float * outbuffer = (( float * ) buf) + total * 2;
int framesToCopy = frames - total;
if ( framesToCopy > framesInBuffer )
framesToCopy = framesInBuffer;
framesToCopy = (int) framesInBuffer;
for ( int i = 0; i < framesToCopy; ++i )
{
outbuffer[ 0 ] = buffer[ i * 2 + 0 ] * (1.0f / 16777216.0f);
@ -120,7 +124,7 @@ void oneTimeInit()
break;
}
}
hvl_DecodeFrame( tune, buffer, buffer + 1, 8 );
hvl_DecodeFrame( tune, (int8_t *) buffer, ((int8_t *) buffer) + 4, 8 );
framesInBuffer = 44100 / 50;
}
@ -140,7 +144,7 @@ void oneTimeInit()
fadeScale -= fadeStep;
if (fadeScale <= 0.0) break;
}
total = fadePos - fadeStart;
total = (int)(fadePos - fadeStart);
}
framesRead += total;

View File

@ -9,8 +9,6 @@
#import "HVLMetadataReader.h"
#import "HVLDecoder.h"
#import "Logging.H"
@implementation HVLMetadataReader
+ (NSArray *)fileTypes
@ -38,10 +36,13 @@
long size = [source tell];
[source seek:0 whence:SEEK_SET];
if ( size > UINT_MAX )
return nil;
void * data = malloc(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 );
if ( !tune )
return nil;