waveplayer with play pause

Dependents:   WavePlayer_HelloWorld_RTOS5

Files at this revision

API Documentation at this revision

Comitter:
lfink6
Date:
Wed Dec 15 17:16:51 2021 +0000
Parent:
2:cb60c55b6628
Commit message:
Added method to get dac_data output;

Changed in this revision

wave_player.cpp Show annotated file Show diff for this revision Revisions of this file
wave_player.h Show annotated file Show diff for this revision Revisions of this file
diff -r cb60c55b6628 -r a94dd18e8d8e wave_player.cpp
--- a/wave_player.cpp	Sun Dec 12 20:08:11 2021 +0000
+++ b/wave_player.cpp	Wed Dec 15 17:16:51 2021 +0000
@@ -16,6 +16,7 @@
 #include <wave_player.h>
 
         extern bool playing;
+        short unsigned dac_data;
 
 
 //-----------------------------------------------------------------------------
@@ -50,7 +51,7 @@
 {
         unsigned chunk_id,chunk_size,channel;
         unsigned data,samp_int,i;
-        short unsigned dac_data;
+        //short unsigned dac_data;
         long long slice_value;
         char *slice_buf;
         short *data_sptr;
@@ -131,7 +132,7 @@
 // while 16 and 32 bit wave files use signed data
 //
         for (slice=0;slice<num_slices;slice+=1) {
-                      if (playing == true){
+                      if (playing == false){
          
           break;
         } 
@@ -214,4 +215,8 @@
     DAC_rptr=(DAC_rptr+1) & 0xff;
   }
 }
-
+void wave_player::update_level()
+{
+    dac_data_pub=dac_data;
+}
+    
diff -r cb60c55b6628 -r a94dd18e8d8e wave_player.h
--- a/wave_player.h	Sun Dec 12 20:08:11 2021 +0000
+++ b/wave_player.h	Wed Dec 15 17:16:51 2021 +0000
@@ -38,6 +38,8 @@
  * @param _dac pointer to an AnalogOut object to which the samples are sent.
  */
 wave_player(AnalogOut *_dac);
+short unsigned dac_data_pub;
+void update_level();
 
 /** the player function.
  *