int *argcp and char **argv

closed account (2NywAqkS)
I have made a nice simple function to play a sound.

1
2
3
4
5
6
7
8
9
10
void Play_Sound(const char* filename)
{
    ALuint Buffer, Source;
    alutInit(/*What goes in here*/);
    helloBuffer = alutCreateBufferFromFile(filename);
    alGenSources (1, &Source);
    alSourcei (Source, AL_BUFFER, Buffer);
    alSourcePlay (Source);
    alutExit ();
}


But alutInit requires two arguments 'int *argcp, char **argv'
what do I write in there, bearing in mind this is a windows program.
According to this page: http://jerli.info/docu/Master_1/Son/Alut/#alutInit

You can just give it NULL for both params. It looks like it's for some commandline options which you probably dont' need.



Although I don't think this function you wrote is very good. It might not even work because you are shutting down OpenAL immediately after playing a sound (and I think the alSourcePlay call is nonblocking, so it will shut down before you even hear anything)

Setting up and shutting down OpenAL for every single sound is also not a good idea. It's resource intensive and wasteful. Typcially you setup/shutdown exactly once (set up at program startup, shutdown at program exit).
closed account (2NywAqkS)
Works! I did everything you said and now it works great. Thanks
Topic archived. No new replies allowed.