DSPおよびA/D, D/A変換器の初期化、
A/D変換、D/A変換を行う関数です。
関数や変数の宣言は、ヘッダファイルiolib.h
で行われています。
Cソースで
#include "iolib.h"
を実行して読み込んでください。
init_21k()
を実行してから
init_1847()
を実行するか、
単にinit()
を実行するかの、いずれかになります。
rate
はサンプリング周波数です。
gain
は入力の増幅度で、
gain
×1.5dBになります。
/* Initialize Processor */ extern void init_21k( void );
/* Initialize CODEC */ extern void init_1847(int rate, int gain);
/* Initialize all */ extern void init(int rate, int gain);
rate に指定する定数 |
サンプリング周波数[kHz] | 利用されている分野 |
---|---|---|
SAMPLE5500 | 5.5 | |
SAMPLE6600 | 6.6 | |
SAMPLE8000 | 8.0 | 電話など |
SAMPLE9600 | 9.6 | |
SAMPLE11000 | 11.0 | |
SAMPLE12000 | 12.0 | |
SAMPLE16000 | 16.0 | |
SAMPLE19000 | 19.0 | |
SAMPLE27000 | 27.0 | |
SAMPLE32000 | 32.0 | BS Aモード, DAT LPモード |
SAMPLE33000 | 33.0 | |
SAMPLE38000 | 38.0 | |
SAMPLE44100 | 44.1 | CD, DAT |
SAMPLE48000 | 48.0 | BS Bモード, DAT |
A/D変換が完了するまで待ち、A/D変換された信号を取得する関数です。 下記の3種類があります。
read_input()
read_inputs()
read_input_int()
read_input()
とread_inputs()
は
A/D変換された信号を±1.0の範囲に変換します。
read_input_int()
では
MIN_IO_INT
〜MAX_IO_INT
の整数になります。
read_input()
とread_input_int()
は
A/D変換された結果が関数の戻り値になります。
read_inputs()
は引数として2要素の配列を渡し、
そこに結果が書き込まれます。
/* Read an input sample */ float read_input(void); /* Read input samples */ void read_inputs(float buf[]); /* Read an input sample */ int read_input_int(void);
A/D変換と同様に、下記の3種類があります。
write_output()
write_outputs()
write_output_int()
write_output()
とwrite_outputs()
は
実数値をD/A変換します。
±1.0を超えた場合はクリップされます。
write_output_int()
は整数値をD/A変換します。
MIN_IO_INT
〜MAX_IO_INT
の範囲を超えても
クリップなどの処理は行いません。
write_output()
とwrite_output_int()
には、
引数としてD/A変換する値を渡します。
同じ信号を両方のチャンネルに出力します。
write_outputs()
には2要素の配列を渡します。
A/D変換に用いる関数とD/A変換に用いる関数は、
各々独立に選べます。
例えば、A/D変換にread_inputs()
を使用し、
D/A変換にwrite_output_int()
を用いてもかまいません。
/* Write an output sample */ void write_output(float out); /* Write output samples */ void write_outputs(float buf[]); /* Write an output sample */ void write_output_int(int out);
(作成: 2000年6月12日, 最終更新: 2000年10月6日)