0
0

For my current project I need to keep track of the time my music file has been playing. I have tested FMOD_Channel_GetPosition with a .ogg and a .wav file. Both kept throwing error 37:
FMOD_ERR_INVALID_PARAM
An invalid parameter was passed to this function.

This code should return the current time, but position stays null all the time.
[code:348y2ojz] unsigned int * position = 0;
result = FMOD_Channel_GetPosition(m_musicChannel, position, (FMOD_TIMEUNIT)FMOD_TIMEUNIT_MS);
ERRCHECK(result);
return * position;[/code:348y2ojz]

I am out of ideas about what the problem is. Any help or ideas would be most appreciated.

Thanks in advance,
Dysprosium

  • You must to post comments
0
0

I am now working on another part, which is supposed to alter the frequency of the music, but throws me the same error.

[code:ovj2z4hc] result = FMOD_System_PlaySound(m_system, FMOD_CHANNEL_FREE, m_music, 0, &m_musicChannel);
ERRCHECK(result);
result = FMOD_Channel_GetFrequency(m_musicChannel, musicFrequency);
ERRCHECK(result);
cout << m_musicChannel << endl;
result = FMOD_Channel_SetChannelGroup(m_musicChannel, musicGroup);
ERRCHECK(result);[/code:ovj2z4hc]

[b:ovj2z4hc] result = FMOD_Channel_GetFrequency(m_musicChannel, musicFrequency);
ERRCHECK(result);[/b:ovj2z4hc]

That is the part that throws the exception.
m_musicChannel is not null; I have tested that.
musicFrequency is a pointer to a float.

I still don’t get what I am doing wrong here. I suppose my best shot is getting some sleep and praying tomorrow will bring me some answers.

Cheers,
Dysprosium

  • You must to post comments
0
0

You’re not calling the functions in the correct way. You need to pass in the address of an [b:1zhiss2d]existing [/b:1zhiss2d]float or int. You’re getting INVALID_PARAM because you’re passing in a null pointer.

The code inside those functions dereferences the pointer and assigns a value to it. If the passed in value is 0 it will throw an error.

They need to look like this:

[code:1zhiss2d]unsigned int position = 0;
result = FMOD_Channel_GetPosition(m_musicChannel, &position, (FMOD_TIMEUNIT)FMOD_TIMEUNIT_MS);
ERRCHECK(result);
return position;[/code:1zhiss2d]

The same is probably true for musicFrequency.

  • You must to post comments
0
0

Thanks a million, man! That was an incredibly stupid mistake due to lack of sleep and experience. Yay, now I get to fix my program before I go to bed!

Thanks for taking the time to help me out! Appreciated! :)

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.