« 音がでないなぁ その3 | トップページ | 進捗記録 2014.4.13 »

2014年4月13日 (日)

音が…まず、タイマーを追加

通信で受信したPCMデータをバッファリングし、定期的に再生バッファに書き込むという方針は分かりました。
とりあえず、一定時間ごとに関数を起動するタイマー(QTimer)を追加します。

とりあえずなので、一秒(1000ms)ごとにtimeoutするタイマーを組み込みました。基本的にはサンプルソースautiooutput.{h|c}に書かれているままです。クラスメンバーを"m_xxxxxx"と記述するのはあまり好みではないのでそこは変えましたが(^_^;

以下ログです。ログはcoutで出力し、毎回flushしています。Qtのデバッグ出力(qDebug())もありますが、とりあえずcoutを使っています。

Boot : QDateTime("2014-04-13 09:19:07.126 JST Qt::LocalTime")
Assertion SUCCESS : brynhildr.cpp : LINE : 215
[control] Connected for control.
[graphics] Connected for graphics.
[sound] Connected for sound.
[sound] sample rate -> 44100
[sound] stop : IdleState
[sound] start
[timer] timer start
[sound] output: bytesFree(): 35280
[sound] output: periodSize(): 7056
[sound] output: recievedSize: 3584
[sound] output: totalRecievedSize: 3584
[sound] stop : ActiveState
[sound] stop : IdleState
[sound] sample rate -> 44100
[sound] output: bytesFree(): 35280
[sound] output: periodSize(): 7056
[sound] output: recievedSize: 8960
[sound] output: totalRecievedSize: 8960
[sound] stop : ActiveState
[sound] sample rate -> 44100
[sound] output: bytesFree(): 21168
[sound] output: periodSize(): 7056
[sound] output: recievedSize: 1792
[sound] output: totalRecievedSize: 1792
[sound] sample rate -> 44100
[sound] output: bytesFree(): 14112
[sound] output: periodSize(): 7056
[sound] output: recievedSize: 6912
[sound] output: totalRecievedSize: 6912
[sound] stop : IdleState
[sound] sample rate -> 44100
[sound] output: bytesFree(): 35280
[sound] output: periodSize(): 7056
[sound] output: recievedSize: 5376
[sound] output: totalRecievedSize: 5376
[sound] stop : ActiveState
[sound] stop : IdleState
[sound] sample rate -> 44100
[sound] output: bytesFree(): 35280
[sound] output: periodSize(): 7056
[sound] output: recievedSize: 6912
[sound] output: totalRecievedSize: 6912
[sound] stop : ActiveState
[sound] stop : IdleState
[sound] sample rate -> 44100
[sound] output: bytesFree(): 35280
[sound] output: periodSize(): 7056
[sound] output: recievedSize: 6912
[sound] output: totalRecievedSize: 6912
[sound] stop : ActiveState
[sound] stop : IdleState
[timer] timerExpired().

約1秒でタイムアウトし、関数timerExpired()が呼ばれているようです。

次は、PCMデータのリングバッファへの格納です。クラスを作ったほうがよさそうです。

全然関係ありませんが、Qtで提供されているサンプルソースにはコメントがありませんね…

« 音がでないなぁ その3 | トップページ | 進捗記録 2014.4.13 »

コメント

コメントを書く

コメントは記事投稿者が公開するまで表示されません。

(ウェブ上には掲載しません)

トラックバック


この記事へのトラックバック一覧です: 音が…まず、タイマーを追加:

« 音がでないなぁ その3 | トップページ | 進捗記録 2014.4.13 »