• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

ATMEGA328を搭載した Arduino Duemilanove 互換機で音をPWM D/A変換出力するシンセサイザーライブラリです。


Commit MetaInfo

Revisióncc32489e4a0059ef890c0432b7a936789851daab (tree)
Tiempo2016-04-23 23:45:17
AutorAkiyoshi Kamide <kamide@yk.r...>
CommiterAkiyoshi Kamide

Log Message

systemReset() による初期化動作が不十分だったのを修正

Cambiar Resumen

Diferencia incremental

--- a/PWMDAC_Synth.h
+++ b/PWMDAC_Synth.h
@@ -1,5 +1,5 @@
11 //
2-// PWM DAC Synthesizer ver.20160419
2+// PWM DAC Synthesizer ver.20160423
33 // by Akiyoshi Kamide (Twitter: @akiyoshi_kamide)
44 // http://kamide.b.osdn.me/pwmdac_synth_lib/
55 // https://osdn.jp/users/kamide/pf/PWMDAC_Synth/
@@ -97,12 +97,12 @@ class MidiChannel {
9797 PROGMEM const byte *wavetable;
9898 EnvelopeParam envelope;
9999 MidiChannel(PROGMEM const Instrument *instrument) {
100- programChange(instrument);
101- reset();
100+ reset(instrument);
102101 }
103- void reset() {
102+ void reset(PROGMEM const Instrument *instrument) {
104103 resetAllControllers();
105104 rpns[LSB] = rpns[MSB] = UCHAR_MAX;
105+ programChange(instrument);
106106 }
107107 double getPitchRate() const { return pitch_rate; }
108108 int getPitchBend() const { return pitch_bend; }
@@ -333,6 +333,7 @@ class PWMDACSynth {
333333 #endif
334334 }
335335 #define EACH_VOICE(p) for(VoiceStatus *(p)=voices; (p)<= voices + (PWMDAC_POLYPHONY - 1); (p)++)
336+#define EACH_CHANNEL(c) for(MidiChannel *(c)=channels; (c)<= channels + (NumberOf(channels) - 1); (c)++)
336337 inline static void updatePulseWidth() {
337338 unsigned int pw = 0;
338339 EACH_VOICE(v) pw += v->nextPulseWidth();
@@ -366,7 +367,10 @@ class PWMDACSynth {
366367 break;
367368 }
368369 }
369- static void systemReset() { EACH_VOICE(v) v->reset(); }
370+ static void systemReset() {
371+ EACH_VOICE(v) v->reset();
372+ EACH_CHANNEL(c) c->reset(defaultInstrument);
373+ }
370374 static MidiChannel *getChannel(char channel) { return channels + (channel - 1); }
371375 static char getChannel(MidiChannel *cp) { return (cp - channels) + 1; }
372376 static byte musicalMod12(char);
@@ -382,6 +386,7 @@ class PWMDACSynth {
382386 return note;
383387 }
384388 protected:
389+ static PROGMEM const Instrument * const defaultInstrument;
385390 static MidiChannel channels[16];
386391 static VoiceStatus voices[PWMDAC_POLYPHONY];
387392 static PROGMEM const byte maxVolumeSineWavetable[];
@@ -407,5 +412,6 @@ class PWMDACSynth {
407412 ISR(PWMDAC_OVF_vect) { PWMDACSynth::updatePulseWidth(); } \
408413 VoiceStatus PWMDACSynth::voices[PWMDAC_POLYPHONY]; \
409414 PWMDAC_CREATE_WAVETABLE(PWMDACSynth::maxVolumeSineWavetable, PWMDAC_MAX_VOLUME_SINE_WAVE); \
415+ PROGMEM const Instrument * const PWMDACSynth::defaultInstrument = instrument; \
410416 MidiChannel PWMDACSynth::channels[16] = MidiChannel(instrument);
411417
--- a/README.txt
+++ b/README.txt
@@ -1,7 +1,7 @@
11
22 [PWMDAC_Synth - PWM DAC synthesizer library for Arduino]
33
4-ver.20160419
4+ver.20160423
55
66 Arduinoで動作する簡易シンセサイザライブラリです。
77