Q&A

  • 가사 동기화에 관한 질문이에여~
저희는 노래방 프로그램을 만들고 있습니다~~

노래방가면 가사가 노래에 맞게 나오잖아여~

노래에 맞는 가사가 나오게 할려면... 가사를 동기화해야한다고 하는데..

동기화라는 말을 처음 들어서 어떻게 해야할지 모르겠거든여~

동기화하는 방법을 알고계신분 없나요?

1  COMMENTS
  • Profile
    박상윤 2001.10.05 20:40
    Sami paser라는 놈이있지여...

    음 사사미 아니져 자막까지 플레이 해주는 넘이여..

    이것을 이용해서 만든것이죠...

    쉽게 이야기 하지면 Text 로 가사와 플레될시간등...

    써놓으면...Sami paser 놈이 시간을 맞추어서

    플레이를 시키죠....



    그냥 구현하시렴면.. 가사,플레이될 시간등을 규칙적으로 배열하신후

    이를 타이머루 시간이 되면 읽어 화면 Display 하심 될것 같은데...



    MSDN에 이렇게 써있네여..

    html 같기두 하구 xml 같기두 하지여...

    그럼 즐프하세여





    SAMI (CC) Parser Filter

    Parses captioning data from Synchronized Accessible Media Interchange (SAMI) files.



    SAMI is a text format similar to HTML, and is used for encoding time-based captions. This filter converts SAMI data into a text stream. Each sample in the stream contains one caption entry, along with format information. The time stamps on the samples are generated from the time information in the SAMI file.



    This filter is designed to be used with the Internal Script Command Renderer filter. The Internal Script Command Renderer receives the text samples and sends them to the application, in the form of event notifications. For more information, see the Remarks section.



    Filter Interfaces IAMStreamSelect, IBaseFilter

    Input Pin Media Types MEDIATYPE_Stream

    Input Pin Interfaces IPin, IQualityControl

    Output Pin Media Types MEDIATYPE_Text, MEDIASUBTYPE_NULL

    Output Pin Interfaces IMediaSeeking, IPin, IQualityControl

    Filter CLSID {33FACFE0-A9BE-11D0-A520-00A0D10129C0}

    Property Page CLSID No property page

    Executable quartz.dll

    Merit MERIT_UNLIKELY

    Category CLSID_LegacyAmFilterCategory





    Remarks



    The following is a simple SAMI file:















    One

    Un





    Two

    Deux





    Three

    Trois





    The STYLE tag defines two language settings, English (.ENCC) and French (.FRCC). It also defines two styles, #NORMAL and #GREENTEXT. Each SYNC tag defines the start time for a caption, in milliseconds. The P tags contain the caption text, while the CLASS attribute specifies the language setting to which the caption applies.



    For each language and style, the filter creates a logical stream. At any time, exactly one language stream and one style stream are enabled. When the filter generates a sample, it selects the caption for the current language and applies the current style. By default, the first language and style declared in the file are enabled. An application can use the IAMStreamSelect::Enable method to enable a different stream.



    With the default settings, the first caption in the example file produces the following output:



    One

    If the output goes to the Internal Script Command Renderer, that filter sends an EC_OLE_EVENT event notification. The second event parameter is a BSTR with the caption text. The application can retrieve the event and display the caption.



    The following example shows how to render a SAMI file, retrieve stream information, enable streams, and display caption text. The example assumes that the previous SAMI file is saved as C:Sami_test_file.sami. For brevity, the example used hard-coded stream indexes when it calls the IAMStreamSelect::Enable method:



    void __cdecl main()

    {

    HRESULT hr;

    IGraphBuilder *pGraph;

    IMediaControl *pMediaControl;

    IMediaEventEx *pEv;

    IBaseFilter *pSAMI;



    CoInitialize(NULL);



    // Create the filter graph manager.

    CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,

    IID_IGraphBuilder, (void **)&pGraph);

    pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);

    pGraph->QueryInterface(IID_IMediaEventEx, (void**)&pEv);



    // Create the graph and find the SAMI parser.

    pGraph->RenderFile(L"C:Sami_test_file.sami", NULL);

    hr = pGraph->FindFilterByName(L"SAMI (CC) Parser", &pSAMI);

    if (SUCCEEDED(hr))

    {

    IAMStreamSelect *pStrm = NULL;

    hr = pSAMI->QueryInterface(IID_IAMStreamSelect, (void**)&pStrm);

    if (SUCCEEDED(hr))

    {

    DWORD dwStreams = 0;

    pStrm->Count(&dwStreams);

    printf("Stream count: %dn", dwStreams);



    // Select French and "GreenText"

    hr = pStrm->Enable(1, AMSTREAMSELECTENABLE_ENABLE);

    hr = pStrm->Enable(3, AMSTREAMSELECTENABLE_ENABLE);



    // Print the name of each logical stream.

    for (DWORD index = 0; index < dwStreams; index++)

    {

    DWORD dwFlags;

    WCHAR *wszName;

    hr = pStrm->Info(index, NULL, &dwFlags, NULL, NULL, &wszName, NULL, NULL);

    wprintf(L"Stream %d: %s [%s]n", index, wszName,

    (dwFlags ? L"ENABLED" : L"DISABLED"));

    CoTaskMemFree(wszName);

    }

    pStrm->Release();

    }

    pSAMI->Release();

    }



    // Run the graph and display the captions.

    pMediaControl->Run();

    while (1)

    {

    long evCode, lParam1, lParam2;

    pEv->GetEvent(&evCode, &lParam1, &lParam2, 100);



    if (evCode == EC_OLE_EVENT) {

    wprintf(L"%sn", (BSTR)lParam2);

    }

    pEv->FreeEventParams(evCode, lParam1, lParam2);



    if (evCode == EC_USERABORT || evCode == EC_COMPLETE || evCode == EC_ERRORABORT)

    break;

    }



    // Clean up.

    pMediaControl->Release();

    pEv->Release();

    pGraph->Release();

    CoUninitialize();

    }