#include #include #include int main (int argc, char **argv) { SF_INFO info; int mode; SNDFILE *file; char *comment; /* create soundfile with comment */ mode = SFM_WRITE; info.samplerate = 48000; info.channels = 2; info.format = SF_FORMAT_WAV | SF_FORMAT_FLOAT; comment = "testcomment"; if ((file = sf_open("/tmp/sndtest.wav", mode, &info)) == NULL) { fprintf(stderr, "libsndfile(open): %s\n", sf_strerror(file)); exit(EXIT_FAILURE); } if (sf_set_string(file, SF_STR_COMMENT, comment)) { fprintf(stderr, "libsndfile(sf_set_string): %s\n", sf_strerror(file)); } if (sf_close(file)) { fprintf(stderr, "libsndfile(close): %s\n", sf_strerror(file)); exit(EXIT_FAILURE); } /* change comment */ mode = SFM_RDWR; info.format = 0; if ((file = sf_open("/tmp/sndtest.wav", mode, &info)) == NULL) { fprintf(stderr, "libsndfile(open): %s\n", sf_strerror(file)); exit(EXIT_FAILURE); } if (sf_close(file)) { fprintf(stderr, "libsndfile(close): %s\n", sf_strerror(file)); exit(EXIT_FAILURE); } exit (EXIT_SUCCESS); }