Cocos2dx3.2 audio cannot be played when SimpleAudioEngine is used (Chinese Path Problem)

Source: Internet
Author: User

Cocos2dx3.2 audio cannot be played when SimpleAudioEngine is used (Chinese Path Problem)

Cocos2dx windows development is really a lot of twists and turns. Recently, I encountered the problem of playing sound in vs2013 debugging status, but not in debugging status.

I followed a lot of code and found that it was because of the Chinese path. So locate the problem and immediately fix it.

First, find the SimpleAudioEngine. cpp file in the libAudio project.

Find the following code:

//////////////////////////////////////////////////////////////////////////// static function//////////////////////////////////////////////////////////////////////////static std::string _FullPath(const char * szPath){      return FileUtils::getInstance()->fullPathForFilename(szPath);}

Modify as follows (I use boost for transcoding)

//////////////////////////////////////// /// // Static function // //////////////////////////////////////// /// // static std:: string _ FullPath (const char * szPath) {// std: string str (szPath); // If you only need to use a relative path, use this line to replace the next row of std :: string str = FileUtils: getInstance ()-> fullPathForFilename (szPath); // fill in the absolute path return boost: locale: conv: between (str, "GBK ", "UTF-8"); // return FileUtils: getInstance ()-> fullPathForFilename (szPath );}

Now, you can use the Chinese path ..


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.