PC SOFT
ONLINE REPOSITORY
FOR WINDEVWEBDEV AND WINDEV MOBILE

Home |  | Sign in | English US
WD Play a sound mp3 / wav
Published by Boller
- Unclassified
New features



Description
WD Play a sound mp3 / wav

// select the sound file
sFile is string
sFile = fSelect(EDT_FILE,"Select a sound file...",...
"mp3 files (*.mp3)"+TAB+"*.mp3"+CR+...
"Wave files (*.wav)"+TAB+"*.wav"+CR+...
"All files (*.*)"+TAB+"*.*",...
"*",fselOpen+fselExist)

WinRedraw()

// If a file was selected
IF sFile<>"" THEN
EDT_FILE=sFile

// Close the previous sound file if there is one
// No action otherwise
MCIClose("MySound")

// Open the selected sound file
// "MySound" is the logical name (alias) chosen arbitrarily
// this name will be used to handle the file
MCIOpen(EDT_FILE, "MySound")

// If the opening failed
IF ErrorOccurred THEN
// Display the status report
Error(ErrorInfo())
END
END

//--------------------------------------------------------------------------------------

// Reposition at the beginning of the file
// When the user asks to read the file again, the read operation will start from the beginning
MCIBeginning("MySound")

// Read the selected sound file
// Reminder: "MySound" is the logical name chosen for this file when it is opened
MCIPlay("MySound")

//---------------------------------------------------------------------

// Pause the selected sound file
// Reminder: "MySound" is the logical name chosen for this file when it is opened
MCIPause("MySound")

//---------------------------------------------------------------------

// Stop reading the selected sound file
// Reminder: "MySound" is the logical name chosen for this file when it is opened
MCIStopPlaying("MySound")

// Reposition at the beginning of the file
// When the user asks to read the file again, the read operation will start from the beginning
MCIBeginning("MySound")

//---------------------------------------------------------------------

// Initialize the value of the slider
// The bounds of the slider are 0 - 65535
// Tune all the files: WAV, MP3...
VOLUME_SLIDER = MCIVolume("WAV")

// Tune the volume (use syntax #2 of MCIVolume)
// Tune all the files: WAV, MP3...
MCIVolume("WAV",VOLUME_SLIDER)

//--------------------------------------------------------------------
Illustrations, screen shots
none
none
User reviews
(To evaluate this resource, click 'Write a review')
No review or comment? Be the first one!