0
0

Hi to all,
I have a very little piece of code, mainly from Peter. I get a strange error from FMOD::Sound::lock(..) and I don’t know why. The last ERRCHECK give me that fmod error. Below the main code. I would have in memory the uncompressed pcm samples to do sound edit.
I hope to get help

[code:4vx56qa3]void ERRCHECK(FMOD_RESULT result)
{
if (result != FMOD_OK)
{
printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
exit(-1);
}
}

int _tmain(int argc, _TCHAR* argv[])
{
FMOD::System* system;
FMOD::Sound *sound = NULL;
FMOD::Channel* channel = 0;
FMOD_RESULT result;
FMOD_SOUND_TYPE* type;
int key;
unsigned int version;

/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);

result = system->getVersion(&version);
ERRCHECK(result);

if (version < FMOD_VERSION)
{
    printf("Error!  You are using an old version of FMOD %08x.  This program requires %08x\n", version, FMOD_VERSION);
    return 0;
}

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

cout << "System initialized";

//// raw PCM from compressed file test
ERRCHECK( system->createSound( "C:/song.mp3", FMOD_CREATECOMPRESSEDSAMPLE, 0, &sound ) );


unsigned int len = 0;
ERRCHECK( sound->getLength(&len, FMOD_TIMEUNIT_PCMBYTES ) );
std::cout << len << "\n";

FMOD_SOUND_FORMAT format;
ERRCHECK( sound->getFormat( NULL, &format, 0, 0 ) );
std::cout << format << "\n";

void *ptr1 = NULL, *ptr2 = NULL;
unsigned int len1 = 0, len2 = 0;
result = sound->lock( 0, len, &ptr1, &ptr2, &len1, &len2 );
ERRCHECK( result );

return 0;

}[/code:4vx56qa3]

  • You must to post comments
0
0

I have responded to this in the original thread: http://52.88.2.202/forum/viewtopic.php?p=43265

  • You must to post comments
0
0

[quote="peter":3exb8o4a]I have responded to this in the original thread: http://52.88.2.202/forum/viewtopic.php?p=43265[/quote:3exb8o4a]

Thank you Peter,
I’ll try immediately.

best

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.