fix AudioEngine bug for iOS, UTF8 filePath (#15743)

* fix AudioEngine bug for iOS, UTF8 filePath

Fix bug for apple platform, open audio file failed with chinese App Name.

* Update AudioPlayer.mm
This commit is contained in:
halx99 2016-05-30 10:47:48 +08:00 committed by minggo
parent 67c95549b3
commit fa4bfe43d8
2 changed files with 2 additions and 2 deletions

View File

@ -102,7 +102,7 @@ void AudioCache::readDataTask()
AudioBufferList theDataBuffer; AudioBufferList theDataBuffer;
ExtAudioFileRef extRef = nullptr; ExtAudioFileRef extRef = nullptr;
NSString *fileFullPath = [[NSString alloc] initWithCString:_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]]; NSString *fileFullPath = [[NSString alloc] initWithCString:_fileFullPath.c_str() encoding:NSUTF8StringEncoding];
auto fileURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:fileFullPath]; auto fileURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:fileFullPath];
[fileFullPath release]; [fileFullPath release];

View File

@ -145,7 +145,7 @@ void AudioPlayer::rotateBufferThread(int offsetFrame)
ALint bufferProcessed = 0; ALint bufferProcessed = 0;
ExtAudioFileRef extRef = nullptr; ExtAudioFileRef extRef = nullptr;
NSString *fileFullPath = [[NSString alloc] initWithCString:_audioCache->_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]]; NSString *fileFullPath = [[NSString alloc] initWithCString:_audioCache->_fileFullPath.c_str() encoding:NSUTF8StringEncoding];
auto fileURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:fileFullPath]; auto fileURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:fileFullPath];
[fileFullPath release]; [fileFullPath release];
char* tmpBuffer = (char*)malloc(_audioCache->_queBufferBytes); char* tmpBuffer = (char*)malloc(_audioCache->_queBufferBytes);