🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
1 messages
1 total messages Started by Steve McKewen Sat, 01 Mar 2003 23:35
Media Player with .wav files
#857
Author: 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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads