?? osssoundcard.h
字號:
//// Copyright (c) 2004 by Istv醤 V醨adi//// This file is part of dxr3Player, a DVD player written specifically // for the DXR3 (aka Hollywood+) decoder card.// 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#ifndef DXR3PLAYER_OUTPUT_SOUNDCARD_H#define DXR3PLAYER_OUTPUT_SOUNDCARD_H//------------------------------------------------------------------------------#include "AudioDevice.h"#include "sched/Thread.h"#include "util/Device.h"#include "util/FDWriter.h"//------------------------------------------------------------------------------namespace output {//------------------------------------------------------------------------------/** * Wrapper class for an OSS soundcard device */class OSSSoundcard : public AudioDevice, public FDWriter< Device<> >, public sched::Thread{private: /** * The size of the sound card driver's buffer. */ size_t bufferSize; /** * The number of bytes written so far. */ unsigned long long bytesWritten; /** * The data to write. */ const void* volatile data; /** * The length of the data to write. */ volatile size_t dataLength;public: /** * Construct the sound card with the given DSP device. */ OSSSoundcard(const char* dsp); /** * Destroy the sound card. */ ~OSSSoundcard(); /** * Start the playback. * * Can be called only for triggerable sound cards. */ virtual void startPlayback(); /** * Write the given buffer to the sound card. It also keeps track * of the number of bytes written. */ virtual size_t play(const void* buf, size_t count, bool interruptible = true); /** * Get the number of samples played since opening the device. * * Can be called only for sound cards with real-time capability */ virtual unsigned long long getNumberOfSamplesPlayed(); /** * Get the number of samples buffered (i.e. in the buffer, ready * to be played, but not yet played!). * * Can be called only for sound cards with real-time capability */ virtual unsigned long long getNumberOfSamplesBuffered(); /** * Stop the playback. For triggerable sound cards, the output will * be disabled as well, and has to be started with a call to start(). */ virtual void stopPlayback(); /** * Stop the sound card. */ virtual void stop();private: /** * Convert the given number of samples to a PTS difference value. */ ptsdiff_t samples2PTS(unsigned long long samples) const; /** * Setup the audio device. * * @param s the audio mode * @param rate the sampling rate in Hz * @param s indicate if stereo or mono mode */ virtual void doSetup(audioMode_t& mode, unsigned& rate, bool& s); /** * Perform the actual writing of the data. */ virtual void perform();};//------------------------------------------------------------------------------} /* namespace output *///------------------------------------------------------------------------------#endif // DXR3PLAYER_OUTPUT_SOUNDCARD_H// Local variables:// mode: c++// End:
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -