Update of /cvsroot/playerstage/code/player/server/drivers/audio
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32149

Modified Files:
        alsa.cc alsa.h 
Log Message:
Make the alsa driver send state information


Index: alsa.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/audio/alsa.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** alsa.h      16 Jul 2006 02:50:08 -0000      1.5
--- alsa.h      24 Aug 2006 00:28:14 -0000      1.6
***************
*** 137,140 ****
--- 137,141 ----
                // Internal functions
                virtual void Main (void);
+               void SendStateMessage (void);
  
                // Stored sample functions

Index: alsa.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/audio/alsa.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** alsa.cc     16 Jul 2006 02:50:08 -0000      1.5
--- alsa.cc     24 Aug 2006 00:28:14 -0000      1.6
***************
*** 1094,1097 ****
--- 1094,1100 ----
                playState = PB_STATE_PLAYING;
        }
+ 
+       // Update clients about state
+       SendStateMessage ();
  }
  
***************
*** 1104,1107 ****
--- 1107,1113 ----
        // Drop anything currently in the buffer and stop the card
        snd_pcm_drop (pbHandle);
+ 
+       // Update clients about state
+       SendStateMessage ();
  }
  
***************
*** 1189,1192 ****
--- 1195,1201 ----
        // Move to recording state
        recState = PB_STATE_RECORDING;
+ 
+       // Update clients about state
+       SendStateMessage ();
  }
  
***************
*** 1202,1205 ****
--- 1211,1217 ----
        delete recData;
        recData = NULL;
+ 
+       // Update clients about state
+       SendStateMessage ();
  }
  
***************
*** 1965,1969 ****
--- 1977,1984 ----
                                // If nothing left, moved to STOPPED state
                                else
+                               {
                                        playState = PB_STATE_STOPPED;
+                                       SendStateMessage ();
+                               }
                        }
                        else
***************
*** 1971,1974 ****
--- 1986,1990 ----
                                PLAYER_WARN1 ("Unexpected PCM state for drain: 
%d", snd_pcm_state (pbHandle));
                                playState = PB_STATE_STOPPED;
+                               SendStateMessage ();
                        }
                }
***************
*** 1978,1985 ****
                        if (poll (pbFDs, numPBFDs, 5) > 0)
                        {
- //                            struct timeval timeVal;
- //                            gettimeofday (&timeVal, NULL);
- //                            printf ("%d.%d: Buffer is ready to write\n", 
timeVal.tv_sec, timeVal.tv_usec);
- //                            fflush (NULL);
                                // If it is, check each file descriptor
                                for (int ii = 0; ii < numPBFDs; ii++)
--- 1994,1997 ----
***************
*** 1994,2001 ****
                        if (poll (recFDs, numRecFDs, 5) > 0)
                        {
- //                            struct timeval timeVal;
- //                            gettimeofday (&timeVal, NULL);
- //                            printf ("%d.%d: Buffer is ready to read\n", 
timeVal.tv_sec, timeVal.tv_usec);
- //                            fflush (NULL);
                                // If it is, check each file descriptor
                                for (int ii = 0; ii < numRecFDs; ii++)
--- 2006,2009 ----
***************
*** 2015,2018 ****
--- 2023,2041 ----
  
  
+ // Sends a PLAYER_AUDIO_STATE_DATA message describing the current state of 
the driver
+ void Alsa::SendStateMessage (void)
+ {
+       player_audio_state_t msg;
+ 
+       msg.state = 0;
+       if (playState == PB_STATE_PLAYING || playState == PB_STATE_DRAIN)
+               msg.state |= PLAYER_AUDIO_STATE_PLAYING;
+       if (recState == PB_STATE_RECORDING)
+               msg.state |= PLAYER_AUDIO_STATE_RECORDING;
+ 
+       Publish (device_addr, NULL, PLAYER_MSGTYPE_DATA, 
PLAYER_AUDIO_STATE_DATA, reinterpret_cast<void*> (&msg), sizeof 
(player_audio_state_t), NULL);
+ }
+ 
+ 
  
////////////////////////////////////////////////////////////////////////////////
  //    Message handling


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to