[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle
From:       Detlev Casanova <detlev.casanova () gmail ! com>
Date:       2008-10-16 9:12:33
Message-ID: 1224148353.474832.1191.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 871995 by casanova:

 * Add comments (SILENT)


 M  +1 -0      alsaio.cpp  
 M  +33 -4     alsaio.h  


--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/alsaio.cpp #871994:871995
@@ -300,6 +300,7 @@
 	qDebug() << "start()";
 	if (ready)
 	{
+		//This is done here so we can modify parameters before starting.
 		snd_pcm_hw_params_free(hwParams);
 
 		if (snd_pcm_prepare(handle) < 0)
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/alsaio.h #871994:871995
@@ -43,6 +43,8 @@
 class AlsaIO : public QObject
 {
 	Q_OBJECT
+	Q_ENUMS(Format)
+	Q_ENUMS(StreamType)
 public:
 
 	/** PCM sample format */
@@ -67,20 +69,40 @@
 		ALaw = SND_PCM_FORMAT_A_LAW
 	};
 
+	// Stream direction
 	enum StreamType {
 		Capture = 0,
 		Playback
 	};
 	
+	/*
+	 * create and configure the alsa handle for the stream type t, the device
+	 * dev and the sample format f
+	 */
 	AlsaIO(StreamType t, QString dev, Format f);
 	~AlsaIO();
 
+	/*
+	 * returns the stream type currently used.
+	 */
 	StreamType type() const;
 
+	/*
+	 * start streaming, this must be called before starting playback too.
+	 */
 	bool start();
 	
+	/*
+	 * writes raw audio data on the device.
+	 * Actually, it fills a temporary buffer and write it on the device
+	 * when the device is ready
+	 */
 	void write(const QByteArray& data);
 
+	/*
+	 * check if the device is ready. that means if it is correcly configured
+	 * and ready to start streaming.
+	 */
 	bool isReady();
 	
 	/**
@@ -89,21 +111,26 @@
 	unsigned int periodTime() const;
 
 	/**
-	 * @return sampling rate.
+	 * @return sampling rate
 	 */
 	unsigned int sRate() const;
 
 	/**
-	 * @return used format in snd_pcm_format_t (this should change)
+	 * @return used format
 	 */
 	Format format() const {return m_format;}
 	void setFormat(Format f);
-
+	
+	/*
+	 * returns the data currently available.
+	 * each time readyRead() is emitted, those data are
+	 * dropped (if you have a reference on the data, it won't be dropped)
+	 * and the next sample is available.
+	 */
 	QByteArray data();
 	
 	unsigned int timeStamp();
 	void writeData();
-	bool prepare();
 	int frameSizeBytes();
 
 public slots:
@@ -133,6 +160,8 @@
 	int pSizeBytes;
 	QByteArray tmpBuf;
 	int times;
+	
+	bool prepare();
 };
 
 #endif //ALSA_IO
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic