Tags

, , , , , , , , , , , , ,

Monita is an Hispanic ball-buster. She owns a sandwich business. Bottles of fizzy water, snack bits for the office types. You know. She said.

‘Whatcha doin shithead,’ whilst chewing chewing gum.

I told her that I was making a TV set for my Oculus Rift virtual reality headset.

‘Why you want to do that, lover boy?’ she sneered.

I was not her lover boy. Monita was toying with me.

‘Because Peters put his foot through my real TV set,’ I explained, ‘So I thought maybe I could create a new one for my virtual world.’

Now I must add 3D audio, so when I stroll about the virtual world it will seem as if the TV sound is coming from exactly where the TV is sitting. And when I turn my head I will hear the TV sound pass by my right ear, then at the back of my head, then into my left ear. When I walk away from the TV set the sound will diminish. When I walk back up to the TV set it will get loud again.

I have already done 3D audio with the Oculus Rift, in my post Oculus spatializer plugin for FMOD.

So it is just a case of adding an event to FMOD Studio for my TV sound:

oculusrift_virtualtv_fmodstudio

Notice that I am using the Oculus spatializer plugin for FMOD, courtesy of the Oculus Audio SDK Plugins.

I then target the FMOD API in my C++ Visual Studio application to play the event. The sound event is placed in the virtual world at the exact same position as the TV set, which I am rendering to the Rift headset using the Oculus SDK for Windows and OpenGL. When I stroll about the virtual world, my position and orientation is used to adjust the sound accordingly.

Put your earphones in and play the video:

Can you hear the 3D audio spatialization? As I turn my head around, you can hear the sound pass by your ears. As I walk away from the TV set it gets quiet.

I can try different settings for the Oculus spatializer plugin for FMOD, so as to get the reflections and reverb appropriate to the size of the virtual room I am in.

‘Do you want to listen to the 3D audio?’ I asked Monita.

She looked up from examining her nails with a face of disgust. ‘You weird nerd. Why you not get out more?’

‘Do you want a listen?’ I persisted.

‘No,’ she said flatly, ‘I got business to run.’

And she left.

Strange how different things excite different people. I slipped on my Rift headphones for another listen to the wonderful 3D audio coming out of my virtual TV set. Indulge yourself, I whispered reassuringly to myself, Indulge.

Ciao!

P.S.

But how did I get the video to play on the TV screen? Answers in my previous post OpenCV video capture with C++.

Now, to get the video to play at the pace my heart desires, I added the following code to the thread of my CaptureClient class in said previous post:

std::this_thread::sleep_for(std::chrono::milliseconds(30));

Just drop the code at the end of the while loop and it will slow down the frame rate of the TV.