You Are Here:

Community: Developer Discussion Boards

#1 Old Recording audio in a separate thread - 2009-06-29, 21:07

Join Date: Jun 2009
Posts: 1
Antti Alien
Offline
Registered User
Hi,
I'm trying to record audio in a separate thread (actually two, but it doesn't work with even just one). Here's a full working example, which breaks if I use the line that is commented out.

Code:
import appuifw
import audio
import e32
import thread

class Example:
    def __init__(self):
        self.sound_file_name = u'C:\\data\\sound.wav'
        self.lock = e32.Ao_lock()

    def run(self):
        appuifw.app.exit_key_handler = self.quit
        self.sound_file = audio.Sound.open(self.sound_file_name)
        self.recording = True
        thread.start_new_thread(self.record, ())
        self.lock.wait()
        self.stop()

    def record(self):
        #self.sound_file.record()
        print u'Recording'
        e32.ao_sleep(1)
        self.sound_file.stop()
        print u'Exiting'

    def stop(self):
        print u'Stopping'
        self.sound_file.close()

    def quit(self):
        print u'Quitting'
        self.lock.signal()

if __name__ == '__main__':
    example = Example()
    example.run()
This prints out "Recording" and then "Exiting" once one second has passed, as expected. If I use the line commented out, nothing prints out. If I call record() normally in the main thread, everything works just fine.

Can someone tell what I'm doing wrong here?
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
[moved] can not install application in emulator HAHAPrince Symbian Tools & SDKs 26 2009-04-02 21:34
Getting audio recording volume level souparnalodh Symbian User Interface 1 2009-01-07 09:36
Audio recording and streaming on Series 60 devices (C++) seekeru1 General Symbian C++ 9 2007-07-26 14:08
Problem with Audio & Thread ecio83 Symbian Media (Graphics & Sounds) 3 2007-07-16 17:45
Nokia 6020 don't supports instalation of audio recording application, but has a... zehdopulo Mobile Java Media (Graphics & Sounds) 1 2007-01-21 22:54

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia