Developer World
Spresense SDK Library v3.3.0-375c679
al_eventlistener.h
1/****************************************************************************
2 * modules/include/audiolite/al_eventlistner.h
3 *
4 * Copyright 2023 Sony Semiconductor Solutions Corporation
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3. Neither the name of Sony Semiconductor Solutions Corporation nor
17 * the names of its contributors may be used to endorse or promote
18 * products derived from this software without specific prior written
19 * permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 ****************************************************************************/
35
36#ifndef __INCLUDE_AUDIOLITE_EVENT_LISTENER_H
37#define __INCLUDE_AUDIOLITE_EVENT_LISTENER_H
38
39#include <nuttx/config.h>
40#include <audiolite/al_component.h>
41
42/****************************************************************************
43 * Pre-processor Definitions
44 ****************************************************************************/
45
46#define AL_EVENT_OVERFLOW (-1)
47#define AL_EVENT_UNDERFLOW (-2)
48#define AL_EVENT_ILLIGALSTREAM (-3)
49#define AL_EVENT_UNSUPPORTFMT (-4)
50#define AL_EVENT_DECODEDONE (-5)
51#define AL_EVENT_STREAMDONE (-6)
52#define AL_EVENT_PLAYSTARTED (-7)
53#define AL_EVENT_PLAYSTOPPED (-8)
54#define AL_EVENT_RECORDSTARTED (-9)
55#define AL_EVENT_RECORDSTOPPED (-10)
56#define AL_EVENT_PLAYPAUSED (-11)
57#define AL_EVENT_PLAYRESUMED (-12)
58#define AL_EVENT_RECORDPAUSED (-13)
59#define AL_EVENT_RECORDRESUMED (-14)
60#define AL_EVENT_DRVERROR (-15)
61#define AL_EVENT_INVALIDSYSPARAM (-16)
62#define AL_EVENT_STOPOUTPUT (-17)
63#define AL_EVENT_STOPINPUT (-18)
64#define AL_EVENT_INITERROR (-19)
65#define AL_EVENT_SENDERROR (-20)
66#define AL_EVENT_MP3FRAMEINFO (-21)
67#define AL_EVENT_MP3DECWORKEREND (-22)
68#define AL_EVENT_UNKNOWN (-23)
69#define AL_EVENT_MP3DECERROR (-24)
70#define AL_EVENT_MP3DEC_WRONGTYPE (-25)
71#define AL_EVENT_WRONGVERSION (-26)
72
74
75/****************************************************************************
76 * Public Function Prototypes
77 ****************************************************************************/
78
79const char *audiolite_strevent(int evt);
80
81/****************************************************************************
82 * Class Definitions
83 ****************************************************************************/
84
85/****************************************************************************
86 * Class: audiolite_eventlistner
87 ****************************************************************************/
88
90{
91 public:
92 virtual ~audiolite_eventlistener(){};
93 virtual void on_event(int evt, audiolite_component *cmp,
94 unsigned long arg){};
95};
96
97/****************************************************************************
98 * Class: audiolite_simplelistener
99 ****************************************************************************/
100
102{
103 public:
104 void on_event(int evt, audiolite_component *cmp,
105 unsigned long arg)
106 {
107 printf("AudioLite Event %s is happened : %d\n",
108 audiolite_strevent(evt), (int)arg);
109 }
110};
111
112#endif /* __INCLUDE_AUDIOLITE_EVENT_LISTENER_H */
Definition: al_component.h:58
Definition: al_eventlistener.h:90
Definition: al_eventlistener.h:102