• Cocos2d-x3.3RC0 Cpp-test分析之NewAudioEngineDemo(转:http://blog.csdn.net/yuxikuo_1/article/details/41081453)


    #ifndef __NewAudioEngineDemo__NewAudioEngineDemo__
    #define __NewAudioEngineDemo__NewAudioEngineDemo__

    #include "cocos2d.h"
    #include "ui/CocosGUI.h"
    #include "VisibleRect.h"
    #include "audio/include/AudioEngine.h"

    USING_NS_CC;
    using namespace ui;

    class NewAudioEngineDemo : public Scene
    {
    public:
    CREATE_FUNC(NewAudioEngineDemo);
    virtual bool init();
    };

    class BaseTest : public Layer
    {
    public:
    CREATE_FUNC(BaseTest);
    virtual bool init();
    virtual std::string title() const;//主标题
    virtual std::string subtitle() const;//副标题
    virtual void onExit() override;

    virtual void restartCallback(Ref* sender);//重新执行当前test
    virtual void nextCallback(Ref* sender);//下一个test
    virtual void backCallback(Ref* sender);//上一个test

    void menuCloseCallback(cocos2d::Ref* pSender);//关闭菜单回调函数
    };

    class AudioControlTest : public BaseTest
    {
    public:
    CREATE_FUNC(AudioControlTest);
    virtual ~AudioControlTest();
    virtual bool init();
    virtual void update(float dt);
    virtual std::string subtitle() const override;
    private:
    int _audioID;
    bool _loopEnabled;
    float _volume;
    float _duration;
    float _timeRatio;

    void* _playItem;
    void* _timeSlider;
    bool _updateTimeSlider;

    };

    class PlaySimultaneouslyTest : public BaseTest
    {
    public:
    CREATE_FUNC(PlaySimultaneouslyTest);
    virtual ~PlaySimultaneouslyTest();
    virtual bool init();
    virtual std::string subtitle() const override;
    private:
    static const int TEST_COUNT = 10;
    std::string _files[TEST_COUNT];
    void* _playItem;
    int _playingcount;
    };

    class AudioProfileTest : public BaseTest
    {
    public:
    CREATE_FUNC(AudioProfileTest);
    virtual bool init();
    virtual ~AudioProfileTest();
    virtual std::string subtitle() const override;
    virtual void update(float dt);
    private:
    static const int FILE_COUNT = 2;
    std::string _files[FILE_COUNT];
    cocos2d::experimental::AudioProfile _audioProfile;
    int _audioCount;
    Label* _showLabel;
    float _time;
    float _minDelay;
    void* _timeSlider;
    };
    class InvalidAudioFileTest : public BaseTest
    {
    public:
    CREATE_FUNC(InvalidAudioFileTest);
    virtual bool init();
    virtual ~InvalidAudioFileTest();
    virtual std::string subtitle() const override;
    };
    class LargeAudioFileTest : public BaseTest
    {
    public:
    CREATE_FUNC(LargeAudioFileTest);
    virtual bool init();
    virtual ~LargeAudioFileTest();
    virtual std::string subtitle() const override;
    };
    #endif /* defined(__NewAudioEngineDemo__NewAudioEngineDemo__) */

  • 相关阅读:
    Storm-源码分析-Stats (backtype.storm.stats)
    Storm-源码分析-Topology Submit-Task-TopologyContext (backtype.storm.task)
    Storm-源码分析-Streaming Grouping (backtype.storm.daemon.executor)
    Storm-源码分析-Topology Submit-Worker
    Storm-源码分析- Messaging (backtype.storm.messaging)
    Storm-源码分析-LocalState (backtype.storm.utils)
    Storm-源码分析- Disruptor在storm中的使用
    LMAX Disruptor 原理
    Shiro学习(7)与Web整合
    MQTT---HiveMQ源代码具体解释(十四)Persistence-LocalPersistence
  • 原文地址:https://www.cnblogs.com/hackerl/p/4759560.html
Copyright © 2020-2023  润新知