線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1045
推到 Plurk!
推到 Facebook!

如何顯示聲音檔的標放時間長度

尚未結案
o1016
一般會員


發表:4
回覆:7
積分:2
註冊:2003-03-21

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-06-12 17:22:46 IP:61.223.xxx.xxx 未訂閱
我想要在bcb撥放聲音的時候,顯示出每次撥放wav檔的聲音時間長度,像撥放音樂軟體那樣顯示幾分幾秒,請問我該如何做?或者有沒有相關資訊? 謝謝!
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-06-12 20:55:08 IP:61.224.xxx.xxx 未訂閱
使用 TMediaPlayer 內有 Position 可用,表示目前正在撥放的位置,而其顯示的單位可以使用 TimeFormat 這個 Property 來設定,可以參考 TimerFormat 的 Online Help 內有範例,我把它改成顯示 Position 的數值:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  int TheLength;
  // Set time format - note that some devices don't support tfHMS
  MediaPlayer1->TimeFormat = tfHMS;
  // current position of media
  TheLength = MediaPlayer1->Position; 
  // display hours in label 1
  Label1->Caption = IntToStr(LOBYTE(LOWORD(TheLength)));
  // display minutes in label 2
  Label2->Caption = IntToStr(HIBYTE(LOWORD(TheLength)));
  // display the seconds in label 3
  Label3->Caption = IntToStr(LOBYTE(HIWORD(TheLength)));
}
由其註解表示, tfHMS 並不是每種 media 都支援,可以改用 tfMilliseconds 轉成千分之一秒,自己再轉換即可。 沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
dickhomepage
一般會員


發表:14
回覆:5
積分:3
註冊:2005-01-18

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-01-23 18:23:53 IP:220.142.xxx.xxx 未訂閱
我想問一下如果要上面的時間格式加到裡頭應該要加在哪邊呢?? 我是新手!!我弄很久了!!麻煩解惑!!    //---------------------------------------------------------------------------    #include  #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::X1Click(TObject *Sender) { Form1->Close(); } //--------------------------------------------------------------------------- void __fastcall TForm1::SpeedButton2Click(TObject *Sender) { if(OpenDialog1->Execute()) { MediaPlayer1->FileName=OpenDialog1->FileName; MediaPlayer1->Open(); ScrollBar1->Min=MediaPlayer1->Position; ScrollBar1->Max=MediaPlayer1->TrackLength[0]; } } //--------------------------------------------------------------------------- void __fastcall TForm1::SpeedButton3Click(TObject *Sender) { Form1->Close(); } //--------------------------------------------------------------------------- void __fastcall TForm1::O1Click(TObject *Sender) { if(OpenDialog1->Execute()) { MediaPlayer1->FileName=OpenDialog1->FileName; MediaPlayer1->Open(); ScrollBar1->Min=MediaPlayer1->Position; ScrollBar1->Max=MediaPlayer1->TrackLength[0]; } } //--------------------------------------------------------------------------- void __fastcall TForm1::Timer1Timer(TObject *Sender) { if(MediaPlayer1->FileName!="") { Label1->Caption=MediaPlayer1->Position; ScrollBar1->Position=MediaPlayer1->Position; } } //--------------------------------------------------------------------------- void __fastcall TForm1::ScrollBar1Scroll(TObject *Sender, TScrollCode ScrollCode, int &ScrollPos) { MediaPlayer1->Position=ScrollBar1->Position; MediaPlayer1->Play(); } //---------------------------------------------------------------------------
系統時間:2024-05-11 4:21:09
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!