~alcinnz/rhapsode

7543169929e30b47446bd9385a255f88e874f94d — Adrian Cochrane 4 years ago 0903a2c
Output encountered marks
1 files changed, 10 insertions(+), 4 deletions(-)

M src/main.c
M src/main.c => src/main.c +10 -4
@@ 43,9 43,6 @@ int choose_format(char *path) {
    return SF_FORMAT_WAV;
}

int should_play(int type, const char *uri, const char *base) {
    return strncmp(uri, "file:///", strlen("file:///"));
}
#define		BUFFER_LEN	1024
#define		MAX_CHANNELS	6
// FIXME convert samplerate


@@ 58,7 55,16 @@ int read_mono(SNDFILE *fd, SF_INFO *info, short *out) {
    return i;
}

int capture_marks(short *wav, int numsamples, espeak_EVENT *events) {
    while (events->type != 0) {
        if (events->type == espeakEVENT_MARK) printf("%s:\n", events->id.name);
        events++;
    }
    return 0;
}

int save_audio(short *wav, int numsamples, espeak_EVENT *events) {
    capture_marks(wav, numsamples, events);
    if (wav == NULL) return 0;

    while (events->type != 0) {


@@ 92,13 98,13 @@ int speak_initialize() {
        espeak_SetSynthCallback(save_audio);
    } else {
        result = espeak_ng_InitializeOutput(ENOUTPUT_MODE_SPEAK_AUDIO, 0, NULL);
        espeak_SetSynthCallback(capture_marks);
    }
    if (result != ENS_OK) {
        espeak_ng_PrintStatusCodeMessage(result, stderr, context);
        return 3;
    }

    //espeak_SetUriCallback(should_play);
    samplerate = espeak_ng_GetSampleRate();
    return 0;
}