SID Input: Don't close hinted source files
The SID decoder uses a hint cache so that when the library requests the current file open, it will return the exact file already opened, rather than opening it again. Unfortunately, I was closing the file regardless, and sometimes, libsidplayfp will reopen the file multiple times, from other threads, even. Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
e7df4e529d
commit
be6fda4663
|
@ -75,7 +75,10 @@ static const char *extListStr[] = { ".str", NULL };
|
|||
|
||||
static void sidTuneLoader(const char *fileName, std::vector<uint8_t> &bufferRef) {
|
||||
id<CogSource> source;
|
||||
BOOL usedHint = YES;
|
||||
if(![[sid_file_container instance] try_hint:[NSString stringWithUTF8String:fileName] source:&source]) {
|
||||
usedHint = NO;
|
||||
|
||||
NSString *urlString = [NSString stringWithUTF8String:fileName];
|
||||
NSURL *url = [NSURL URLWithDataRepresentation:[urlString dataUsingEncoding:NSUTF8StringEncoding] relativeToURL:nil];
|
||||
|
||||
|
@ -97,7 +100,8 @@ static void sidTuneLoader(const char *fileName, std::vector<uint8_t> &bufferRef)
|
|||
|
||||
[source read:&bufferRef[0] amount:size];
|
||||
|
||||
[source close];
|
||||
if(!usedHint)
|
||||
[source close];
|
||||
}
|
||||
|
||||
@implementation SidDecoder
|
||||
|
|
Loading…
Reference in New Issue