OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [common/] [coreservices/] [isound.h] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2017 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      Sound source interface with wav-format suppport.
6
 */
7
 
8
#ifndef __DEBUGGER_COMMON_CORESERVICES_ISOUND_H__
9
#define __DEBUGGER_COMMON_CORESERVICES_ISOUND_H__
10
 
11
#include <iface.h>
12
#include <attribute.h>
13
#include <inttypes.h>
14
 
15
namespace debugger {
16
 
17
static const char *const IFACE_SOUND = "ISound";
18
 
19
static const int SOUND_CHANNELS_MAX = 2;
20
 
21
struct SoundSampleType {
22
    int chan[SOUND_CHANNELS_MAX];
23
};
24
 
25
class ISound : public IFace {
26
 public:
27
    ISound() : IFace(IFACE_SOUND) {
28
        soundListeners_.make_list(0);
29
    }
30
 
31
    /** Update listeners with configurable bit rate 44.1 kHz for an example */
32
    virtual void registerSoundListener(IFace *listener) {
33
        AttributeType item;
34
        item.make_iface(listener);
35
        soundListeners_.add_to_list(&item);
36
    }
37
 
38
    virtual void unregisterSoundListener(IFace *listener) {
39
        for (unsigned i = 0; i < soundListeners_.size(); i++) {
40
            if (listener == soundListeners_[i].to_iface()) {
41
                soundListeners_.remove_from_list(i);
42
                return;
43
            }
44
        }
45
    }
46
 
47
    virtual double getFreqDetectedHz() = 0;
48
 
49
 protected:
50
    AttributeType soundListeners_;
51
};
52
 
53
}  // namespace debugger
54
 
55
#endif  // __DEBUGGER_COMMON_CORESERVICES_ISOUND_H__

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.