Last main.c.
This commit is contained in:
parent
35750274d1
commit
20c99d0540
49
src/main.c
49
src/main.c
@ -1,20 +1,57 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "audio.h"
|
||||
#include "crypt.h"
|
||||
|
||||
#define CHANNELS 1
|
||||
#define SAMPLE_RATE 48000
|
||||
#define FRAMES_PER_BUFFFER 480
|
||||
|
||||
#define BUF_SIZE (FRAMES_PER_BUFFFER * CHANNELS)
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
(void)argv;
|
||||
(void)argc;
|
||||
|
||||
audio_t aud;
|
||||
if (sodium_init() < 0) {
|
||||
fprintf(stderr, "A Sodium cryptography library is failed to initialise!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
audio_init_default(&aud, 1, 48000, 480, audio_default_callback);
|
||||
crypt_key_t own, remote;
|
||||
|
||||
printf("Listening... ");
|
||||
getchar();
|
||||
printf("Done!\n");
|
||||
if (crypt_key_gen(&own) < 0) {
|
||||
fprintf(stderr, "Failed to generate the keys.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
audio_destroy(&aud);
|
||||
if (crypt_key_gen(&remote) < 0) {
|
||||
fprintf(stderr, "Failed to generate the keys.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
crypt_session_t sess, sess_r;
|
||||
|
||||
crypt_session_init(&sess, &own, &remote, true);
|
||||
crypt_session_init(&sess_r, &remote, &own, false);
|
||||
|
||||
// audio_t aud;
|
||||
|
||||
// uint8_t buf[BUF_SIZE];
|
||||
// memset(buf, 0, BUF_SIZE);
|
||||
|
||||
// audio_init(&aud, CHANNELS, SAMPLE_RATE, FRAMES_PER_BUFFFER);
|
||||
|
||||
// printf("Listening... ");
|
||||
// for (int i = 0; i < (2 * SAMPLE_RATE)/FRAMES_PER_BUFFFER; ++i) {
|
||||
// audio_read(&aud, buf, BUF_SIZE);
|
||||
// audio_write(&aud, buf, BUF_SIZE);
|
||||
// }
|
||||
// printf("Done!\n");
|
||||
|
||||
// audio_destroy(&aud);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user