0
0

I use the 1.1.11 version before and nothing wrong happened.
[code:al3864mc]
FILE* file = NULL;
fopen_s( &file, "Reign of the Septims.mp3", "rb" ); //read a file into the memory
FMOD_CREATESOUNDEXINFO info;
memset( &info, 0, sizeof( FMOD_CREATESOUNDEXINFO ) );
info.cbsize = sizeof( FMOD_CREATESOUNDEXINFO );
info.useropen = MyOpen;
info.userclose = MyClose;
info.userread = MyRead;
info.userseek = MySeek;
system->createStream( (const char)file, FMOD_DEFAULT, &info, &pTestSound1 );
//here’s the callback
FMOD_RESULT F_CALLBACK MyOpen( const char
name, int unicode, unsigned int fileSize, void** handle, void** userData )
{
if ( name )
{
FILE
pFile = (FILE*)name;

    fseek( pFile, 0, SEEK_END );
    *fileSize = ftell( pFile );
    fseek( pFile, 0, SEEK_SET );
    *handle = pFile;
    return FMOD_OK;
}
return FMOD_ERR_INVALID_PARAM;

}

FMOD_RESULT F_CALLBACK MyClose( void* handle, void* userData )
{
if ( !handle )
{
return FMOD_ERR_INVALID_PARAM;
}
fclose( ( FILE* )handle );
return FMOD_OK;
}

FMOD_RESULT F_CALLBACK MyRead( void* handle, void* buffer, unsigned int sizebytes, unsigned int* bytesread, void* userData )
{
size_t haveRead = fread( buffer, 1, sizebytes, ( FILE* )handle );
*bytesread = (unsigned int)haveRead;
return FMOD_OK;
}

FMOD_RESULT F_CALLBACK MySeek( void* handle, unsigned int pos, void* userData )
{
fseek( ( FILE* )handle, pos, SEEK_SET );
return FMOD_OK;
}
[/code:al3864mc]
I switch to the 1.2.5 version recently and change void**userData to void*userData.
But Error Occurred!! Why? and how to fix it ?

  • You must to post comments
0
0

I’m sorry, I do have a question but not for this reason. Shame on me.
[code:17q2490g]
//error occured when playing the sound
system->playSound( pTestSound1, ProxyMasterGroup, false, 0 );
[/code:17q2490g]
It’s about this ProxyMasterGroup.
I ask a question about the masterchannelgroup->SetMute does not work before,so I create a proxychannelgroup add to masterchannelgroup.
Here’s how I get the proxychannelgoup. It’s nothing wrong in 1.1.11version.
[code:17q2490g]
FMOD::Studio::ID busID = {0};
FMOD_RESULT result = m_pFmodSystem->lookupBusID( "/ProxyMasterGroup",&busID ); //get my proxymastergroup
if ( result != FMOD_OK )
{
return false;
}

            FMOD::Studio::MixerStrip * mixer = new FMOD::Studio::MixerStrip; 
            result = m_pFmodSystem->getMixerStrip( &busID, loadingMode, mixer );
            if ( result != FMOD_OK )
            {
                return false;
            }

            result = mixer->getChannelGroup( &ProxyMasterGroup );
            if ( result != FMOD_OK )
            {
                return false;
            }

mixer->release(); //this line caused the error
[/code:17q2490g]
I’m sorry again.
So in the 1.2.5 version I can’t release the mixerstrip even though I just want the channelgroup in it?

  • You must to post comments
0
0

[quote="gdkid1412":2h8nyqao]I use the 1.1.11 version before and nothing wrong happened.
[code:2h8nyqao]
FILE* file = NULL;
fopen_s( &file, "Reign of the Septims.mp3", "rb" ); //read a file into the memory
FMOD_CREATESOUNDEXINFO info;
memset( &info, 0, sizeof( FMOD_CREATESOUNDEXINFO ) );
info.cbsize = sizeof( FMOD_CREATESOUNDEXINFO );
info.useropen = MyOpen;
info.userclose = MyClose;
info.userread = MyRead;
info.userseek = MySeek;
system->createStream( (const char)file, FMOD_DEFAULT, &info, &pTestSound1 );
//here’s the callback
FMOD_RESULT F_CALLBACK MyOpen( const char
name, int unicode, unsigned int fileSize, void** handle, void** userData )
{
if ( name )
{
FILE
pFile = (FILE*)name;

    fseek( pFile, 0, SEEK_END );
    *fileSize = ftell( pFile );
    fseek( pFile, 0, SEEK_SET );
    *handle = pFile;
    return FMOD_OK;
}
return FMOD_ERR_INVALID_PARAM;

}

