mirror of
https://github.com/linux-speakup/espeakup.git
synced 2026-08-09 09:19:09 +02:00
removed softsynth code from main module
This commit is contained in:
parent
261c6db032
commit
86e93edeb0
3 changed files with 21 additions and 9 deletions
10
espeakup.c
10
espeakup.c
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -37,7 +36,6 @@ const char *shortOptions = "dhv";
|
|||
const char *pidPath = "/var/run/espeakup.pid";
|
||||
|
||||
int debug = 0;
|
||||
int softFD;
|
||||
|
||||
int espeakup_is_running(void)
|
||||
{
|
||||
|
|
@ -76,7 +74,7 @@ void espeakup_sighandler(int sig)
|
|||
|
||||
/* shutdown espeak and close the softsynth */
|
||||
espeak_Terminate();
|
||||
close(softFD);
|
||||
close_softsynth();
|
||||
|
||||
if (! debug)
|
||||
unlink(pidPath);
|
||||
|
|
@ -153,11 +151,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
/* open the softsynth. */
|
||||
softFD = open ("/dev/softsynth", O_RDWR | O_NONBLOCK);
|
||||
if (softFD < 0) {
|
||||
perror("Unable to open the softsynth device");
|
||||
return 3;
|
||||
}
|
||||
open_softsynth();
|
||||
|
||||
/* initialize espeak */
|
||||
espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, NULL, 0);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ struct synth_t {
|
|||
};
|
||||
|
||||
extern int debug;
|
||||
extern int softFD;
|
||||
|
||||
extern int SynthCallback(short *wav, int numsamples, espeak_EVENT *events);
|
||||
extern espeak_ERROR set_frequency (struct synth_t *s);
|
||||
|
|
@ -43,6 +42,8 @@ extern espeak_ERROR set_voice(struct synth_t *s);
|
|||
extern espeak_ERROR set_volume (struct synth_t *s);
|
||||
extern espeak_ERROR stop_speech(void);
|
||||
extern espeak_ERROR speak_text(struct synth_t *s);
|
||||
extern void open_softsynth(void);
|
||||
extern void close_softsynth(void);
|
||||
extern void main_loop (struct synth_t *s);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
17
softsynth.c
17
softsynth.c
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -27,6 +28,8 @@
|
|||
/* max buffer size */
|
||||
const int maxBufferSize = 1025;
|
||||
|
||||
static int softFD = 0;
|
||||
|
||||
static int process_command(struct synth_t *s, char *buf, int start)
|
||||
{
|
||||
int rc;
|
||||
|
|
@ -118,6 +121,20 @@ static void process_buffer (struct synth_t *s, char *buf, size_t length)
|
|||
}
|
||||
}
|
||||
|
||||
void open_softsynth(void)
|
||||
{
|
||||
softFD = open ("/dev/softsynth", O_RDWR | O_NONBLOCK);
|
||||
if (softFD < 0) {
|
||||
perror("Unable to open the softsynth device");
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
|
||||
void close_softsynth(void)
|
||||
{
|
||||
close(softFD);
|
||||
}
|
||||
|
||||
void main_loop (struct synth_t *s)
|
||||
{
|
||||
fd_set set;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue