0
0

Hello, i am trying to add and retrieve some syncpoints. adding them is working well. however, when i try to get them, some problems occur.
For example, i add 3 points (3, 20, 25). when i try to get the 3rd point, i get the correct name: "myPoint3" however the wrong value "24". should be 25 .. but i can run the sound without problems.
so, when i try to get the 2nd point, i get the correct name: "myPoint2" and the correct value "20" – however i cant run the sound – it breaks up with an bad memory access error or similar.

when i try to get the first point, again i get the correct name for the point, however not the correct value, its "2" and not 3. Also i get bad memory access after trying to play the sound.

[code:1by2v2x6]
void mySoundPlayer::addSyncPoint() {

printf("\nstart testing syncpoints\n");

FMOD_SYNCPOINT *ptr = 0;
result = FMOD_Sound_AddSyncPoint(sound, 3 ,FMOD_TIMEUNIT_MS,"myPoint1", &ptr);
result = FMOD_Sound_AddSyncPoint(sound, 20 ,FMOD_TIMEUNIT_MS,"myPoint2", &ptr);
result = FMOD_Sound_AddSyncPoint(sound, 25 ,FMOD_TIMEUNIT_MS,"myPoint3", &ptr);

ERRCHECK(result);

}

void mySoundPlayer::getSyncPoint() {

int numsyncpoints;
FMOD_Sound_GetNumSyncPoints(sound, &numsyncpoints);
printf("\nnumsyncpoints: %i\n", numsyncpoints);

FMOD_SYNCPOINT *poi;
char name[8];
unsigned int *offset;
result = FMOD_Sound_GetSyncPoint(sound, 2 ,&poi);
result = FMOD_Sound_GetSyncPointInfo(sound,poi,name,8,offset,FMOD_TIMEUNIT_MS);

if (result == FMOD_OK){
printf("name: %c", name[0]); for (int i = 1; i<8; i++) printf("%c", name[i]);
printf("\noffset: %u\n", *offset);
} 
ERRCHECK(result);

}
[/code:1by2v2x6]

am i doing somethin wrong? i would appreciate any hints.

  • You must to post comments
0
0

new problem occured. maybe someone can help.

callbacks are firing well. bpm is accurate. if i play deck_A and deck_B at the same time (without callbacks), the beat is matched and it sounds great.

however, i want to play deck_B after a callback fire from deck_A. so i tried to pass the object deck_B to the callback-function from deck_A, so i could then play deck_B after a callback fires. but its not working, i get a bad memory access error or something similar (exact error message is in german, so excuse me). any suggestions? :)

  • You must to post comments
0
0

ok, i get it. i need to use callbacks.

fair enough, i tried following:

(GLOBAL)
[code:3fim2iao]
FMOD_RESULT F_CALLBACK mycallback(FMOD_CHANNEL * channel, FMOD_CHANNEL_CALLBACKTYPE type, void* commanddata1, void* commanddata2)
{
if (type == FMOD_CHANNEL_CALLBACKTYPE_SYNCPOINT)
printf( "Got a sync point callback!" );

return FMOD_OK;

}
[/code:3fim2iao]

and

[code:3fim2iao]
FMOD_Channel_SetCallback(channel, mycallback);

FMOD_System_Update(sys);
[/code:3fim2iao]

i get an "error LNK2019" for the external symbol "_FMOD_Channel_SetCallback@8". Any idea how i can solve this, please ?

  • You must to post comments
0
0

ok, i solved the LNK error with an API update.

however, callbacks dont fire! before i set the callback, i set several syncpoints like in my first post.

can anyone help me please?

  • You must to post comments
0
0

check the FMOD_RESULT returned from the functions you are calling, you might have an invalid channel handle.

  • You must to post comments
0
0

[quote="peter":4a05ph3u]check the FMOD_RESULT returned from the functions you are calling, you might have an invalid channel handle.[/quote:4a05ph3u]

indeed, i have an invalid channel handle: "FMOD error! (36) An invalid object handle was used."

still i don’t exactly know whats wrong now. where can i fix it?

  • You must to post comments
0
0

If you have an invalid handle error that is basically equivalent to dereferencing a NULL pointer; it’s a bogus operation because it’s a bogus object. To create a valid FMOD_CHANNEL object you must call FMOD_System_PlaySound.

  • You must to post comments
0
0

[quote="peter":3phepiin]If you have an invalid handle error that is basically equivalent to dereferencing a NULL pointer; it’s a bogus operation because it’s a bogus object. To create a valid FMOD_CHANNEL object you must call FMOD_System_PlaySound.[/quote:3phepiin]

but i did call FMOD_System_PlaySound. what else could it be?

  • You must to post comments
0
0

If you call playSound and it returns FMOD_OK then the channel object created should be valid. Channels are pooled objects so if you create enough channels to exceed the size of the pool you will start stealing old channels and incalidating those old channel handles.

  • You must to post comments
0
0

thank you for your help!

my fault again. forgot to update the *.dll files. finally, callbacks are firing!!

btw, what is the best way to do the FMOD_System_Update(sys); ?
currently i am doing a while loop inside my playSound method. bad thing is, my userInterface is blocked because of that.
do i need to implement threads? or is there another way you can me suggest?

another btw, i like FMOD. finally i see through the wood – a little – and looking forward to implement much more in the future 😀 .

  • You must to post comments
0
0

Hi there, the usual approach for calling System update in a GUI based application is to use a timer or event. Calling FMOD from separate threads is generally quite dangerous and should be avoided. Most event based GUI frameworks provide some mechanism for polling from the main thread. What are using for your UI?

  • You must to post comments
0
0

i am using openGL. UI doesnt freeze anymore. i solved it. i had an extra loop inside my function (which sets the callback), that loop wasn’t necessary because this function is already repeatedly called.

thank you again!

btw, i am implementing a dj music software, where someone can mix up 2 sounds.
i already have the bpm. next step is to store all the syncpoints and finally do the beatmatching.

have a nice day!

  • You must to post comments
Showing 11 results
Your Answer

Please first to submit.