TSongItem 類別 參考文件

#include <SongItem.h>

全部成員列表

公開方法(Public Methods)

 TSongItem ()
 ~TSongItem ()
void SetProperty (char *)
 功能:設定並讀取stat和noteSize等資訊
bool Read (TInputStream *, int)
 從index檔讀取欄位,TSongDbLoad會呼叫此函式
void Write (TOutputStream *, TOutputStream *)
 將這首歌寫進index和db檔,TSongDbSave會呼叫此函式
void NoteToMid (int, int)
 將note轉換成中介格式
void FreeMid (void)
 將中介格式釋放掉,為了節省記憶體
void FreeRefrain (void)
 將複歌索引釋放掉
void Ready (int)
 當note遭修改時,必須呼叫此函式,否則無法哼唱搜尋

公開屬性

TMyStringListFields
 index檔中所有的文字欄位
int start
 在db檔中的開始位置
unsigned char * note
 從db檔中讀進來的資料
int noteSize
 在db檔中的資料長度
int * mid
 從note轉換過來的中介格式
int midSize
 中介格式的長度
float score
 分數
int * noteIndex
 每個音符起點在mid中的索引
int noteIndexSize
 noteIndex陣列長度
int bestSegment
 第一階段比對後,記下最有可能是使用者唱的片段,用來做第二階段的比對
int * refrainIndex
 複歌起點在note中的索引
int refrainIndexSize
 複歌起點的個數
int * midRefrainIndex
 複歌起點在mid中的索引


詳細描述

TSongItem代表的是一首資料庫中的歌,其欄位包括所有在index檔中的資料,還有db檔中的資料。 《注意》目前對於複歌的處理還不夠完整,例如複製和寫入時並沒有考慮到複歌的部份

定義在 SongItem.h 檔案之第 15 行.


建構子與解構子說明文件

TSongItem::TSongItem (  ) 

定義在 SongItem.cpp 檔案之第 14 行.

參考 Fields, mid, midRefrainIndex, midSize, note, noteIndex, noteIndexSize, noteSize, refrainIndex, refrainIndexSize, score, 及 start.

TSongItem::~TSongItem (  ) 

定義在 SongItem.cpp 檔案之第 30 行.

參考 Fields, FreeMid(), FreeRefrain(), 及 note.


函式成員說明文件

void TSongItem::FreeMid ( void   ) 

將中介格式釋放掉,為了節省記憶體

定義在 SongItem.cpp 檔案之第 246 行.

參考 mid, 及 noteIndex.

被參考於 TSongDb::Compare(), 及 ~TSongItem().

void TSongItem::FreeRefrain ( void   ) 

將複歌索引釋放掉

定義在 SongItem.cpp 檔案之第 260 行.

參考 midRefrainIndex, refrainIndex, 及 refrainIndexSize.

被參考於 ~TSongItem().

void TSongItem::NoteToMid ( int  resampleRate,
int  scale 
)

將note轉換成中介格式

note中的時間單位是1/64秒,轉換後的單位是resampleRate/64秒 resampleRate目前設為4,所以是1/16秒

參數:
resampleRate 目前設為4
scale 放大倍率,目前scale=INTEGER_SCALE=10,因為用整數代替浮點數而乘上的倍數

定義在 SongItem.cpp 檔案之第 202 行.

參考 mid, midSize, note, noteIndex, 及 noteIndexSize.

被參考於 TSongDb::Compare().

bool TSongItem::Read ( TInputStream DbStream,
int  resampleRate 
)

從index檔讀取欄位,TSongDbLoad會呼叫此函式

從db檔中讀取資料,放進note欄位 note中的時間單位是1/64秒,轉換後的單位是resampleRate/64秒 resampleRate目前設為4,所以是1/16秒,以[音高音長音高音長...]排列, 一首歌完結後寫入0xFF

參數:
DbStream 為db檔
resampleRate 目前設為4
傳回值:
傳回是否成功

定義在 SongItem.cpp 檔案之第 129 行.

參考 note, noteSize, TInputStream::Read(), TInputStream::Reads(), Ready(), TInputStream::Reset(), TInputStream::Skip(), 及 start.

被參考於 TSongDb::Read().

void TSongItem::Ready ( int   ) 

當note遭修改時,必須呼叫此函式,否則無法哼唱搜尋

定義在 SongItem.cpp 檔案之第 275 行.

