📄 p2os_sound.cc
字号:
/* * Player - One Hell of a Robot Server * Copyright (C) 2000 * Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard * * * 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 * *//* * $Id: p2os_sound.cc,v 1.1.2.1 2003/04/23 22:42:09 jbers Exp $ * * methods for accessing and playing the amigobot sounds */#include <stdio.h>#include <p2os.h>class P2OSSound: public P2OS { public: ~P2OSSound(); P2OSSound(char* interface, ConfigFile* cf, int section) : P2OS(interface, cf, section){} void PutCommand(void*, unsigned char *, size_t maxsize);};CDevice* P2OSSound_Init(char* interface, ConfigFile* cf, int section){ if(strcmp(interface, PLAYER_SOUND_STRING)) { PLAYER_ERROR1("driver \"p2os_sound\" does not support interface \"%s\"\n", interface); return(NULL); } else return((CDevice*)(new P2OSSound(interface, cf, section)));}// a driver registration functionvoid P2OSSound_Register(DriverTable* table){ table->AddDriver("p2os_sound", PLAYER_ALL_MODE, P2OSSound_Init);}P2OSSound::~P2OSSound(){ ((player_p2os_cmd_t*)device_command)->sound.index = 0x00;}void P2OSSound::PutCommand(void* client, unsigned char *src, size_t size) { if(size != sizeof( player_gripper_cmd_t ) ) puts("P2OSSound::PutCommand(): command wrong size. ignoring."); else ((player_p2os_cmd_t*)device_command)->sound = *((player_sound_cmd_t*)src);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -