Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Play sound(repeat playing)


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-05-2008, 04:25 PM
Newbie
 
Join Date: Mar 2008
Posts: 4
Default Play sound(repeat playing)

hi all...first of all Basic4ppc rocks! hehehe

i tired searching for free alaram software for my O2 mini (WM2003SE) so i decided to build my own alarm. hehehehe! (still learning). i know how to play sound using Sound("music.wav"). can anyone guide me how to repeatedly play the sound untill i click a button to stop it.

p/s: i'm newbie...please be gentle. thanx!
Reply With Quote
  #2 (permalink)  
Old 04-05-2008, 04:45 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,770
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Try using a Timer with a period longer than the sound takes to play. Enable the Timer when the alarm goes off, disable it in the Click event of a button.
Reply With Quote
  #3 (permalink)  
Old 04-05-2008, 04:51 PM
Knows the basics
 
Join Date: May 2007
Posts: 98
Default

Hi there, and welcome to the B4ppc community! To repeated play a sound, use the FMOD library. Follow these steps:
From the Basic4ppc IDE, go to Tools - Conponents, and press the Add DLL button, the one where it adds dlls to both list boxes. Next, select fmodDesktop.dll (to build this app on the desktop) or FMODDevice.dll (to build it on the device) from the Open File Dialog box. Next, press OK.
Go back into Tools - Add Object, choose FMOD then give it a name so you can call it in your program.
Click the Close button then where you want the sound to play repeatedly, just write the name you typed inside the object name field followed by a period, click PlayLoop and in parenthesis type (AppPath & "\Filename.wav")
When you click the stop button, on the sub that is activated on the click event, inside the sub type objectname followed by a period, and click on Stop1. Here's an example program:

Sub Globals
'Declare variables here.
End Sub

Sub App_Start
'MySound is a FMOD object added in Tools - Add Object after referencing FMODDesktop.DLL for the desktop. If I want device, I'd reference FMODDevice.dll from the Tools - Components dialog box.
MySound.New1 'Initialize FMOD to get ready to play a sound.
addform("Test", "Repeating Sound")
addbutton(test, "Stop", 40, 40, 5, 5, "Stop") 'You will have to change the left, top, width, and height properties listed as numbers in between the commas, or use the Forms' Designer.
test.show
MySound.PlayLoop(AppPath & "\Alarm.wav") 'Use apppath to get the relevant path of the application.
End Sub
Sub Stop_click
MySound.Stop1
End Sub


Hope that helps.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
help on playing sound sanoy Questions & Help Needed 4 11-08-2008 01:03 AM
playing a video clip colin9876 Questions & Help Needed 5 05-20-2008 09:18 AM
Playing midi notes Cor Questions & Help Needed 1 02-04-2008 11:47 AM
How to play multiple sounds at once? justdo Questions & Help Needed 2 09-24-2007 04:59 AM
How to play 2 sound files at the same time? conf Questions & Help Needed 2 08-27-2007 07:21 AM


All times are GMT. The time now is 02:15 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0