Browse Source

Change AudioAnalyzePrint name API

dds
PaulStoffregen 10 years ago
parent
commit
4694ea0507
2 changed files with 6 additions and 6 deletions
  1. +2
    -3
      analyze_print.cpp
  2. +4
    -3
      analyze_print.h

+ 2
- 3
analyze_print.cpp View File

@@ -37,7 +37,6 @@ void AudioAnalyzePrint::update(void)
uint32_t offset = 0;
uint32_t remain, n;

//Serial.println(name);
block = receiveReadOnly();
if (!block) return;

@@ -86,14 +85,14 @@ void AudioAnalyzePrint::trigger(void)

if (n > 0) {
Serial.print("trigger ");
Serial.print(name);
if (myname) Serial.print(myname);
Serial.print(", delay=");
Serial.println(n);
count = n;
state = 2;
} else {
Serial.print("trigger ");
Serial.println(name);
if (myname) Serial.println(myname);
count = print_length;
state = 3;
}

+ 4
- 3
analyze_print.h View File

@@ -32,15 +32,16 @@
class AudioAnalyzePrint : public AudioStream
{
public:
AudioAnalyzePrint(const char *str) : AudioStream(1, inputQueueArray),
name(str), state(0), trigger_edge(0), delay_length(0), print_length(500) {}
AudioAnalyzePrint(void) : AudioStream(1, inputQueueArray),
myname(NULL), state(0), trigger_edge(0), delay_length(0), print_length(500) {}
virtual void update(void);
void name(const char *str) { myname = str; }
void trigger(void);
void trigger(float level, int edge);
void delay(uint32_t num) { delay_length = num; }
void length(uint32_t num) { print_length = num; }
private:
const char *name;
const char *myname;
uint8_t state;
uint8_t trigger_edge; // trigger type, 0=none, 2=RISING, 3=FALLING
int16_t trigger_level;

Loading…
Cancel
Save