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

uint32_t offset = 0; uint32_t offset = 0;
uint32_t remain, n; uint32_t remain, n;


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




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

+ 4
- 3
analyze_print.h View File

class AudioAnalyzePrint : public AudioStream class AudioAnalyzePrint : public AudioStream
{ {
public: 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); virtual void update(void);
void name(const char *str) { myname = str; }
void trigger(void); void trigger(void);
void trigger(float level, int edge); void trigger(float level, int edge);
void delay(uint32_t num) { delay_length = num; } void delay(uint32_t num) { delay_length = num; }
void length(uint32_t num) { print_length = num; } void length(uint32_t num) { print_length = num; }
private: private:
const char *name;
const char *myname;
uint8_t state; uint8_t state;
uint8_t trigger_edge; // trigger type, 0=none, 2=RISING, 3=FALLING uint8_t trigger_edge; // trigger type, 0=none, 2=RISING, 3=FALLING
int16_t trigger_level; int16_t trigger_level;

Loading…
Cancel
Save