InDashPC.org Forum Index InDashPC.org
In Dash Car PC forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with Voice Recorder...

 
Post new topic   Reply to topic    InDashPC.org Forum Index -> Software -> PyMedia Tutorials
View previous topic :: View next topic  
Author Message
akus85



Joined: 03 Apr 2007
Posts: 4

PostPosted: Sat Apr 21, 2007 12:19 am    Post subject: Problem with Voice Recorder... Reply with quote

Hello...i try to write a voice recorder Rolling Eyes
I use wxpython and i want stop to record when i press the stop button,
if i use this code the application "sleep" and i not press the stop button.
How can i do ?

this my Record and Stop functions:

Code:

    def Record(self,event):
        self.StatusStop=False
        self.StatusRec=True
        self.file=open('Record.mp3','wb')
        cparams={ 'id': acodec.getCodecID( 'mp3' ),
                  'bitrate': 128000,
                  'sample_rate': 44100,
                  'channels': 2 }
        ac=acodec.Encoder(cparams)
        self.snd=sound.Input(44100,2,sound.AFMT_S16_LE)
        self.snd.start()
        while self.StatusRec==True:
            s=self.snd.getData()
            if s and len(s):
                for fr in ac.encode(s):
                    self.file.write(fr)


   
    def Stop(self,event):
            self.snd.stop()
            self.StatusRec=False 



Back to top
View user's profile Send private message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Tue Apr 24, 2007 11:49 am    Post subject: Reply with quote

I'm not sure how wxPython work but I would say you need dedicated thread like it is done in Player class.
Then control will not be blocked in a class during recording.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    InDashPC.org Forum Index -> Software -> PyMedia Tutorials All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group