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 }
69
71 ZFMP_IN(ZFAudio *, impl)
72 )
75 ZFMP_IN(const ZFPathInfo &, pathInfo)
76 )
79 ZFMP_IN(const ZFInput &, input)
80 )
81
82protected:
84 virtual void taskOnStart(void);
86 virtual void taskOnStop(void);
87private:
88 zfautoT<ZFAudio> _impl;
89 zfobj<ZFObject> _holder;
90};
91
92// ============================================================
96zfclass ZFLIB_ZFUIKit ZFAudioCache : zfextend ZFCache {
97 ZFOBJECT_DECLARE(ZFAudioCache, ZFCache)
99};
100
102#endif // #ifndef _ZFI_ZFAudioCache_h_
103
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
_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:854
#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:263
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:126
#define ZFOBJECT_SINGLETON_DECLARE(AccessTypeName, accessMethodName)
util macro to declare a singleton instance access for ZFObject type
Definition ZFObjectGlobalInstance.h:256
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:128
#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(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:113
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:79