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 ZFInput &, src)
17 , ZFMP_IN_OPT(const ZFListener &, callback, zfnull)
18 )
23 , ZFMP_IN(const zfstring &, url)
24 , ZFMP_IN_OPT(const ZFListener &, callback, zfnull)
25 )
26
27// ============================================================
31zfclass ZFLIB_ZFUIKit ZFAudioPlayTask : zfextend ZFTask {
32 ZFOBJECT_DECLARE(ZFAudioPlayTask, ZFTask)
33
34public:
37 , ZFMP_IN(ZFAudio *, impl)
38 )
41 , ZFMP_IN(const ZFInput &, input)
42 )
45 , ZFMP_IN(const zfstring &, url)
46 )
47
50
51protected:
53 virtual void objectOnInit(void) {
55 }
56
58 ZFMP_IN(ZFAudio *, impl)
59 )
62 ZFMP_IN(const ZFInput &, input)
63 )
66 ZFMP_IN(const zfstring &, url)
67 )
68
69public:
71 virtual void taskOnStart(void);
74private:
75 zfautoT<ZFAudio> _impl;
76 zfobj<ZFObject> _holder;
77};
78
79// ============================================================
83zfclass ZFLIB_ZFUIKit ZFAudioCache : zfextend ZFCache {
84 ZFOBJECT_DECLARE(ZFAudioCache, ZFCache)
86};
87
89#endif // #ifndef _ZFI_ZFAudioCache_h_
90
audio player
zfautoT< ZFAudio > ZFAudioPlay(const ZFInput &src, const ZFListener &callback=(zft_zfnull))
play audio with cache logic, auto stop prev audio task with same src
#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:180
_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
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#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 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
v_ZFResultType::ZFEnumType ZFResultType
see v_ZFResultType
Definition ZFResultType.h:23
#define ZFLIB_ZFUIKit
used to export symbols
Definition ZFUIKitDef.h:16
static ZFAudioCache * instance()
audio player
Definition ZFAudio.h:16
virtual void taskOnStart(void)
called to start task
virtual zfindex & loop()
see ZFAudio::loop
Definition ZFAudioCache.h:49
virtual void load(ZFAudio *impl)
load by impl
virtual void objectOnInit(void)
override this to init your object
Definition ZFAudioCache.h:53
virtual void taskOnStop(ZFResultType resultType)
called to stop task
general input callback
Definition ZFIOCallback_input.h:37
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
virtual ZFResultType & resultType()
for task impl to store task result, reset to success when start
Definition ZFTask.h:84
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:110
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:157