LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-13-2004, 09:08 PM   #1
clb
Member
 
Registered: Sep 2004
Location: UK
Distribution: Ubuntu
Posts: 117

Rep: Reputation: 16
Threads and OpenAL


Hey everyone.
I need to find a way to have a C++ console application on linux that plays ogg files, but while its playing I can do other things, such as add/remove songs from teh playlist, etc. Bascially I need the sound being played independantly of the program, so it can be controlled at any point in time, not just when the song has finished.

Any help would be appreciated,
Thanks,
Chris.
 
Old 11-14-2004, 11:56 AM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Threads, as in your thread title are good idea. One playing, second one doing different things. The problem is with their communication - I suggest a variable, protected by a semaphore (or even mutex) that's read by the thread playing music (so it must be in a loop checking the mutex from time to time) and written by the second thread.
 
Old 11-14-2004, 12:18 PM   #3
clb
Member
 
Registered: Sep 2004
Location: UK
Distribution: Ubuntu
Posts: 117

Original Poster
Rep: Reputation: 16
Heh, thanks. I figured threads would be the way to go. I should have been more specific, I know nothing about threads, does anyone know of any good sites?

Thankyou for your advice Mara, it clarified the solution a little, and set me on the right path.

Thanks,
Chris
 
Old 11-14-2004, 12:38 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
So you're new with threads? Then you'll spend some time reading and experimenting, as threading changes the way you think about programs

Two nice tutorials (but you should still try with the examples yourself):
http://dis.cs.umass.edu/~wagner/thre.../tutorial.html
http://www.yolinux.com/TUTORIALS/Lin...ixThreads.html
 
Old 11-14-2004, 02:04 PM   #5
clb
Member
 
Registered: Sep 2004
Location: UK
Distribution: Ubuntu
Posts: 117

Original Poster
Rep: Reputation: 16
Thats great :-) Thankyou very much.
Threading does seem ...interesting, but very complex at first. I will give it a shot :-)

Thanks again,
Chris,
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java threads listed using kill -3 does not contain all threads found using ps -auxww coneheed Programming 2 11-14-2005 08:57 AM
OpenAL and dmix Belegdol Linux - Software 0 11-01-2005 04:40 AM
OpenAL? hylke Programming 9 07-25-2005 05:49 PM
OpenAL Problems. DarkestHour Linux - Games 1 12-01-2004 09:08 AM
OpenAL Installation Help Little_Devil Linux - Software 0 08-08-2002 02:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration