Cocoa Port:
- Fix bug where the SLOT-1 R4 directory path wasn't being saved properly. - Fix bug where loading an external audio file with a sample rate less than 16000 Hz would cause a crash. - Fix bug where creating a new display window with a default display mode of Main or Touch would cause the display window to draw incorrectly.
This commit is contained in:
parent
bf35d0af3f
commit
5b6ab8049e
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -131,9 +131,6 @@ enum OGLVertexAttributeID
|
||||||
_isMinSizeNormal = YES;
|
_isMinSizeNormal = YES;
|
||||||
_statusBarHeight = WINDOW_STATUS_BAR_HEIGHT;
|
_statusBarHeight = WINDOW_STATUS_BAR_HEIGHT;
|
||||||
|
|
||||||
// Setup default values per user preferences.
|
|
||||||
[self setupUserDefaults];
|
|
||||||
|
|
||||||
[[self window] setTitle:(NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]];
|
[[self window] setTitle:(NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
@ -737,6 +734,7 @@ enum OGLVertexAttributeID
|
||||||
|
|
||||||
- (void)windowDidLoad
|
- (void)windowDidLoad
|
||||||
{
|
{
|
||||||
|
// Set up the video output thread.
|
||||||
cdsVideoOutput = [[CocoaDSDisplayVideo alloc] init];
|
cdsVideoOutput = [[CocoaDSDisplayVideo alloc] init];
|
||||||
[cdsVideoOutput setDelegate:view];
|
[cdsVideoOutput setDelegate:view];
|
||||||
|
|
||||||
|
@ -746,6 +744,16 @@ enum OGLVertexAttributeID
|
||||||
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
|
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup default values per user preferences.
|
||||||
|
[self setupUserDefaults];
|
||||||
|
|
||||||
|
// Set the video filter source size now since the proper size is needed on initialization.
|
||||||
|
// If we don't do this, new windows could draw incorrectly.
|
||||||
|
const NSSize vfSrcSize = NSMakeSize(GPU_DISPLAY_WIDTH, ([self displayMode] == DS_DISPLAY_TYPE_COMBO) ? GPU_DISPLAY_HEIGHT * 2 : GPU_DISPLAY_HEIGHT);
|
||||||
|
[[cdsVideoOutput vf] setSourceSize:vfSrcSize];
|
||||||
|
[CocoaDSUtil messageSendOneWayWithInteger:[cdsVideoOutput receivePort] msgID:MESSAGE_CHANGE_VIDEO_FILTER integerValue:[self videoFilterType]];
|
||||||
|
|
||||||
|
// Add the video thread to the output list.
|
||||||
[emuControl addOutputToCore:cdsVideoOutput];
|
[emuControl addOutputToCore:cdsVideoOutput];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1848,4 +1856,3 @@ enum OGLVertexAttributeID
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -939,12 +939,10 @@
|
||||||
[panel setResolvesAliases:YES];
|
[panel setResolvesAliases:YES];
|
||||||
[panel setAllowsMultipleSelection:NO];
|
[panel setAllowsMultipleSelection:NO];
|
||||||
[panel setTitle:@"Select R4 Directory"];
|
[panel setTitle:@"Select R4 Directory"];
|
||||||
NSArray *fileTypes = [NSArray arrayWithObjects:nil];
|
|
||||||
|
|
||||||
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
|
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
|
||||||
// is deprecated in Mac OS X v10.6.
|
// is deprecated in Mac OS X v10.6.
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
|
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
|
||||||
[panel setAllowedFileTypes:fileTypes];
|
|
||||||
[panel beginSheetModalForWindow:slot1ManagerWindow
|
[panel beginSheetModalForWindow:slot1ManagerWindow
|
||||||
completionHandler:^(NSInteger result) {
|
completionHandler:^(NSInteger result) {
|
||||||
[self didEndChooseSlot1R4Directory:panel returnCode:result contextInfo:nil];
|
[self didEndChooseSlot1R4Directory:panel returnCode:result contextInfo:nil];
|
||||||
|
@ -952,7 +950,7 @@
|
||||||
#else
|
#else
|
||||||
[panel beginSheetForDirectory:nil
|
[panel beginSheetForDirectory:nil
|
||||||
file:nil
|
file:nil
|
||||||
types:fileTypes
|
types:nil
|
||||||
modalForWindow:slot1ManagerWindow
|
modalForWindow:slot1ManagerWindow
|
||||||
modalDelegate:self
|
modalDelegate:self
|
||||||
didEndSelector:@selector(didEndChooseSlot1R4Directory:returnCode:contextInfo:)
|
didEndSelector:@selector(didEndChooseSlot1R4Directory:returnCode:contextInfo:)
|
||||||
|
|
|
@ -1520,8 +1520,17 @@ static std::tr1::unordered_map<unsigned short, std::string> keyboardNameTable; /
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioStreamBasicDescription inputFormat;
|
||||||
|
UInt32 propertySize = sizeof(inputFormat);
|
||||||
|
|
||||||
|
error = ExtAudioFileGetProperty(audioFile, kExtAudioFileProperty_FileDataFormat, &propertySize, &inputFormat);
|
||||||
|
if (error != noErr)
|
||||||
|
{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
SInt64 fileLengthFrames = 0;
|
SInt64 fileLengthFrames = 0;
|
||||||
UInt32 propertySize = sizeof(fileLengthFrames);
|
propertySize = sizeof(fileLengthFrames);
|
||||||
|
|
||||||
error = ExtAudioFileGetProperty(audioFile, kExtAudioFileProperty_FileLengthFrames, &propertySize, &fileLengthFrames);
|
error = ExtAudioFileGetProperty(audioFile, kExtAudioFileProperty_FileLengthFrames, &propertySize, &fileLengthFrames);
|
||||||
if (error != noErr)
|
if (error != noErr)
|
||||||
|
@ -1532,17 +1541,18 @@ static std::tr1::unordered_map<unsigned short, std::string> keyboardNameTable; /
|
||||||
// Create a new audio file generator.
|
// Create a new audio file generator.
|
||||||
audioFileGenerators[filePathStr] = AudioSampleBlockGenerator();
|
audioFileGenerators[filePathStr] = AudioSampleBlockGenerator();
|
||||||
AudioSampleBlockGenerator &theGenerator = audioFileGenerators[filePathStr];
|
AudioSampleBlockGenerator &theGenerator = audioFileGenerators[filePathStr];
|
||||||
u8 *buffer = theGenerator.allocate(fileLengthFrames);
|
const size_t readSize = 32 * 1024;
|
||||||
|
const size_t bufferSize = (size_t)((double)(outputFormat.mSampleRate / inputFormat.mSampleRate) * (double)fileLengthFrames) + readSize;
|
||||||
|
u8 *buffer = theGenerator.allocate(bufferSize);
|
||||||
|
|
||||||
// Read the audio file and fill the generator's buffer.
|
// Read the audio file and fill the generator's buffer.
|
||||||
const size_t convertBufferSize = 32 * 1024;
|
|
||||||
AudioBufferList convertedData;
|
AudioBufferList convertedData;
|
||||||
convertedData.mNumberBuffers = 1;
|
convertedData.mNumberBuffers = 1;
|
||||||
convertedData.mBuffers[0].mNumberChannels = outputFormat.mChannelsPerFrame;
|
convertedData.mBuffers[0].mNumberChannels = outputFormat.mChannelsPerFrame;
|
||||||
convertedData.mBuffers[0].mDataByteSize = convertBufferSize;
|
convertedData.mBuffers[0].mDataByteSize = readSize;
|
||||||
convertedData.mBuffers[0].mData = buffer;
|
convertedData.mBuffers[0].mData = buffer;
|
||||||
|
|
||||||
UInt32 readFrames = convertBufferSize;
|
UInt32 readFrames = readSize;
|
||||||
while (readFrames > 0)
|
while (readFrames > 0)
|
||||||
{
|
{
|
||||||
ExtAudioFileRead(audioFile, &readFrames, &convertedData);
|
ExtAudioFileRead(audioFile, &readFrames, &convertedData);
|
||||||
|
@ -1555,7 +1565,7 @@ static std::tr1::unordered_map<unsigned short, std::string> keyboardNameTable; /
|
||||||
|
|
||||||
// Convert the audio buffer to 7-bit unsigned PCM.
|
// Convert the audio buffer to 7-bit unsigned PCM.
|
||||||
buffer = theGenerator.getBuffer();
|
buffer = theGenerator.getBuffer();
|
||||||
for (SInt64 i = 0; i < fileLengthFrames; i++)
|
for (SInt64 i = 0; i < bufferSize; i++)
|
||||||
{
|
{
|
||||||
*(buffer+i) >>= 1;
|
*(buffer+i) >>= 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue