Hi
any ideas for a simple solution to play a second sound 5 seconds after the first?
first sound play only once
second sound start looping after 5 seconds
Many thanks
Hi
any ideas for a simple solution to play a second sound 5 seconds after the first?
first sound play only once
second sound start looping after 5 seconds
Many thanks
What have you tried? http://mattgemmell.com/what-have-you-tried/
I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming
My Twitter: https://twitter.com/indieprogram
My Book: http://amzn.com/1305076532
This.What have you tried? http://mattgemmell.com/what-have-you-tried/
- Jason Astle-Adams
Giving such links is nothing but a waste of time, sorry. Is he trying to sell me stuff? I didn't even bother to read that spam.
I still have no idea on how to play a sound only once.
and I ran into another problem on how to set source direction:
alSourcef (Sources[1], AL_DIRECTION, 0, 1, 0.0 );
I get "too many arguments but I cannot find any doc about that.
Any examples I've found are too simple to not use any of the above.
Is he trying to sell me stuff? I didn't even bother to read that spam.
No, it's not trying to sell you anything, and you're wasting our time by expecting us to provide you with an answer without putting in any effort -- if you bother to read it you'll find some really good advice that it seems like you really need.
...and if you tell us what you've already tried, we'll see if we can help you out.
You have already tried to solve your problem haven't you? You're not just hoping for us to solve your problem for you without any effort are you?
Did you try searching for resources? I just typed "openal play sound" into Google and the first page is filled with promising look links [1, 2, 3, etc.] -- have you tried any of those and are having problems we can help with?
- Jason Astle-Adams
I've tried something alike but I gave up and look for source direction like I've said before:
if (hdgL[0] >=0.0){
alListenerfv(AL_ORIENTATION, ListenerOriVorne);
}else{
alListenerfv(AL_ORIENTATION, ListenerOri);
}
Any examples I've found are too simple to not use any of the above.
and I ran into another problem on how to set source direction:
alSourcef (Sources[1], AL_DIRECTION, 0, 1, 0.0 );
I get "too many arguments but I cannot find any doc about that.
I searched for "openal documentation". The first link was to the OpenAL Specification, which although very detailed may not be all that approachable, so I moved on.
The second result was to the Creative OpenAL Programmer's Reference, which explains the function in question on page 16. Just as your error message says, you appear to have too many arguments; the function only expects three arguments and your code snippet has five. Are you perhaps wanting to use the alSource3f function (found on page 17) instead, which does take five arguments?
If you're looking for additional documentation, the third result of my research was the OpenAL Programmers Guide, which also appears to be quite detailed.
I still have no idea on how to play a sound only once.
What have you tried?
You also still haven't told us what your target operating system(s) are...
//EDIT:
This was edited in to your post after I posted this reply, so going back to retroactively respond to it...
I've tried something alike but I gave up and look for source direction like I've said before:
...that's just the thing -- you didn't say that before, and it's important information for us to try to help you.
- Jason Astle-Adams
Thanks. I was looking for the openal programmers guide. Lost that some years ago. Still haven't found out how to play a sound only once. alSourcei (Sources[5], AL_LOOPING, AL_FALSE ); has no effect.
Also I don't understand direction vector:
ALfloat SourcesDir[NUM_SOURCES] = { 0.0, 0.0, 1.0 };
also has no effect. From behind sounds are ok, but from the front left/right need to be swapped. I gave up on listener hence I try such with sources.
Thanks
PS: I target desktops (linux/osx/win)
Are you checking for errors with alGetError?
If you're working based on any examples it's quite likely that they probably omit error checking so that it doesn't clutter up the example and confuse you further, but you should be checking for errors after any call that can potentially fail. You'll find some documentation for this on page 14 of the OpenAL Programmer's Guide (linked above).
Have you used vectors in graphics, or covered them in maths at school? Do you not understand the concept of using a vector for direction, or just the specifics of how it's applied to openal?
PS: I target desktops (linux/osx/win)
Are you using any other libraries for windowing, input, etc.? This is important for properly answering your question about playing a second sound after a delay, as you will either need to use a timing function provided by another library or by the underlying operating systems.
I was looking for the openal programmers guide.
Looking where and how? Even understanding that Google gives personalised results and you might be seeing different results than I am, when I search for "openal programmers guide" five of the results on the first page are it. When I instead search for "openal documentation" it appears twice in the results as the second and sixth result. If I instead search for "openal tutorial" it only appears once on the first page of results, but it's still there. Results with Bing and DuckDuckGo are very similar, as I would assume those from any competent search engine to be.
I find it hard to believe that you wouldn't have found it very quickly if you were actually looking for it. It doesn't help anyone to pretend you had previously been trying if you weren't actually putting in the effort, but now that you've actually started answering our questions rather than just complaining about the "what have you tried" link we can start to work through your problem. :)
- Jason Astle-Adams
Never mind, I've stumbled across:
http://www.opentk.com/node/211
and got it all fine now with that listener formula. Exactly what I needed.