FMOD SetVolume in C

Hello I’m asking for help,
I’m trying to change volume in C (i’m using CodeBlocks) but i get this error : |error: expected declaration specifiers or ‘…’ before ‘volume’|

    SDL_Event event;
    int continuer = 1;

    FMOD_SYSTEM *system;
    FMOD_SOUND *musique;
    FMOD_RESULT resultat;
    FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);

    resultat = FMOD_System_CreateSound(system, "Zeze.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);
    FMOD_CHANNEL *channel;
    FMOD_System_GetChannel(system, 9, &channel);
    if (resultat != FMOD_OK)
        fprintf(stderr, "Impossible de lire le fichier mp3\n");
    //FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL);
    FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL);
    FMOD_RESULT FMOD_ChannelGroup_SetVolume(FMOD_CHANNELGROUP * channel, float 0.3);

This error is at last line with float 0.3…
I hope somebody could help me

This is some basic misunderstanding with C, the C functions that you call dont start by putting in the type at the start (ie FMOD_RESULT). You also did it with ‘float 0.3’ … you dont use that keyword at all. you just pass the number, ie 0.3

FMOD_RESULT is the thing the function returns. To capture that, you can declare a variable of type FMOD_RESULT if you want. ie


then receive the ‘return value’ of FMOD_Channel_SetVolume into ‘result’.

result = FMOD_ChannelGroup_SetVolume...

Also, there are some issues there with pointers. You’re supposed to pass the address of your pointer to playsound, then that’s your handle that you can use to set the volume on.
You then pass the channel as the handle to SetVolume. You dont use the type in the parameter… You should just be using ‘channel’ as the parameter.

Also you mixed up ChannelGroup and Channel. You dont pass a channel as the handle to a ChannelGroup function. It should be FMOD_Channel_SetVolume not FMOD_ChannelGroup_SetVolume

Thank you a lot
I have fixed up all my errors and it now works