參考 midRefrainIndex, midSize, note, noteIndexSize, noteSize, refrainIndex, refrainIndexSize, 及 SEGMENT_SIZE.

被參考於 Read().

void TSongItem::SetProperty ( char *  line  ) 

功能:設定並讀取stat和noteSize等資訊

對txt檔案裡的每一行做處理,一行即為一首歌的各個資訊,如: midiName=天涯.mid songName=天涯 singer=任賢齊 language=Chinese start=0 size=424 每個欄位之間用tab做分隔

參數:
line line為index檔中的一行字串

定義在 SongItem.cpp 檔案之第 52 行.

參考 TMyStringList::Add(), Fields, noteSize, refrainIndex, refrainIndexSize, 及 start.

被參考於 TSongDb::Read().

void TSongItem::Write ( TOutputStream IndexStream,
TOutputStream DbStream 
)

將這首歌寫進index和db檔,TSongDbSave會呼叫此函式

將一首歌寫進index和db檔

參數:
IndexStream 為index檔
DbStream 為db檔

定義在 SongItem.cpp 檔案之第 158 行.

參考 TMyList::count, Fields, note, noteSize, refrainIndex, refrainIndexSize, TOutputStream::Size(), start, TMyStringList::Strings(), TOutputStream::Write(), 及 TOutputStream::Writes().


資料成員說明文件

int TSongItem::bestSegment

第一階段比對後,記下最有可能是使用者唱的片段,用來做第二階段的比對

定義在 SongItem.h 檔案之第 27 行.

被參考於 TSongDb::Compare().

TMyStringList* TSongItem::Fields

index檔中所有的文字欄位

定義在 SongItem.h 檔案之第 18 行.

被參考於 TSongDb::Compare(), main(), SetProperty(), TSongItem(), Write(), 及 ~TSongItem().

int* TSongItem::mid

從note轉換過來的中介格式

定義在 SongItem.h 檔案之第 22 行.

被參考於 TSongDb::Compare(), FreeMid(), NoteToMid(), 及 TSongItem().

int* TSongItem::midRefrainIndex

複歌起點在mid中的索引

定義在 SongItem.h 檔案之第 30 行.

被參考於 TSongDb::Compare(), FreeRefrain(), Ready(), 及 TSongItem().

int TSongItem::midSize

中介格式的長度

定義在 SongItem.h 檔案之第 23 行.

被參考於 TSongDb::Compare(), NoteToMid(), Ready(), 及 TSongItem().

unsigned char* TSongItem::note

從db檔中讀進來的資料

定義在 SongItem.h 檔案之第 20 行.

被參考於 NoteToMid(), Read(), Ready(), TSongItem(), Write(), 及 ~TSongItem().

int* TSongItem::noteIndex

每個音符起點在mid中的索引

定義在 SongItem.h 檔案之第 25 行.

被參考於 TSongDb::Compare(), FreeMid(), NoteToMid(), 及 TSongItem().

int TSongItem::noteIndexSize

noteIndex陣列長度

定義在 SongItem.h 檔案之第 26 行.

被參考於 TSongDb::Compare(), NoteToMid(), Ready(), 及 TSongItem().

int TSongItem::noteSize

在db檔中的資料長度

定義在 SongItem.h 檔案之第 21 行.

被參考於 Read(), Ready(), SetProperty(), TSongItem(), 及 Write().

int* TSongItem::refrainIndex

複歌起點在note中的索引

定義在 SongItem.h 檔案之第 28 行.

被參考於 FreeRefrain(), Ready(), SetProperty(), TSongItem(), 及 Write().

int TSongItem::refrainIndexSize

複歌起點的個數

定義在 SongItem.h 檔案之第 29 行.

被參考於 TSongDb::Compare(), FreeRefrain(), Ready(), SetProperty(), TSongItem(), 及 Write().

float TSongItem::score

分數

定義在 SongItem.h 檔案之第 24 行.

被參考於 TSongDb::Compare(), main(), 及 TSongItem().

int TSongItem::start

在db檔中的開始位置

定義在 SongItem.h 檔案之第 19 行.

被參考於 Read(), SetProperty(), TSongItem(), 及 Write().


此類別(class) 文件是由下列檔案中產生:
產生日期:Tue Jul 11 11:52:19 2006, 專案:cbmr, 產生器:  doxygen 1.4.7