🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #857

Media Player with .wav files

#857
From: Steve McKewen
Date: Sat, 01 Mar 2003 23:35
65 lines
2863 bytes
I had an app written some time ago in V4 ro V5 that used a media player to
play assorted wav files, but now I can't do it.

I have a media player component , that I want to assign .wav files to the
FileName property programmatically, and then play them using a call to
MediaPlayer1->Play().

Its not working but.
If I assign the FileName at design time, then I can play that file, but once
I reassign the FileName it doesn't work anymmore.


I click btnBrowse and it preloads an OpenDialog with the current filename
and on completion write the new filename back to a editbox (eAudioFile)

//--------------------------------------------------------------------------
-
void __fastcall TAlarmOptions::btnBrowseClick(TObject *Sender)
{
    //Use the open file dialog ODSounds
    //Load the filename with the current value
    ODSounds->FileName = eAudioFile->Text;
    //Show the dialog
    if (ODSounds->Execute())
    {
        //Save the filename selected to the alarm option
        eAudioFile->Text = ODSounds->FileName;
    }
}

When eAudioFile is changed it copies its text into the media player
MPAudioFile FileName property.

//--------------------------------------------------------------------------
-
void __fastcall TAlarmOptions::eAudioFileChange(TObject *Sender)
{
    //Setup the media player
    MPAudioFile->FileName = eAudioFile->Text;
}

When you clik the play button it should play

//--------------------------------------------------------------------------
-
void __fastcall TAlarmOptions::TestClick(TObject *Sender)
{
    MPAudioFile->Notify = true;
    MPAudioFile->Wait = true;
    MPAudioFile->Play();
}

but it doesn't

The Media Player is set up like this at design time.

AutoOpen = true
AutoEnable = true
AutoRewind = true
DeviceType = dtWaveAudio
Enabled = true
FileName = ""
Shareable = true

Any help would be greatly appreciated.
Technical Details
Message-ID: <3e6143b5@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newspeer1.nwr.nac.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d0fc,d2d1de8fa03921dc,start
X-Google-Attributes: gid10d0fc,public
X-Google-ArrivalTime: 2003-03-01 15:36:52 PST
From: "Steve McKewen" <stevemckewen@bigpond.com.au>
Newsgroups: borland.public.cppbuilder.multimedia
Subject: Media Player with .wav files
Date: Sun, 2 Mar 2003 10:35:30 +1100
Lines: 67
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 144.134.250.104
Message-ID: <3e6143b5@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1046561717 144.134.250.104 (1 Mar 2003 15:35:17 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newspeer1.nwr.nac.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail