当前位置: 首页>>代码示例>>C++>>正文


C++ AudioPlayer::GetLength方法代码示例

本文整理汇总了C++中AudioPlayer::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioPlayer::GetLength方法的具体用法?C++ AudioPlayer::GetLength怎么用?C++ AudioPlayer::GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AudioPlayer的用法示例。


在下文中一共展示了AudioPlayer::GetLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NotificationProc

void AudioPlayer::NotificationProc(PVOID dwUser)
{
    AudioPlayer* pThis = (AudioPlayer*)dwUser;

    IMediaEvent* pEvent = NULL;
    HANDLE hEvents[2];//hEvents[0] == The Exit event.  hEvents[1] means there is a media event.
    HRESULT hr;
    DWORD dwResult;
    long lEvent;
    long lParam1;
    long lParam2;

    if(FAILED(hr = pThis->pControl->QueryInterface(IID_IMediaEvent, (PVOID*)&pEvent)))
    {
        odsf(L"AudioPlayer::NotificationProc", L"Could not obtain an IMediaEvent object");
        return;
    }

    if(FAILED(hr = pEvent->GetEventHandle((OAEVENT*)&hEvents[1])))
    {
        odsf(L"AudioPlayer::NotificationProc", L"Could not get event handle");
        return;
    }

    hEvents[0] = pThis->hExitEvent;

    while(1)
    {
        dwResult = WaitForMultipleObjects(2, hEvents, FALSE, INFINITE) - WAIT_OBJECT_0;

        switch(dwResult)
        {
        case 0:
            {
                // We are supposed to exit.
                SAFE_RELEASE(pEvent);
                return;
            }
        case 1:
            {
                // We have events in the queue.  Let's handle them.
                if(FAILED(hr = pEvent->GetEvent(&lEvent, &lParam1, &lParam2, 0)))
                {
                    odsf(L"AudioPlayer::NotificationProc", L"Could not get event data");
                    break;
                }

                // Handle the event.
                switch(lEvent)
                {
                    //case EC_SYSTEMBASE: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_SYSTEMBASE"); break;}
                    //case EC_USER: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_USER"); break;}
                    case EC_COMPLETE:
                        {
                            pThis->bPlaying = TRUE;
                            pThis->bUseLastPosition = TRUE;
                            pThis->GetLength(&pThis->dwLastPosition, 0);
                            //odsf(L"AudioPlayer::NotificationProc", L"Event: EC_COMPLETE");
                            pThis->_SendMessage(CCM_COMPLETE);
                            break;
                        }
/*                    case EC_USERABORT: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_USERABORT"); break;}
                    case EC_ERRORABORT: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_ERRORABORT"); break;}
                    case EC_TIME: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_TIME"); break;}
                    case EC_REPAINT: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_REPAINT"); break;}
                    case EC_STREAM_ERROR_STOPPED: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_STREAM_ERROR_STOPPED"); break;}
                    case EC_STREAM_ERROR_STILLPLAYING: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_STREAM_ERROR_STILLPLAYING"); break;}
                    case EC_ERROR_STILLPLAYING: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_ERROR_STILLPLAYING"); break;}
                    case EC_PALETTE_CHANGED: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_PALETTE_CHANGED"); break;}
                    case EC_VIDEO_SIZE_CHANGED: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_VIDEO_SIZE_CHANGED"); break;}
                    case EC_QUALITY_CHANGE: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_QUALITY_CHANGE"); break;}
                    case EC_SHUTTING_DOWN: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_SHUTTING_DOWN"); break;}
                    case EC_CLOCK_CHANGED: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_CLOCK_CHANGED"); break;}
                    //case EC_PAUSED: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_PAUSED"); break;}
                    case EC_OPENING_FILE	: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_OPENING_FILE	"); break;}
                    //case EC_BUFFERING_DATA: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_BUFFERING_DATA"); break;}
                    case EC_FULLSCREEN_LOST: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_FULLSCREEN_LOST"); break;}
                    case EC_ACTIVATE: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_ACTIVATE"); break;}
                    case EC_NEED_RESTART: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_NEED_RESTART"); break;}
                    case EC_WINDOW_DESTROYED: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_WINDOW_DESTROYED"); break;}
                    case EC_DISPLAY_CHANGED: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_DISPLAY_CHANGED"); break;}
                    case EC_STARVATION: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_STARVATION"); break;}
                    case EC_OLE_EVENT			: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_OLE_EVENT"); break;}
                    case EC_NOTIFY_WINDOW: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_NOTIFY_WINDOW"); break;}
                    case EC_STREAM_CONTROL_STOPPED	: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_STREAM_CONTROL_STOPPED"); break;}
                    case EC_STREAM_CONTROL_STARTED	: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_STREAM_CONTROL_STARTED"); break;}
                    case EC_END_OF_SEGMENT: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_END_OF_SEGMENT"); break;}
                    case EC_SEGMENT_STARTED: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_SEGMENT_STARTED"); break;}
                    case EC_LENGTH_CHANGED: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_LENGTH_CHANGED"); break;}
                    case EC_TIMECODE_AVAILABLE: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_TIMECODE_AVAILABLE"); break;}
                    case EC_EXTDEVICE_MODE_CHANGE: { odsf(L"AudioPlayer::NotificationProc", L"Event: EC_EXTDEVICE_MODE_CHANGE"); break;}
*/
                }

                break;
            }
        }// switch(dwResult)
    }// while(1)

    return;
//.........这里部分代码省略.........
开发者ID:thenfour,项目名称:LoveLine,代码行数:101,代码来源:AudioPlayer.cpp


注:本文中的AudioPlayer::GetLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。