From: G B. <gb...@us...> - 2006-06-01 13:16:37
|
Update of /cvsroot/playerstage/code/player/server/drivers/audio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25068 Modified Files: Makefile.am Added Files: alsa.cc alsa.h Log Message: Adding skeleton ALSA driver --- NEW FILE: alsa.h --- /* * Player - One Hell of a Robot Server * Copyright (C) 2003 * Brian Gerkey * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ //////////////////////////////////////////////////////////////////////////////// // The class for the driver class Alsa : public Driver { public: Alsa (ConfigFile* cf, int section); virtual int Setup (void); virtual int Shutdown (void); virtual int ProcessMessage (MessageQueue *resp_queue, player_msghdr *hdr, void *data); private: virtual void Main (void); // Driver options bool block; }; Index: Makefile.am =================================================================== RCS file: /cvsroot/playerstage/code/player/server/drivers/audio/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 2 May 2006 11:40:33 -0000 1.2 --- Makefile.am 1 Jun 2006 20:16:33 -0000 1.3 *************** *** 1 **** ! noinst_LIBRARIES = \ No newline at end of file --- 1,9 ---- ! noinst_LTLIBRARIES = ! ! if INCLUDE_ALSA ! noinst_LTLIBRARIES += libalsa.la ! endif ! ! AM_CPPFLAGS = -Wall -I$(top_srcdir) ! ! libalsa_la_SOURCES = alsa.cc --- NEW FILE: alsa.cc --- /* * Player - One Hell of a Robot Server * Copyright (C) 2003 * Brian Gerkey * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * A driver to provide access to the ALSA sound system. */ #include <libplayercore/playercore.h> #include "alsa.h" #include <alsa/asoundlib.h> // Initialisation function Driver* Alsa_Init (ConfigFile* cf, int section) { return reinterpret_cast<Driver*> (new Alsa (cf, section)); } // Register function void Alsa_Register (DriverTable* table) { table->AddDriver("alsa", Alsa_Init); } //////////////////////////////////////////////////////////////////////////////// // Driver management //////////////////////////////////////////////////////////////////////////////// // Constructor. Retrieve options from the configuration file and do any // pre-Setup() setup. Alsa::Alsa (ConfigFile* cf, int section) : Driver (cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN, PLAYER_AUDIO_CODE) { // Read the config file options block = cf->ReadBool (section, "block", false); return; } // Set up the device. Return 0 if things go well, and -1 otherwise. int Alsa::Setup (void) { StartThread (); printf ("Alsa driver initialised\n"); return 0; } // Shutdown the device int Alsa::Shutdown (void) { printf ("Alsa driver shutting down\n"); StopThread (); return 0; } //////////////////////////////////////////////////////////////////////////////// // Thread stuff //////////////////////////////////////////////////////////////////////////////// void Alsa::Main (void) { while (1) { pthread_testcancel (); // Handle pending messages if (!InQueue->Empty ()) { ProcessMessages (); } } } //////////////////////////////////////////////////////////////////////////////// // Message handling //////////////////////////////////////////////////////////////////////////////// int Alsa::ProcessMessage (MessageQueue *resp_queue, player_msghdr *hdr, void *data) { return 0; } |