0
0

Hi,

We are developing a game with cocos2dx framework using FMOD studio library on both Android and iOS platforms. While on iOS everything works fine, on Android played sounds are stuttering ( some are playing better but not fine ). FMOD initialization and play calls have the same flow and structures on both platforms.

Moreover if we let one FMOD studio android example ( like simple_event ) load the bank we use in the game, sounds are playing fine.

Is there a tutorial or guide that explains how to implement FMOD studio in a cocos2dx framework for Android?

Initialization code below:

[code:tsydi442]
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);

    FMODAudioDevice.init(this);
}

public Cocos2dxGLSurfaceView onCreateView() {
    Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
    // ThreesClone should create stencil buffer
    glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);

    return glSurfaceView;
}

static {

    // Try debug libraries...
    try { System.loadLibrary("fmodD");
          System.loadLibrary("fmodstudioD"); }
    catch (UnsatisfiedLinkError e) { }
    // Try logging libraries...
    try { System.loadLibrary("fmodL");
          System.loadLibrary("fmodstudioL"); }
    catch (UnsatisfiedLinkError e) { }
    // Try release libraries...
    try { System.loadLibrary("fmod");
          System.loadLibrary("fmodstudio"); }
    catch (UnsatisfiedLinkError e) { }

    //System.loadLibrary("stlport_shared");
    System.loadLibrary("cocos2dcpp");
}  

[/code:tsydi442]

  • You must to post comments
0
0

I’m having a similar problem (though I suppose it might be the same problem). Everything works on fine on iOS, Mac, and Windows. On Android, sounds play but are pretty much noise. My banks are set to export ADPCM at 24khz. I’m using the same bank for iOS and Android.

