IRIX Network Forums
IRIX C source example of playing sound while doing other things. - Printable Version

+- IRIX Network Forums (//forums.irixnet.org)
+-- Forum: SGI/MIPS (//forums.irixnet.org/forum-3.html)
+--- Forum: Development/Porting (//forums.irixnet.org/forum-9.html)
+--- Thread: IRIX C source example of playing sound while doing other things. (/thread-2661.html)



IRIX C source example of playing sound while doing other things. - KayBee - 01-14-2021

Hi All,

I am writing little irisGL programs and would like to incorporate sound. I have the dmedia .pdf manuals but I have not found a c example of how to play a sound while other things are happening on screen. I would appreciate any examples.

PS. my O2 has only dvaudiotest in the /usr/share/src/dmedia directory

Thank you.

KB


RE: IRIX C source example of playing sound while doing other things. - sgt_barnes - 04-09-2021

Hi KayBee,

You can find a simple example here:

http://www.adrianfreed.com/content/audio-io-programming-sgi-irix

In essence, it uses "select" to sleep while nothing interesting happens (i.e. no key is pressed and the audio queue didn't run empty). To make this work with graphics (which need to be updated at least every 50ms), you need to supply a timeout. Read up on select(2) to see the details of that.

That's called "asynchronous I/O", and I personally consider this to be challenging topic for beginners. But so is graphics. And challenges are good, that's how we learn!


RE: IRIX C source example of playing sound while doing other things. - KayBee - 04-13-2021

Ah, great! Thank you sgt_barnes!

I had thought I would not get an answer. Yes I am finding learning C to be a challenge for sure, but graphics has been a blast and I look forward to adding sound.

Thanks again for finding this, and for naming the concept, now I can do further research.

KB


RE: IRIX C source example of playing sound while doing other things. - sgt_barnes - 04-13-2021

You're welcome, KayBee! That's what this community is here, for!

So I'm looking forward to see your creations!


RE: IRIX C source example of playing sound while doing other things. - Raion - 04-13-2021

Same, it'll be neat to see what you come up with.