HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2010
1230
kn.tm「音声ファイルのプロパティの取得(書き込み)」のプログラム7解決


kn.tm

リンク

2010/12/30(Thu) 10:28:39|NO.36431

HSPで音楽プレイヤーを作ってみようと頑張っています。

そこで、「タイトル」「長さ」や「参加しているアーティスト」などのプロパティの情報を取得して表示できるようにしようと思ってGoogleで検索してみたのですが全然わかりませんでした。

主に再生するファイルはMP3形式を考えています。

音楽ファイルのプロパティの取得と、できたら書き込みもしたいです。

いい方法を教えてください。お願いします。



この記事に返信する


inovia

リンク

2010/12/30(Thu) 12:18:33|NO.36433




kn.tm

リンク

2010/12/30(Thu) 17:16:07|NO.36438

ご回答感謝します。

そのページを見てリンクにも行ったのですがそのページで何をすればいいのかわからなくて困ってしまいました。

いくらかダウンロードしたもののうちHSPのファイルを見つけたけれどエラーも出て何をすればいいのかわかりません。

何とかなりませんか?



inovia

リンク

2010/12/30(Thu) 19:40:36|NO.36440

確認したところ、
TSUKABUNさんの所はデータがなくなっており、
ベクターで配布されているものは、HSP2用でしたね。

最低限必要なものを書いておきました。
コレだけじゃ意味不明なので、サンプルは後で書きます。


#ifndef _mp3infp_ #define global _mp3infp_ #module __mp3infp__ #uselib "mp3infp.dll" #func global mp3infp_GetVer "mp3infp_GetVer" #func global mp3infp_ViewPropEx "mp3infp_ViewPropEx" sptr,sptr,sptr,sptr,sptr,sptr #func global mp3infp_ViewProp "mp3infp_ViewProp" sptr,sptr,sptr #func global mp3infp_Load "mp3infp_Load" sptr,sptr #func global mp3infp_GetType "mp3infp_GetType" #func global mp3infp_GetValue "mp3infp_GetValue" sptr,sptr #func global mp3infp_mp3_GetTagType "mp3infp_mp3_GetTagType" #func global mp3infp_SetConf "mp3infp_SetConf" sptr,sptr #func global mp3infp_SetValue "mp3infp_SetValue" sptr,sptr #func global mp3infp_Save "mp3infp_Save" sptr #func global mp3infp_mp3_MakeId3v1 "mp3infp_mp3_MakeId3v1" sptr #func global mp3infp_mp3_DelId3v1 "mp3infp_mp3_DelId3v1" sptr #func global mp3infp_mp3_MakeId3v2 "mp3infp_mp3_MakeId3v2" sptr #func global mp3infp_mp3_DelId3v2 "mp3infp_mp3_DelId3v2" sptr #func global mp3infp_mp3_MakeRMP "mp3infp_mp3_MakeRMP" sptr #func global mp3infp_mp3_DelRMP "mp3infp_mp3_DelRMP" sptr #func global mp3infp_mp3_MakeApeTag "mp3infp_mp3_MakeApeTag" sptr #func global mp3infp_mp3_DelApeTag "mp3infp_mp3_DelApeTag" sptr #const global MP3INFP_FILE_UNKNOWN 0x00 #const global MP3INFP_FILE_MP3 0x01 #const global MP3INFP_FILE_WAV 0x02 #const global MP3INFP_FILE_AVI 0x03 #const global MP3INFP_FILE_VQF 0x04 #const global MP3INFP_FILE_WMA 0x05 #const global MP3INFP_FILE_OGG 0x07 #const global MP3INFP_FILE_APE 0x08 #const global MP3INFP_FILE_MP4 0x09 #const global MP3INFP_HAS_MP3_ID3V1 0x00000001 #const global MP3INFP_HAS_MP3_ID3V2 0x00000002 #const global MP3INFP_HAS_MP3_RIFFSIF 0x00000004 #const global MP3INFP_HAS_MP3_ID3V1_0 0x00000008 #const global MP3INFP_HAS_MP3_ID3V1_1 0x00000010 #const global MP3INFP_HAS_MP3_ID3V2_2 0x00000020 #const global MP3INFP_HAS_MP3_ID3V2_3 0x00000040 #const global MP3INFP_HAS_MP3_ID3V2_4 0x00000080 #const global MP3INFP_HAS_MP3_APEV1 0x00000100 #const global MP3INFP_HAS_MP3_APEV2 0x00000200 #global #endif



ESZET

リンク

2010/12/30(Thu) 19:45:26|NO.36442