Here is the FMOD log output up to playing the first sound:
[code:1aruilaq]04-17 03:36:58.665 31004 31004 I fmod : FMOD: AndroidAssetFile::registerLib : Register Android asset manager.
04-17 03:36:58.665 31004 31004 I fmod : FMOD: AndroidAssetFile::registerLib : Loading dynamic library.
04-17 03:36:58.665 31004 31004 I fmod : FMOD: AndroidAssetFile::registerLib : Loading symbols.
04-17 03:36:58.665 31004 31004 I fmod : FMOD: AndroidAssetFile::registerLib : Fetching manager.
04-17 03:36:58.665 31004 31004 I fmod : FMOD: AndroidAssetFile::registerLib : Done.
04-17 03:36:58.681 31004 31004 I fmod : FMOD: AudioDevice::init : Device reports FEATURE_AUDIO_LOW_LATENCY = false
04-17 03:36:58.681 31004 31004 I fmod : FMOD: AudioDevice::init : Device reports PROPERTY_OUTPUT_SAMPLE_RATE = 44100
04-17 03:36:58.681 31004 31004 I fmod : FMOD: AudioDevice::init : Device reports PROPERTY_OUTPUT_FRAMES_PER_BUFFER = 240
04-17 03:36:59.712 31004 31024 I fmod : FMOD: System::create : Header version = 1.3.5. Current version = 1.3.5.
04-17 03:36:59.712 31004 31024 I fmod : FMOD: SystemI::init : FMOD Studio Version: 00010305 (52760)
04-17 03:36:59.712 31004 31024 I fmod : FMOD: SystemI::init : maxchannels = 32, flags = 00000000, extradriverdata = 0x0
04-17 03:36:59.712 31004 31024 I fmod : FMOD: SystemI::close :
04-17 03:36:59.712 31004 31024 I fmod : FMOD: SystemI::close : Stop all sounds
04-17 03:36:59.712 31004 31024 I fmod : FMOD: SystemI::close : Remove miscllaneous DSP stuff.
04-17 03:36:59.712 31004 31024 I fmod : FMOD: SystemI::close : done.
04-17 03:36:59.712 31004 31024 I fmod :
04-17 03:36:59.712 31004 31024 I fmod : FMOD: FMOD_OS_Init : Detected VFP instruction support, will use VFP optimized mixing and resampling.
04-17 03:36:59.728 31004 31024 I fmod : FMOD: SystemI::init : Set up software engine
04-17 03:36:59.728 31004 31024 I fmod : FMOD: OutputOpenSL::init : Initializing...
04-17 03:36:59.728 31004 31024 I fmod : FMOD: OutputOpenSL::init : Only mono and stereo supported, defaulting to stereo.
04-17 03:36:59.743 31004 31024 I fmod : FMOD: OutputOpenSL::init : Done.
04-17 03:36:59.751 31004 31024 I fmod : FMOD: OutputOpenSL::start : Starting...
04-17 03:36:59.759 31004 31024 I fmod : FMOD: OutputOpenSL::start : Done.
04-17 03:36:59.759 31004 31024 I fmod : FMOD: OutputPolled::start : Starting thread that automatically wakes up every 10 ms
04-17 03:36:59.759 31004 31024 I fmod : FMOD: Thread::initThread : Initializing FMOD mixer thread. priority 3
04-17 03:36:59.759 31004 31024 I fmod : FMOD: Thread::initThread : – Stacksize 49152. Stack pointer 0x0 : usesemaphore = 0 : sleeptime = 10
04-17 03:36:59.767 31004 31087 I fmod : FMOD: Thread::callback : * FMOD mixer thread started
04-17 03:36:59.767 31004 31024 I fmod : FMOD: Thread::initThread : done.
04-17 03:36:59.767 31004 31024 I fmod : FMOD: SystemI::init : Set up emulated output
04-17 03:36:59.767 31004 31024 I fmod : FMOD: SystemI::init : create the channel pool
04-17 03:36:59.767 31004 31024 I fmod : FMOD: SystemI::init : Set up streamer
04-17 03:36:59.767 31004 31024 I fmod : FMOD: Thread::initThread : Initializing FMOD stream thread. priority 2
04-17 03:36:59.767 31004 31024 I fmod : FMOD: Thread::initThread : – Stacksize 65536. Stack pointer 0x0 : usesemaphore = 0 : sleeptime = 10
04-17 03:36:59.767 31004 31088 I fmod : FMOD: Thread::callback : * FMOD stream thread started
04-17 03:36:59.767 31004 31024 I fmod : FMOD: Thread::initThread : done.
04-17 03:36:59.767 31004 31024 I fmod : FMOD: SystemI::init : done
04-17 03:36:59.767 31004 31024 I fmod :
04-17 03:36:59.767 31004 31024 I fmod : FMOD: Thread::initThread : Initializing FMOD studio thread. priority 0
04-17 03:36:59.767 31004 31024 I fmod : FMOD: Thread::initThread : – Stacksize 49152. Stack pointer 0x0 : usesemaphore = 0 : sleeptime = 0
04-17 03:36:59.767 31004 31089 I fmod : FMOD: Thread::callback : * FMOD studio thread started
04-17 03:36:59.767 31004 31024 I fmod : FMOD: Thread::initThread : done.
04-17 03:36:59.837 31004 31089 I fmod : FMOD: load : fileversion = 44, compatVersion = 44 (oldest = 44, newest = 44)
04-17 03:36:59.954 31004 31089 I fmod : FMOD: load : fileversion = 44, compatVersion = 44 (oldest = 44, newest = 44)
04-17 03:37:04.720 31004 31089 I fmod : FMOD: SystemI::createSound : filename = file:///android_asset/sounds/Mobile/Master Bank.bank : mode 08010222
04-17 03:37:04.720 31004 31089 I fmod : FMOD: SystemI::createSound : FMOD_NONBLOCKING specified. Putting into queue to be opened asynchronously!
04-17 03:37:04.720 31004 31089 I fmod : FMOD: OutputSoftware::createSample : lengthpcm 0, lengthbytes 0, channels 0, format 0, freq 0, mode 00000000
04-17 03:37:04.720 31004 31089 I fmod : FMOD: SystemI::createSound : allocated async data mem
04-17 03:37:04.720 31004 31089 I fmod : FMOD: SystemI::createSound : getasyncthread
04-17 03:37:04.720 31004 31089 I fmod : FMOD: Thread::initThread : Initializing FMOD nonblocking thread (0). priority 1
04-17 03:37:04.720 31004 31089 I fmod : FMOD: Thread::initThread : – Stacksize 81920. Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
04-17 03:37:04.720 31004 31134 I fmod : FMOD: Thread::callback : * FMOD nonblocking thread (0) started
04-17 03:37:04.720 31004 31089 I fmod : FMOD: Thread::initThread : done.
04-17 03:37:04.720 31004 31089 I fmod : FMOD: SystemI::createSound : setdata soundi = 0x5fedb4c8 : node = 0x6092e4b0
04-17 03:37:04.720 31004 31089 I fmod : FMOD: SystemI::createSound : add node to async list : head = 0x5fe9339c. list count = 0
04-17 03:37:04.720 31004 31089 I fmod : FMOD: SystemI::createSound : done
04-17 03:37:04.720 31004 31134 I fmod : FMOD: AsyncThread::threadFunc : Starting Asynchronous operation on sound 0x5fedb4c8
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : filename = file:///android_asset/sounds/Mobile/Master Bank.bank : mode 08010222
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : exinfo->cbsize = 140
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : exinfo->length = 8762592
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : exinfo->fileoffset = 42368
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : exinfo->numsubsounds = 1
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : exinfo->inclusionlist = 0x6092e55c
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : exinfo->inclusionlistnum = 1
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : exinfo->suggestedsoundtype = 6
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : exinfo->initialseekpostype = 1
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : 17 codecs found. Scan all until one succeeds
04-17 03:37:04.720 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : Scan for tags.
04-17 03:37:04.720 31004 31134 I fmod : FMOD: CodecTag::openInternal : attempting to open ID3 or ASF tags..
04-17 03:37:04.907 31004 31134 I fmod : FMOD: Codec::release :
04-17 03:37:04.907 31004 31134 I fmod : FMOD: Codec::release : done
04-17 03:37:04.907 31004 31134 I fmod : FMOD: CodecFSB5::openInternal : attempting to open as FSB5..
04-17 03:37:04.907 31004 31134 I fmod : FMOD: CodecFSB5::openInternal : FSB contains 18 sounds
04-17 03:37:04.907 31004 31134 I fmod : FMOD: CodecFSB5::openInternal : done.
04-17 03:37:04.907 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : Format has 1 subsounds.
04-17 03:37:04.907 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : Create as FMOD_CREATESAMPLE
04-17 03:37:04.907 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : Multi-sample sound (1 subsounds), create a sample container.
04-17 03:37:04.907 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : creating subsound 0/1
04-17 03:37:04.907 31004 31134 I fmod : FMOD: SystemI::createSample : mode 08010242 length 9600 samples, lengthbytes 5408
04-17 03:37:04.907 31004 31134 I fmod : FMOD: SystemI::createSample : subsamples = 1, channels = 1
04-17 03:37:04.907 31004 31134 I fmod : FMOD: SystemI::createSample : subsample 0. output = 0x5f0942f0
04-17 03:37:04.907 31004 31134 I fmod : FMOD: SystemI::createSample : mSoftware = 0x5f0942f0
04-17 03:37:04.907 31004 31134 I fmod : FMOD: OutputSoftware::createSample : lengthpcm 9600, lengthbytes 5408, channels 1, format 7, freq 24000, mode 0801024a
04-17 03:37:04.907 31004 31134 I fmod : FMOD: OutputSoftware::createSample : done
04-17 03:37:04.907 31004 31134 I fmod : FMOD: SystemI::createSample : done
04-17 03:37:04.907 31004 31134 I fmod : FMOD: CodecFSB5::setPositionInternal : subsound 0 position 0 postype 8
04-17 03:37:04.907 31004 31134 I fmod : FMOD: CodecFSB5::setPositionInternal : done
04-17 03:37:05.056 31004 31134 I fmod : FMOD: SystemI::createSoundInternal : done. OpenState now = FMOD_OPENSTATE_READY.
04-17 03:37:05.056 31004 31134 I fmod :
04-17 03:37:05.056 31004 31134 I fmod : FMOD: AsyncThread::threadFunc : Finished Asynchronous operation on sound 0x5fedb4c8
04-17 03:37:05.064 31004 31089 I fmod : FMOD: SoundSourceInstrumentInstance::startChannelIfReady : Loading delay exceeded, sound may play at incorrect time
04-17 03:37:05.111 31004 31089 I fmod : FMOD: SoundI::release : (null) (0x5fedb4c8)
04-17 03:37:05.111 31004 31089 I fmod : FMOD: SoundI::release : release subsounds. (0x5fedb4c8)
04-17 03:37:05.111 31004 31089 I fmod : FMOD: SoundI::release : (null) (0x5fea6878)
04-17 03:37:05.111 31004 31089 I fmod : FMOD: SoundI::release : free this. (0x5fea6878)
04-17 03:37:05.111 31004 31089 I fmod : FMOD: SoundI::release : done (0x5fea6878)
04-17 03:37:05.111 31004 31089 I fmod : FMOD: SoundI::release : release codec. (0x5fedb4c8)
04-17 03:37:05.111 31004 31089 I fmod : FMOD: Codec::release :
04-17 03:37:05.111 31004 31089 I fmod : FMOD: CodecFSB5::closeInternal :
04-17 03:37:05.111 31004 31089 I fmod : FMOD: Codec::release :
04-17 03:37:05.111 31004 31089 I fmod : FMOD: Codec::release : done
04-17 03:37:05.111 31004 31089 I fmod : FMOD: CodecFSB5::closeInternal : done
04-17 03:37:05.111 31004 31089 I fmod : FMOD: Codec::release : done
04-17 03:37:05.111 31004 31089 I fmod : FMOD: SoundI::release : free this. (0x5fedb4c8)
04-17 03:37:05.111 31004 31089 I fmod : FMOD: SoundI::release : done (0x5fedb4c8)[/code:1aruilaq]

The only thing I see that could be the problem is "Loading delay exceeded, sound may play at incorrect time". I’m not sure if that should just mean delayed playback rather than the noise that I’m getting.

I’ve run the simple_event sample and that works fine, but I didn’t go as far as loading my own bank like you did. Log output looks similar besides the "Loading delay…".

  • You must to post comments
0
0

I was able to get sounds playing correctly by building for armeabi-v7a on my Kindle Fire HD, but the problem remains on my older devices that load the armeabi libraries.

  • You must to post comments
0
0

Great! we were setting APP_ABI := armeabi only, so adding armeabi-v7a solved the problem!

thank you very much

Giuseppe

  • You must to post comments
0
0

Do you have issues with audio playback using our examples with armeabi?

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.