sequencer states

This commit is contained in:
2024-03-26 22:12:46 +01:00
parent 9989a52c38
commit 2e629f12aa
5 changed files with 57 additions and 121 deletions

View File

@ -8,14 +8,15 @@
const uint16_t frequencyCodes[8][12] = {
{ 06535, 06234, 05747, 05474, 05233, 05002, 04563, 04353, 04153, 03762, 03600, 03424 },
{ 03256, 03116, 02764, 02636, 02515, 02401, 02271, 02165, 02065, 01771, 01700, 01612 },
{ 01527, 01447, 01372, 01317, 01247, 01201, 01135, 01073, 01033, 00774, 00740, 00705 },
{ 00654, 00624, 00575, 00550, 00523, 00500, 00456, 00435, 00415, 00376, 00360, 00342 },
{ 00326, 00312, 00276, 00264, 00252, 00240, 00227, 00217, 00207, 00177, 00170, 00161 },
{ 00153, 00145, 00137, 00132, 00125, 00120, 00114, 00107, 00103, 00100, 00074, 00071 },
{ 00065, 00062, 00060, 00055, 00052, 00050, 00046, 00044, 00042, 00040, 00036, 00034 },
{ 00033, 00031, 00030, 00026, 00025, 00024, 00023, 00022, 00021, 00020, 00017, 00016 }
// C, Cis, D, Dis, E, F, Fis, G, Gis, A, Ais, H
{ 06535, 06234, 05747, 05474, 05233, 05002, 04563, 04353, 04153, 03762, 03600, 03424 }, // Octave 1
{ 03256, 03116, 02764, 02636, 02515, 02401, 02271, 02165, 02065, 01771, 01700, 01612 }, // Octave 2
{ 01527, 01447, 01372, 01317, 01247, 01201, 01135, 01073, 01033, 00774, 00740, 00705 }, // Octave 3
{ 00654, 00624, 00575, 00550, 00523, 00500, 00456, 00435, 00415, 00376, 00360, 00342 }, // Octave 4
{ 00326, 00312, 00276, 00264, 00252, 00240, 00227, 00217, 00207, 00177, 00170, 00161 }, // Octave 5
{ 00153, 00145, 00137, 00132, 00125, 00120, 00114, 00107, 00103, 00100, 00074, 00071 }, // Octave 6
{ 00065, 00062, 00060, 00055, 00052, 00050, 00046, 00044, 00042, 00040, 00036, 00034 }, // Octave 7
{ 00033, 00031, 00030, 00026, 00025, 00024, 00023, 00022, 00021, 00020, 00017, 00016 } // Octave 8
};
@ -108,26 +109,8 @@ void psgPlayTone(uint8_t channel, t_octave octave, t_note note) {
}
}
void playSomething(void *handle) {
static uint8_t state = 0;
switch (state) {
case 0:
psgWrite(R7, 0b11111110);
psgWrite(R10, 03);
state = 1;
// no break;
case 1:
psgPlayTone(0, e_O_5, e_C);
state = 2;
break;
case 2:
psgPlayTone(0, e_O_5, e_E);
state = 1;
break;
}
void psgAmplitude(uint8_t channel, uint8_t volume) {
psgWrite(R10 + channel, volume);
}
void psgInit() {
@ -160,52 +143,7 @@ void psgInit() {
delay();
delay();
// schAdd(playSomething, NULL, 0, 500);
// disable everything
psgWrite(R7, 0xff);
}
/*
// single tone
writePSG(R0, 0376);
writePSG(R1, 0);
writePSG(R7, 076);
writePSG(R10, 03);
*/
/*
// gun shot
writePSG(R6, 017);
writePSG(R7, 007);
writePSG(R10, 020);
writePSG(R11, 020);
writePSG(R12, 020);
writePSG(R14, 020);
writePSG(R15, 0);
*/
/*
// explosion
writePSG(R6, 0);
writePSG(R7, 007);
writePSG(R10, 020);
writePSG(R11, 020);
writePSG(R12, 020);
writePSG(R14, 070);
writePSG(R15, 0);
*/
/*
// Akkord
writeFrequency(0, C5);
writeFrequency(1, E5);
writeFrequency(2, G5);
writePSG(R7, 0b11111000);
writePSG(R10, 03);
writePSG(R11, 03);
writePSG(R12, 03);
*/