Sound recorder and playback device

Dependents:   Seeed_Grove_Recorder_Example

Files at this revision

API Documentation at this revision

Comitter:
bridadan
Date:
Thu Apr 30 19:53:56 2015 +0000
Parent:
0:2d4b0841e58c
Commit message:
Renaming library

Changed in this revision

GroveRecorder.cpp Show diff for this revision Revisions of this file
GroveRecorder.h Show diff for this revision Revisions of this file
ISD1820P.cpp Show annotated file Show diff for this revision Revisions of this file
ISD1820P.h Show annotated file Show diff for this revision Revisions of this file
diff -r 2d4b0841e58c -r 19584eb1fdf7 GroveRecorder.cpp
--- a/GroveRecorder.cpp	Thu Apr 30 19:49:15 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#include "GroveRecorder.h"
-
-GroveRecorder::GroveRecorder(PinName recordPin, PinName playPin)
-        : maxSoundTime(defaultMaxSoundTime), record(recordPin, 0), play(playPin, 0) {
-    // Empty
-}
-
-void GroveRecorder::stopRecording() {
-    record = 0;
-}
-
-void GroveRecorder::startRecording(float time) {
-    if (!record) {
-        if (time > maxSoundTime) {
-            time = maxSoundTime;
-        }        
-        
-        record = 1;
-        recordTimeout.attach(this, &GroveRecorder::stopRecording, time);
-    }
-}
-
-void GroveRecorder::startRecordingMaxTime() {
-    startRecording(maxSoundTime);
-}
-
-void GroveRecorder::stopPlaying() {
-    play = 0;
-}
-
-void GroveRecorder::startPlaying(float time) {
-    if (!play && !record) {
-        if (time > maxSoundTime) {
-            time = maxSoundTime;
-        }
-        
-        play = 1;
-        playTimeout.attach(this, &GroveRecorder::stopPlaying, time);
-    }
-}
-
-void GroveRecorder::startPlayingMaxTime() {
-    startPlaying(maxSoundTime);
-}
-    
\ No newline at end of file
diff -r 2d4b0841e58c -r 19584eb1fdf7 GroveRecorder.h
--- a/GroveRecorder.h	Thu Apr 30 19:49:15 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#ifndef _GROVE_RECORDER_H_
-#define _GROVE_RECORDER_H_
-
-#include "mbed.h"
-
-/** GroveDetector class.
- *  Used to control recording and playblack of sounds using this component: http://www.seeedstudio.com/depot/Grove-Recorder-p-1825.html
- */
-class GroveRecorder {
-public:
-    /**
-     *  Constructor. Initializes the maximum record/playback sound to defaultMaxSoundTime.
-     *
-     *  @param recordPin The pin that controls recording.
-     *  @param playPin The pin that controls playback.
-     */
-    GroveRecorder(PinName recordPin, PinName playPin);
-    
-    /**
-     *  Starts a new recording.
-     *
-     *  @param time Controls how long to record.
-     */
-    void startRecording(float time);
-    
-    /**
-     *  Starts a new recording with a length of the maximum time.
-     */
-    void startRecordingMaxTime();
-    
-    /**
-     *  Stops the current recording.
-     */
-    void stopRecording();
-    
-    /**
-     *  Starts playback of the previous recording.
-     *
-     *  @param time Controls how long to play the last recording.
-     */
-    void startPlaying(float time);
-    
-    
-    /**
-     *  Starts playback of the previous recording up to the maximum time.
-     */
-    void startPlayingMaxTime();
-    
-    /**
-     *  Stops the current playback
-     */
-    void stopPlaying();
-    
-    /**
-     *  Set the default max recording and playback time. The default is 10 seconds.
-     *
-     *  @param maxTime The maximum time in seconds to record and playback sounds.
-     */
-    void setMaxSoundTime(float maxTime);
-
-    
-private:    
-    /**
-     *  Default sound recording/playback is 10 seconds
-     */
-    const static float defaultMaxSoundTime = 10.0f;
-     
-    float maxSoundTime;
-    
-    DigitalOut record;
-    DigitalOut play;
-    
-    Timeout recordTimeout;
-    Timeout playTimeout;
-};
-    
-#endif
\ No newline at end of file
diff -r 2d4b0841e58c -r 19584eb1fdf7 ISD1820P.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ISD1820P.cpp	Thu Apr 30 19:53:56 2015 +0000
@@ -0,0 +1,45 @@
+#include "ISD1820P.h"
+
+ISD1820P::ISD1820P(PinName recordPin, PinName playPin)
+        : maxSoundTime(defaultMaxSoundTime), record(recordPin, 0), play(playPin, 0) {
+    // Empty
+}
+
+void ISD1820P::stopRecording() {
+    record = 0;
+}
+
+void ISD1820P::startRecording(float time) {
+    if (!record) {
+        if (time > maxSoundTime) {
+            time = maxSoundTime;
+        }        
+        
+        record = 1;
+        recordTimeout.attach(this, &ISD1820P::stopRecording, time);
+    }
+}
+
+void ISD1820P::startRecordingMaxTime() {
+    startRecording(maxSoundTime);
+}
+
+void ISD1820P::stopPlaying() {
+    play = 0;
+}
+
+void ISD1820P::startPlaying(float time) {
+    if (!play && !record) {
+        if (time > maxSoundTime) {
+            time = maxSoundTime;
+        }
+        
+        play = 1;
+        playTimeout.attach(this, &ISD1820P::stopPlaying, time);
+    }
+}
+
+void ISD1820P::startPlayingMaxTime() {
+    startPlaying(maxSoundTime);
+}
+    
\ No newline at end of file
diff -r 2d4b0841e58c -r 19584eb1fdf7 ISD1820P.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ISD1820P.h	Thu Apr 30 19:53:56 2015 +0000
@@ -0,0 +1,77 @@
+#ifndef _ISD1820P_H_
+#define _ISD1820P_H_
+
+#include "mbed.h"
+
+/** ISD1820P class.
+ *  Used to control recording and playblack of sounds using this component: http://www.seeedstudio.com/depot/Grove-Recorder-p-1825.html
+ */
+class ISD1820P {
+public:
+    /**
+     *  Constructor. Initializes the maximum record/playback sound to defaultMaxSoundTime.
+     *
+     *  @param recordPin The pin that controls recording.
+     *  @param playPin The pin that controls playback.
+     */
+    ISD1820P(PinName recordPin, PinName playPin);
+    
+    /**
+     *  Starts a new recording.
+     *
+     *  @param time Controls how long to record.
+     */
+    void startRecording(float time);
+    
+    /**
+     *  Starts a new recording with a length of the maximum time.
+     */
+    void startRecordingMaxTime();
+    
+    /**
+     *  Stops the current recording.
+     */
+    void stopRecording();
+    
+    /**
+     *  Starts playback of the previous recording.
+     *
+     *  @param time Controls how long to play the last recording.
+     */
+    void startPlaying(float time);
+    
+    
+    /**
+     *  Starts playback of the previous recording up to the maximum time.
+     */
+    void startPlayingMaxTime();
+    
+    /**
+     *  Stops the current playback
+     */
+    void stopPlaying();
+    
+    /**
+     *  Set the default max recording and playback time. The default is 10 seconds.
+     *
+     *  @param maxTime The maximum time in seconds to record and playback sounds.
+     */
+    void setMaxSoundTime(float maxTime);
+
+    
+private:    
+    /**
+     *  Default sound recording/playback is 10 seconds
+     */
+    const static float defaultMaxSoundTime = 10.0f;
+     
+    float maxSoundTime;
+    
+    DigitalOut record;
+    DigitalOut play;
+    
+    Timeout recordTimeout;
+    Timeout playTimeout;
+};
+    
+#endif
\ No newline at end of file