Answered
0
0

Dears,
I write a test program that call fmod api, but compile it to binary file. I push the binary file to android device, but it always fails in fmod->init() line. The error code is 28. Do you know why it fails? The attached file is my sample code, thanks.

/* the below is my code */

#include <fmod.hpp>
#include <stdio.h>
#include <unistd.h>

int main(void)
{
    printf("1\n");

    FMOD::System     *system;
    FMOD::Sound      *sound1, *sound2, *sound3;
    FMOD::Channel    *channel = 0;
    FMOD_RESULT       result;
    unsigned int      version;
    void             *extradriverdata = 0;  

    result = FMOD::System_Create(&system);

    printf("%d System_Create\n", result);       

    result = system->getVersion(&version);

    printf("%d getVersion\n", result);

    if (version < FMOD_VERSION)
    {
        //Common_Fatal("FMOD lib version %08x doesn't match header version %08x", version, FMOD_VERSION);
        return 1;
    }

    result = system->init(32, FMOD_INIT_NORMAL, extradriverdata);

    if(FMOD_OK != result)
    {
        printf("init error1\n");
        return 1;
    }   

    result = sound1->setMode(FMOD_LOOP_OFF);    /* drumloop.wav has embedded loop points which automatically makes looping turn on, */

    printf("%dsetmode\n", result);

    result = system->createSound("jaguar.wav", FMOD_DEFAULT, 0, &sound2);

    printf("%dreateSound\n", result);

    result = system->playSound(sound2, 0, false, &channel);

    printf("%dplaySound\n", result);

    do
    {
        bool         playing = 0;
        result = channel->isPlaying(&playing);  
        printf("%dsPlaying:%d\n", result, playing); 

        sleep(50);
    }while(true);

    return 0;
}
  • You must to post comments
Best Answer
0
0

The best way to debug on Android is to link with the logging version (fmodL) and look at the output in LogCat.

On Android you must include fmod.jar with your project, you can read more about the requirement here.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.