ZFFramework
Loading...
Searching...
No Matches
ZFAudioCache.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFAudioCache_h_
7#define _ZFI_ZFAudioCache_h_
8
9#include "ZFAudio.h"
11
16 , ZFMP_IN(const ZFPathInfo &, pathInfo)
17 )
22 , ZFMP_IN(const ZFInput &, src)
23 )
24
29 , ZFMP_IN(const ZFPathInfo &, pathInfo)
30 , ZFMP_IN_OPT(const ZFListener &, callback, zfnull)
31 )
36 , ZFMP_IN(const ZFInput &, src)
37 , ZFMP_IN_OPT(const ZFListener &, callback, zfnull)
38 )
39
40// ============================================================
44zfclass ZFLIB_ZFUIKit ZFAudioStartTask : zfextend ZFTask {
45 ZFOBJECT_DECLARE(ZFAudioStartTask, ZFTask)
46
47public:
50 , ZFMP_IN(ZFAudio *, impl)
51 )
54 , ZFMP_IN(const ZFPathInfo &, pathInfo)
55 )
58 , ZFMP_IN(const ZFInput &, input)
59 )
60
63
64protected:
66 virtual void objectOnInit(void) {
68 }
70 virtual void objectOnInit(
71 ZF_IN const ZFListener &implOnStart
72 , ZF_IN_OPT const ZFListener &implOnStop = zfnull
73 ) {
74 zfsuper::objectOnInit(implOnStart, implOnStop);
75 }
76
78 ZFMP_IN(ZFAudio *, impl)
79 )
82 ZFMP_IN(const ZFPathInfo &, pathInfo)
83 )
86 ZFMP_IN(const ZFInput &, input)
87 )
88
89protected:
91 virtual void taskOnStart(void);
93 virtual void taskOnStop(void);
94private:
95 zfautoT<ZFAudio> _impl;
96 zfobj<ZFObject> _holder;
97};
98
99// ============================================================
103zfclass ZFLIB_ZFUIKit ZFAudioCache : zfextend ZFCache {
104 ZFOBJECT_DECLARE(ZFAudioCache, ZFCache)
106};
107
109#endif // #ifndef _ZFI_ZFAudioCache_h_
110
audio player
zfautoT< ZFAudio > ZFAudioStart(const ZFPathInfo &pathInfo, const ZFListener &callback=(zft_zfnull))
play audio with cache logic, auto stop prev audio task with same src
zfautoT< ZFAudio > ZFAudioLoad(const ZFPathInfo &pathInfo)
access audio with cache logic
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:196
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:200
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue)
see ZFMP_IN
Definition ZFMethod.h:108
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_DECLARE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:853
#define ZFMETHOD_FUNC_DECLARE_2(ZFLIB_, ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:763
#define ZFMETHOD_FUNC_DECLARE_1(ZFLIB_, ReturnType, MethodName, ZFMP_0)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:624
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_ON_INIT_DECLARE_1(ZFMP_0)
see ZFOBJECT_ON_INIT_INLINE_1
Definition ZFObjectDeclare.h:259
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:122
#define ZFOBJECT_SINGLETON_DECLARE(AccessTypeName, accessMethodName)
util macro to declare a singleton instance access for ZFObject type
Definition ZFObjectGlobalInstance.h:243
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:120
#define ZFLIB_ZFUIKit
used to export symbols
Definition ZFUIKitDef.h:16
static ZFAudioCache * instance()
audio player
Definition ZFAudio.h:25
virtual void taskOnStart(void)
called to start task
virtual void objectOnInit(const ZFListener &implOnStart, const ZFListener &implOnStop=zft_zfnull)
util constructor to attach custom impl to E_TaskOnStart and E_TaskOnStop
Definition ZFAudioCache.h:70
virtual void objectOnInit(void)
override this to init your object
Definition ZFAudioCache.h:66
virtual void load(ZFAudio *impl)
load by impl
virtual void taskOnStop(void)
called to stop task
virtual zfindex & loop()
see ZFAudio::loop
Definition ZFAudioCache.h:62
general input callback
Definition ZFIOCallback_input.h:36
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
path related info storage for impl, actual meaning of the info depends on impl
Definition ZFPathInfo.h:34
virtual void objectOnInit(const ZFListener &implOnStart, const ZFListener &implOnStop=(zft_zfnull))
util constructor to attach custom impl to E_TaskOnStart and E_TaskOnStop
type restrict version of zfauto
Definition zfautoFwd.h:108
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:72