[SID Input] Add static initializer for residfp

The SID builder needs a static initializer, otherwise multiple instances
created simultaneously, such as during populating info on adding a lot
of tracks, will race and crash the player.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
xcode15
Christopher Snowhill 2022-07-27 21:38:22 -07:00
parent 4ec2146549
commit 660cb1bab1
1 changed files with 16 additions and 0 deletions

View File

@ -160,6 +160,22 @@ static void sidTuneLoader(const char *fileName, std::vector<uint8_t> &bufferRef)
@implementation SidDecoder @implementation SidDecoder
// Need this static initializer to create the static global tables that sidplayfp doesn't really lock access to
+ (void)initialize {
ReSIDfpBuilder *builder = new ReSIDfpBuilder("ReSIDfp");
if(builder) {
builder->create(1);
if(builder->getStatus()) {
builder->filter(true);
builder->filter6581Curve(0.5);
builder->filter8580Curve(0.5);
}
delete builder;
}
}
- (BOOL)open:(id<CogSource>)s { - (BOOL)open:(id<CogSource>)s {
if(![s seekable]) if(![s seekable])
return NO; return NO;