FMOD_RESULT F_CALLBACK MyClose( void* handle, void* userData )
{
if ( !handle )
{
return FMOD_ERR_INVALID_PARAM;
}
fclose( ( FILE* )handle );
return FMOD_OK;
}

FMOD_RESULT F_CALLBACK MyRead( void* handle, void* buffer, unsigned int sizebytes, unsigned int* bytesread, void* userData )
{
size_t haveRead = fread( buffer, 1, sizebytes, ( FILE* )handle );
*bytesread = (unsigned int)haveRead;
return FMOD_OK;
}

FMOD_RESULT F_CALLBACK MySeek( void* handle, unsigned int pos, void* userData )
{
fseek( ( FILE* )handle, pos, SEEK_SET );
return FMOD_OK;
}
[/code:2h8nyqao]
I switch to the 1.2.5 version recently and change void**userData to void*userData.
But Error Occurred!! Why? and how to fix it ?[/quote:2h8nyqao]

Do you mean a compiler error? Have a look at FMOD_CREATESOUNDEXINFO struct again, you can see your members are fileuseropen, fileuserseek, etc, rather than just useropen/userseek/…
I do see that you probably saw that, if you changed void**userdata to void *userdata, which it is now.
Did you pass 0 to createStream? That can return an error with your code.

I used your code and did this, and it played the sound no problem.

[code:2h8nyqao]

FMOD_RESULT F_CALLBACK MyOpen( const char* name, int unicode, unsigned int fileSize, void** handle, void userData )
{
if ( name )
{
FILE* pFile = (FILE*)name;

  fseek( pFile, 0, SEEK_END );
  *fileSize = ftell( pFile );
  fseek( pFile, 0, SEEK_SET );
  *handle = pFile;
  return FMOD_OK;

}
return FMOD_ERR_INVALID_PARAM;
}

FMOD_RESULT F_CALLBACK MyClose( void* handle, void* userData )
{
if ( !handle )
{
return FMOD_ERR_INVALID_PARAM;
}
fclose( ( FILE* )handle );
return FMOD_OK;
}

FMOD_RESULT F_CALLBACK MyRead( void* handle, void* buffer, unsigned int sizebytes, unsigned int* bytesread, void* userData )
{
size_t haveRead = fread( buffer, 1, sizebytes, ( FILE* )handle );
*bytesread = (unsigned int)haveRead;
return FMOD_OK;
}

FMOD_RESULT F_CALLBACK MySeek( void* handle, unsigned int pos, void* userData )
{
fseek( ( FILE* )handle, pos, SEEK_SET );
return FMOD_OK;
}

void main()
{
FILE* file = NULL;
FMOD::System *system;
FMOD::Sound *pTestSound1;
FMOD_RESULT result;

result = FMOD::System_Create(&system);

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

fopen_s( &file, "c:/media/waterfall.mp3", "rb" ); //read a file into the memory

FMOD_CREATESOUNDEXINFO info;
memset( &info, 0, sizeof( FMOD_CREATESOUNDEXINFO ) );
info.cbsize = sizeof( FMOD_CREATESOUNDEXINFO );
info.fileuseropen = MyOpen;
info.fileuserclose = MyClose;
info.fileuserread = MyRead;
info.fileuserseek = MySeek;
result = system->createStream( (const char*)file, FMOD_DEFAULT, &info, &pTestSound1 );
result = result;

system->playSound(pTestSound1, 0, false, 0);
_getch();
//here’s the callback
}
[/code:2h8nyqao]

  • You must to post comments
0
0

Thanks for your reply.
That problem has been solved.I checked FMOD_CREATESOUNDEXINFO again,but the members are still useropen/userseek/… Maybe I used a old version.

  • You must to post comments
0
0

sorry, the members are still called useropen/userseek etc, I am referring to 1.03.00 which is coming out soon.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.