取得するだけなら標準命令だけでできます。バイナリデータはあまり詳しくありませんが(汗
テキトーに集めた情報でサンプル作ってみまつた。
	dialog "mp3", 16, "MP3ファイル"	
if stat == 0 : end path = refstr exist path sdim id3_data, 0x80 bload path, id3_data, , strsize-0x80 if wpeek (id3_data, 0) == 0x4154 { //ID3を見つけたら getstr id3_title, id3_data, 0x03 //タイトル取得 getstr id3_artist, id3_data, 0x21 //アーティスト取得 dialog "タイトル : " + id3_title + "\nアーティスト : " + id3_artist } else : dialog "ID3が見つかりません。" end
参考 http://pub.ne.jp/matsuk/?entry_id=1019865



inovia

リンク

2010/12/30(Thu) 20:54:35|NO.36443

ESZETさん のように自前で取得する方法もあります。

以前書いたスクリプトです。ID3のV1のみ対応しています。
http://homepage2.nifty.com/MJHS/hsp/mp3id3v1.hsp

http://hsp.tv/play/pforum.php?mode=pastwch&num=22153



inovia

リンク

2010/12/30(Thu) 22:18:54|NO.36444

No.36440のスクリプトは間違いがあるので無視してください。



// 開始 #ifndef _mp3infp_ #define global _mp3infp_ #uselib "mp3infp.dll" #func global mp3infp_GetVer "mp3infp_GetVer" #func global mp3infp_ViewPropEx "mp3infp_ViewPropEx" sptr,sptr,sptr,sptr,sptr,sptr #func global mp3infp_ViewProp "mp3infp_ViewProp" sptr,sptr,sptr #func global mp3infp_Load "mp3infp_Load" sptr,sptr #func global mp3infp_GetType "mp3infp_GetType" #func global mp3infp_GetValue "mp3infp_GetValue" sptr,sptr #func global mp3infp_mp3_GetTagType "mp3infp_mp3_GetTagType" #func global mp3infp_SetConf "mp3infp_SetConf" sptr,sptr #func global mp3infp_SetValue "mp3infp_SetValue" sptr,sptr #func global mp3infp_Save "mp3infp_Save" sptr #func global mp3infp_mp3_MakeId3v1 "mp3infp_mp3_MakeId3v1" sptr #func global mp3infp_mp3_DelId3v1 "mp3infp_mp3_DelId3v1" sptr #func global mp3infp_mp3_MakeId3v2 "mp3infp_mp3_MakeId3v2" sptr #func global mp3infp_mp3_DelId3v2 "mp3infp_mp3_DelId3v2" sptr #func global mp3infp_mp3_MakeRMP "mp3infp_mp3_MakeRMP" sptr #func global mp3infp_mp3_DelRMP "mp3infp_mp3_DelRMP" sptr #func global mp3infp_mp3_MakeApeTag "mp3infp_mp3_MakeApeTag" sptr #func global mp3infp_mp3_DelApeTag "mp3infp_mp3_DelApeTag" sptr #const global MP3INFP_FILE_UNKNOWN 0x00 #const global MP3INFP_FILE_MP3 0x01 #const global MP3INFP_FILE_WAV 0x02 #const global MP3INFP_FILE_AVI 0x03 #const global MP3INFP_FILE_VQF 0x04 #const global MP3INFP_FILE_WMA 0x05 #const global MP3INFP_FILE_OGG 0x07 #const global MP3INFP_FILE_APE 0x08 #const global MP3INFP_FILE_MP4 0x09 #const global MP3INFP_HAS_MP3_ID3V1 0x00000001 #const global MP3INFP_HAS_MP3_ID3V2 0x00000002 #const global MP3INFP_HAS_MP3_RIFFSIF 0x00000004 #const global MP3INFP_HAS_MP3_ID3V1_0 0x00000008 #const global MP3INFP_HAS_MP3_ID3V1_1 0x00000010 #const global MP3INFP_HAS_MP3_ID3V2_2 0x00000020 #const global MP3INFP_HAS_MP3_ID3V2_3 0x00000040 #const global MP3INFP_HAS_MP3_ID3V2_4 0x00000080 #const global MP3INFP_HAS_MP3_APEV1 0x00000100 #const global MP3INFP_HAS_MP3_APEV2 0x00000200 #endif // 終了 // サンプル開始 /* 参考 http://cult-drang.com/program/lib/use_mp3infp.pas */ dialog "mp3",16,"MPEG Layer-3" if stat = 0 : end fname = refstr // ファイルのロード mp3infp_Load hwnd , fname // タグ種類の決定 type = "" mp3infp_mp3_GetTagType repeat 1 if stat&2 : type = "v2" : break if stat&1 : type = "v1" : break if stat&4 : type = "rmp" : break loop // 各種タグ情報の読み込み /* 変数初期化(全部文字列型で) */ sdim tag_format : sdim tag_time : sdim tag_title : sdim tag_artist sdim tag_album : sdim tag_comment : sdim tag_createday sdim tag_genre : sdim tag_copyright : sdim tag_software sdim tag_create : sdim tag_orgart : sdim tag_url : sdim tag_enc sdim tag_src : sdim tag_eng : sdim tag_track /* 共通 */ ; フォーマット mp3infp_GetValue "AFMT" , varptr(p) dupptr tmp,p,128,2 : tag_format = tmp ; 演奏時間 mp3infp_GetValue "TIME" , varptr(p) dupptr tmp,p,128,2 : tag_time = tmp /* ID3v1/v2/RiffSIF */ if type = "v1" | type = "v2" | type = "rmp"{ ; タイトル mp3infp_GetValue "INAM_"+type , varptr(p) dupptr tmp,p,128,2 : tag_title = tmp ; アーティスト mp3infp_GetValue "IART_"+type , varptr(p) dupptr tmp,p,128,2 : tag_artist = tmp ; アルバム mp3infp_GetValue "IPRD_"+type , varptr(p) dupptr tmp,p,128,2 : tag_album = tmp ; コメント mp3infp_GetValue "ICMT_"+type , varptr(p) dupptr tmp,p,128,2 : tag_comment = tmp ; 作成日 mp3infp_GetValue "ICRD_"+type , varptr(p) dupptr tmp,p,128,2 : tag_createday = tmp ; ジャンル mp3infp_GetValue "IGNR_"+type , varptr(p) dupptr tmp,p,128,2 : tag_genre = tmp } /* ID3v2/RiffSIF */ if type = "v2" | type = "rmp" { ; 著作権 mp3infp_GetValue "ICOP_"+type , varptr(p) dupptr tmp,p,128,2 : tag_copyright = tmp ; ソフトウェア/エンコーダ mp3infp_GetValue "ISFT_"+type , varptr(p) dupptr tmp,p,128,2 : tag_software = tmp } /* ID3v2 */ if type = "v2" { ; 作曲 mp3infp_GetValue "COMP_v2" , varptr(p) dupptr tmp,p,128,2 : tag_create = tmp ; Orig.アーティスト mp3infp_GetValue "OART_v2" , varptr(p) dupptr tmp,p,128,2 : tag_orgart = tmp ; URL mp3infp_GetValue "URL_v2" , varptr(p) dupptr tmp,p,128,2 : tag_url = tmp ; エンコードした人 mp3infp_GetValue "ENC2_v2" , varptr(p) dupptr tmp,p,128,2 : tag_enc = tmp } /* RIFFSIF */ if type = "rmp" { ; ソース mp3infp_GetValue "ISRC_rmp" , varptr(p) dupptr tmp,p,128,2 : tag_src = tmp ; エンジニア mp3infp_GetValue "IENG_rmp" , varptr(p) dupptr tmp,p,128,2 : tag_eng = tmp } /* ID3v1/v2 */ if type = "v1" | type = "v2" { ; トラック mp3infp_GetValue "TRACK_"+type , varptr(p) dupptr tmp,p,128,2 : tag_track = tmp } // 表示する if type = "" { mes "タグ情報がありません" }else{ mes "タグ の バージョン = "+type } if tag_format!="" : mes "フォーマット\t: "+tag_format if tag_time!="" : mes "演奏時間\t: "+tag_time if tag_title!="" : mes "タイトル\t: "+tag_title if tag_artist!="" : mes "アーティスト\t: "+tag_artist if tag_album!="" : mes "アルバム\t: "+tag_album if tag_comment!="" : mes "コメント\t: "+tag_comment if tag_createday!="": mes "作成日\t\t: "+tag_createday if tag_genre!="" : mes "ジャンル\t: "+tag_genre if tag_copyright!="": mes "著作権\t\t: "+tag_copyright if tag_software !="": mes "ソフトウェア\t: "+tag_software if tag_orgart!="" : mes "Org.アーティスト: "+tag_orgart if tag_url!="" : mes "URL\t\t: "+tag_url if tag_enc!="" : mes "エンコーダ\t: "+tag_enc if tag_src!="" : mes "ソース\t\t: "+tag_src if tag_eng!="" : mes "エンジニア\t: "+tag_eng if tag_track!="" : mes "トラック\t: "+tag_track // サンプル終了



kn.tm

リンク

2011/1/1(Sat) 11:25:49|NO.36472

どうもご丁寧にありがとうございました。

返事が遅れてすみません。年内に終わらせようと思ったけれどできませんでした。

ご協力感謝します。



ONION software Copyright 1997-2023(c) All rights reserved.