minors modifs
This commit is contained in:
parent
93d8443d6a
commit
6f37e29f4d
|
@ -1,7 +1,7 @@
|
|||
#ifndef _SOUND4CALC_H
|
||||
#define _SOUND4CALC_H
|
||||
|
||||
extern char* wave_signal; // simple waveform*
|
||||
extern char wave_signal[25]; // simple waveform*
|
||||
extern unsigned short duration; // equivalent as 2000 ms duration sound
|
||||
extern unsigned int freq;
|
||||
|
||||
|
|
11
src/main.c
11
src/main.c
|
@ -20,9 +20,11 @@ int main(void)
|
|||
|
||||
dprint(1, 1, "%d", freq);
|
||||
dprint(1, 10, "%s", wave_signal);
|
||||
//dprint(1, 20, "%d", place);
|
||||
dprint(1, 20, "F1:note/F2:sequence", place);
|
||||
dtext(1, 50, "F5 _ F6 -");
|
||||
|
||||
|
||||
|
||||
dupdate();
|
||||
|
||||
key = getkey();
|
||||
|
@ -38,12 +40,11 @@ int main(void)
|
|||
case KEY_F6 : *(wave_signal+place++) = '-'; break;
|
||||
case KEY_DEL : place=(place>0 ? place - 1 : 0); *(wave_signal+place) = 0; break;
|
||||
|
||||
case KEY_EXE :
|
||||
CallNote();
|
||||
break;
|
||||
case KEY_F1 : CallNote(); break;
|
||||
case KEY_F2 : CallSequence(); break;
|
||||
|
||||
case KEY_EXIT :
|
||||
//timer_stop(TIMER_USER);
|
||||
timer_stop(TIMER_USER);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ static struct {
|
|||
{ -1, -1 }
|
||||
};
|
||||
|
||||
char* wave_signal = "-_"; // simple waveform
|
||||
char wave_signal[25] = {0}; // simple waveform
|
||||
unsigned short duration = 2000; // equivalent as 2000 ms duration sound
|
||||
unsigned int freq = 440;
|
||||
|
||||
|
@ -45,6 +45,7 @@ void CallSequence()
|
|||
void CallNote()
|
||||
{
|
||||
unsigned int wavelength = strlen(wave_signal);
|
||||
|
||||
timer_start(TIMER_USER, freq * wavelength, Clock_Hz, PlayNote, freq * duration / 1000);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue