You Are Here:

Community: Developer Discussion Boards

#1 Old Scope issues with Audio module? - 2005-09-30, 03:35

Join Date: Sep 2005
Posts: 3
lothaekor
Offline
Registered User
Hello everyone,

I'm hoping someone can help me with this problem I'm having. For some reason, when in a class, I cannot access the Sound object provided by the audio module.

I am using Python 1.1.6 alpha, with a 1st edition C++ SDK. This script is only running on the emulator.

The issue is as follows:

When I run the following code, there is no problems, and I hear the sound.

Code:
import audio
f = 'Z:\\system\\sounds\\digital\\Startup.wav'
s = Sound.open(f)
s.play()
However, when I work with the application I'm building, it comes up with "NameError: global name 'sound' is not defined"

Code:
import audio

...

class MyClass:

...

    def play_file(self):
    	self.sound_obj = Sound.open('Z:\\system\\sounds\\digital\\Startup.wav')
    	self.sound_obj.play
The play_file method is called by using the appuifw menu.

Does anyone know why I'm getting these errors, when I've got many more modules with statements nested deeper than this Sound object?

Thanks
Jeremy
Reply With Quote

#2 Old Re: Scope issues with Audio module? - 2005-09-30, 10:51

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
Neither of the code snippets you posted should work, since you are importing just one name: "audio".

If you say "import audio" you have to access the Sound class like this: "audio.Sound". If you want the Sound name imported into your namespace you either have to say "from audio import Sound" or "from audio import *".
Reply With Quote

#3 Old Re: Scope issues with Audio module? - 2005-10-01, 17:17

Join Date: Sep 2005
Posts: 3
lothaekor
Offline
Registered User
Thanks. I'm still learning the little nuances of Python.
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
How to repeat audio playback in audio streaming? asheeshv General Symbian C++ 6 2007-07-11 09:33
Full Duplex Audio Streaming ibabbar Symbian Media (Graphics & Sounds) 1 2006-09-16 12:36
sonify.org to focus on mobile device audio hp3 Mobile Java Media (Graphics & Sounds) 0 2004-10-16 17:39
Converting audio frames between formats Edison Thomaz Symbian Tools & SDKs 0 2004-10-05 22:55
7650: empty screen when audio is played? SVii General Messaging 1 2002-08-20 07:31

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 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d81449X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZpythonQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxpythonX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