Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Nov 24, 2017 2:38 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Basic Sound problem
PostPosted: Tue Mar 22, 2011 10:31 am 
Offline

Joined: Wed Apr 09, 2008 7:50 am
Posts: 22
I have an app that I wrote for Windows RB2010r5 which plays simple wav files.
I have since upgraded to RB2011r1 and the code no longer works.
Code is

sub playsound(fn as string)
dim vf as folderitem
dim voice as sound

vf=getfolderitem("c:\Sound\" + fn)
if vf <> Nil then
voice=vf.OpenAsSound
voice.play
end


when I execute, I get a nilobjectexception on voice.play. I know the vf item contains "c:\Sound\welcome.wav" and I also know that welcome.wav works with media player. And, as stated, this code worked in 2010. I don't see any syntax changes in the 2011 help under Sound. Anyone have any ideas?

Bud


Top
 Profile  
Reply with quote  
 Post subject: Re: Basic Sound problem
PostPosted: Wed Mar 23, 2011 1:51 pm 
Offline

Joined: Mon Aug 14, 2006 9:33 pm
Posts: 1774
You don't check whether vf.Exists = True
you may be getting a folderitem to a file that a) doesn't exist or b) can't be opened as a sound.
Step through this code in the debugger and see what vf points to before the attempt to openAsSound

_________________
Roger Clary
Class One Software
Educational Software for Lifelong Learning
http://www.classonesoftware.com


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group