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


C++ SoundPlayer::Ready方法代码示例

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


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

示例1: meterType

OSDComponent *SkinV2::VolumeOSD() {
    OSDComponent *volume = new OSDComponent;

    /* Images */
    volume->background = LoadImg(_skinDir + L"\\OSD\\back.png");
    volume->mask = LoadImg(_skinDir + L"\\OSD\\glassMask.png");

    /* Sound */
    std::wstring soundName = _skinDir + L"\\sound.wav";
    SoundPlayer *player = new SoundPlayer(soundName);
    if (player->Ready() == false) {
        delete player;
        player = NULL;
    }
    volume->sound = player;

    /* Determine the number of units */
    int units = 10;
    tinyxml2::XMLElement *meterMax = SubElement("osd", "meterMax");
    if (meterMax) {
        meterMax->QueryIntText(&units);
    }
    volume->defaultUnits = units;

    /* Load the meter(s) */
    const char *type = nullptr;
    tinyxml2::XMLElement *meterOrientation
        = SubElement("osd", "meterOrientation");
    if (meterOrientation) {
        type = meterOrientation->GetText();
    }
    int x = 0;
    int y = 0;
    tinyxml2::XMLElement *pos = SubElement("osd", "meterPosition");
    if (pos) {
        tinyxml2::XMLElement *xelem = pos->FirstChildElement("X");
        tinyxml2::XMLElement *yelem = pos->FirstChildElement("Y");
        if (xelem) {
            xelem->QueryIntText(&x);
        }
        if (yelem) {
            yelem->QueryIntText(&y);
        }
    }

    std::wstring meterImg = _skinDir + L"\\OSD\\meter.png";
    std::string meterType(type);
    if (meterType == "vertical") {
        volume->meters.push_back(
            new VerticalBar(meterImg, x, y, units));
    } else if (meterType == "bitstrip") {
        /* For some reason, the number of units in v2 for bit strips was
         * (meterMax + 1), so we update the number of units here. */
        volume->meters.push_back(
            new Bitstrip(meterImg, x, y, units + 1));
    } else {
        /* Horizontal meter is the default */
        volume->meters.push_back(
            new HorizontalBar(meterImg, x, y, units));
    }

    tinyxml2::XMLElement *drawText = SubElement("osd", "drawPercentage");
    if (drawText) {
        bool textEnabled = false;
        drawText->QueryBoolText(&textEnabled);
        if (textEnabled) {
            Text *t = CreateText(volume->background);
            if (t) {
                volume->meters.push_back(t);
            }
        }
    }

    return volume;
}
开发者ID:pipetko,项目名称:3RVX,代码行数:75,代码来源:SkinV2.cpp


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