![](/media/cache/profiles/4cd5792cc3ccd04bcd11a0ed7b114410.jpg.50x50_q85.png)
Nucleo F401REでFM音源を実装するやつ 外部DACとオペアンプを利用 現在はMCP4922とNJM2737
Dependencies: AOTTrigon I2CEEPROM MCP4922 AQM0802A mbed
Fork of NuMidi401 by
NuFM401
Nucleo F401用の自作ソフトウェアMIDI音源
概要
だいたいそんなもんです。
特徴
- ブレッドボードの上で組める程度には簡単な回路構成
- 外部のDACにMCP4922を採用
- 念のためのボルテージフォロアとしてNJM2737Dを採用
- バンク用EEPROMに24FC1025を採用
- シリアル経由でMIDIデータを受信することで操作
補足
シリアル <=> MIDI のドライバにはHairless-MIDISerialをオススメします。 仮想MIDIケーブルはとりあえずMIDI Yokeで。
Diff: FMOscillator/FMAlgorithm.cpp
- Revision:
- 23:deb76bdf6f03
- Parent:
- 21:e3014c1bdf9c
--- a/FMOscillator/FMAlgorithm.cpp Sat Jan 31 10:17:22 2015 +0000 +++ b/FMOscillator/FMAlgorithm.cpp Sat Jan 31 10:44:08 2015 +0000 @@ -4,37 +4,51 @@ { opcount = 0; cncount = 0; + cni = 0; operators = NULL; connections = NULL; } -FMAlgorithm::FMAlgorithm(int opc, int cnc) +FMAlgorithm::FMAlgorithm(int opc, int cnc, Timer *tm, AOTTrigon *tri) { opcount = opc; cncount = cnc; operators = new FMOperator*[opcount]; - for(int i = 0; i < opcount; i++) operators[i] = NULL; + for(int i = 0; i < opcount; i++) operators[i] = new FMOperator(tm, tri); connections = new FMAlgorithmConnection[cncount]; } FMAlgorithm::~FMAlgorithm() { - if (operators != NULL) delete[] operators; + if (operators != NULL) { + for(int i = 0; i < opcount; i++) delete operators[i]; + delete[] operators; + } if (connections != NULL) delete[] connections; } -void FMAlgorithm::setOperator(int num, FMOperator *op) +void FMAlgorithm::setConnection(int t, int s) { - if (num >= opcount) return; - operators[num] = op; + if (cni >= cncount) return; + connections[cni].target = t; + connections[cni].source = s; + connections[cni].allocated = true; + cni++; } -void FMAlgorithm::setConnection(int num, int t, int s) -{ - if (num >= cncount) return; - connections[num].target = t; - connections[num].source = s; - connections[num].allocated = true; +void FMAlgorithm::setConnectionIndex(int id) { + if (id >= cncount) return; + cni = id; +} + +void FMAlgorithm::enableCurrentConnection() { + if (cni >= cncount) return; + connections[cni].allocated = true; +} + +void FMAlgorithm::disableCurrentConnection() { + if (cni >= cncount) return; + connections[cni].allocated = false; } void FMAlgorithm::noteOn(float freq, double time) {