LinuxQuestions.org
Visit Jeremy's Blog.
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 02-04-2010, 01:18 PM   #1
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Rep: Reputation: 43
Sound code causes code to pause


Hi all
I'm using alsa libasound to write some embedded code. When I play a sound using snd_pcm_writei it causes the code to pause. Can some one whose done this advise, am I doing something wrong or do I need to set off threads to play sound? I'm not to keen on threads as it's an embedded board. Thanks
 
Old 02-06-2010, 05:28 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
I haven't written sound code, but it might be that the sound driver isn't buffered at the kernel level, causing your process to block while it waits for the driver to read. Do you have access to a file descriptor? If so, set it to non-blocking and see what happens. Otherwise, you might just need to use a separate thread for the sound or regulate the bit-rate manually with nanosleep. You might also ps your process and see what the status is when it's paused. That should tell you if it's blocked for I/O.
Kevin Barry
 
Old 02-07-2010, 03:26 AM   #3
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
I've since found out at this level you have to buffer sound and write chunks on sound interrupts. Unfortunately there's very little documentation on this :s So I'm very slowly working my way into it. I would have thought the web would be full of examples/tutorials on this but it isn't. Lot's show you how to start the card and write a single sound, but few how to use interrupt driven and as far as I can tell none how to use interrupt driven with memmap.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Error in Perl Code : Bad switch statement(Problem in code block)? near ## line # suyog255 Programming 4 02-20-2008 05:35 PM
small syntax problem with C code (implemented in Code Composer Studio) illiniguy3043 Programming 6 01-07-2008 02:14 AM
User Preferences: Use HTML code instead of vB code? (vB code is overrated) stefanlasiewski LQ Suggestions & Feedback 5 07-26-2005 01:37 AM
Open Firmware code for booting OS from SATA : sample code available somewhere ? drsparikh Linux - Hardware 0 03-12-2004 11:16 AM

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

All times are GMT -5. The time now is 03:34 AM.

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