Allow building without soundfile libraries.
This commit is contained in:
parent
96c81fd58c
commit
7cba7ddee0
|
|
@ -248,14 +248,16 @@ struct comm spcp_coms[] = {
|
|||
{ 040000, 040000, 040000, 040000 }, E_BEGINNING, 1, LOTS,
|
||||
arg_print,
|
||||
"[col] expr ... : Print vector values." } ,
|
||||
{ "sndprint", com_sndprint, FALSE, FALSE,
|
||||
{ 040000, 040000, 040000, 040000 }, E_BEGINNING, 1, LOTS,
|
||||
arg_print,
|
||||
"[col] expr ... : Print vector values." },
|
||||
{ "sndparam", com_sndparam, FALSE, FALSE,
|
||||
{ 1, 1, 1, 1 }, E_BEGINNING | E_NOPLOTS, 1, LOTS,
|
||||
arg_load,
|
||||
"file samplerate : set sndprint parameters." },
|
||||
#if defined(HAVE_LIBSNDFILE) && defined(HAVE_LIBSAMPLERATE)
|
||||
{ "sndprint", com_sndprint, FALSE, FALSE,
|
||||
{ 040000, 040000, 040000, 040000 }, E_BEGINNING, 1, LOTS,
|
||||
arg_print,
|
||||
"[col] expr ... : Print vector values." },
|
||||
{ "sndparam", com_sndparam, FALSE, FALSE,
|
||||
{ 1, 1, 1, 1 }, E_BEGINNING | E_NOPLOTS, 1, LOTS,
|
||||
arg_load,
|
||||
"file samplerate : set sndprint parameters." },
|
||||
#endif
|
||||
#ifdef XSPICE
|
||||
{ "esave", EVTsave, FALSE, TRUE,
|
||||
{ 040000, 040000, 040000, 040000 }, E_BEGINNING, 1, LOTS,
|
||||
|
|
@ -793,14 +795,16 @@ struct comm nutcp_coms[] = {
|
|||
{ 040000, 040000, 040000, 040000 }, E_BEGINNING, 1, LOTS,
|
||||
arg_print,
|
||||
"[col] expr ... : Print vector values." } ,
|
||||
{ "sndprint", com_sndprint, FALSE, FALSE,
|
||||
{ 040000, 040000, 040000, 040000 }, E_BEGINNING, 1, LOTS,
|
||||
arg_print,
|
||||
"[col] expr ... : Print vector values." },
|
||||
{ "sndparam", com_sndparam, FALSE, FALSE,
|
||||
{ 1, 1, 1, 1 }, E_BEGINNING | E_NOPLOTS, 1, LOTS,
|
||||
arg_load,
|
||||
"file samplerate : set sndprint parameters." },
|
||||
#if defined(HAVE_LIBSNDFILE) && defined(HAVE_LIBSAMPLERATE)
|
||||
{ "sndprint", com_sndprint, FALSE, FALSE,
|
||||
{ 040000, 040000, 040000, 040000 }, E_BEGINNING, 1, LOTS,
|
||||
arg_print,
|
||||
"[col] expr ... : Print vector values." },
|
||||
{ "sndparam", com_sndparam, FALSE, FALSE,
|
||||
{ 1, 1, 1, 1 }, E_BEGINNING | E_NOPLOTS, 1, LOTS,
|
||||
arg_load,
|
||||
"file samplerate : set sndprint parameters." },
|
||||
#endif
|
||||
{ "load", com_load, FALSE, TRUE,
|
||||
{ 1, 1, 1, 1 }, E_BEGINNING | E_NOPLOTS, 1, LOTS,
|
||||
arg_load,
|
||||
|
|
|
|||
|
|
@ -355,6 +355,7 @@ ft_cktcoms(bool terse)
|
|||
fprintf(cp_err, "Error: .plot: no %s analysis found.\n",
|
||||
plottype);
|
||||
}
|
||||
#if defined(HAVE_LIBSNDFILE) && defined(HAVE_LIBSAMPLERATE)
|
||||
} else if (eq(command->wl_word, ".sndparam")) {
|
||||
if (terse) {
|
||||
fprintf(cp_out, ".sndparam line ignored since rawfile was produced.\n");
|
||||
|
|
@ -390,6 +391,7 @@ ft_cktcoms(bool terse)
|
|||
if (!found)
|
||||
fprintf(cp_err, "Error: .sndprint: no %s analysis found.\n", plottype);
|
||||
}
|
||||
#endif // Sound file support
|
||||
} else if (ciprefix(".four", command->wl_word)) {
|
||||
if (terse) {
|
||||
fprintf(cp_out,
|
||||
|
|
|
|||
|
|
@ -430,6 +430,7 @@ done:
|
|||
tfree(buf2);
|
||||
}
|
||||
|
||||
#if defined(HAVE_LIBSNDFILE) && defined(HAVE_LIBSAMPLERATE)
|
||||
|
||||
/* tweaked version of print - write sound-files
|
||||
*/
|
||||
|
|
@ -558,6 +559,7 @@ com_sndparam(wordlist* wl)
|
|||
snd_configure(file, srate, fmt, mult, off, oversampling);
|
||||
return;
|
||||
}
|
||||
#endif // HAVE_LIBSNDFILE
|
||||
|
||||
|
||||
/* Write out some data into a ngspice raw file with 'write filename expr'.
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sndfile.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
#include "sndprint.h"
|
||||
#include "ngspice/ngspice.h"
|
||||
|
||||
#if defined(HAVE_LIBSNDFILE) && defined(HAVE_LIBSAMPLERATE)
|
||||
#include <sndfile.h>
|
||||
|
||||
static int o_samplerate = 48000;
|
||||
static int o_sndfmt = (SF_FORMAT_WAV | SF_FORMAT_PCM_24);
|
||||
|
|
@ -323,3 +324,4 @@ double snd_get_samplerate(void) {
|
|||
|
||||
/* vi:set ts=8 sts=2 sw=2: */
|
||||
|
||||
#endif // HAVE_LIBSNDFILE
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ngspice/ngspice.h"
|
||||
|
||||
#if defined(HAVE_LIBSNDFILE) && defined(HAVE_LIBSAMPLERATE)
|
||||
/////// SNDFILE ///////
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
|
@ -12,7 +15,6 @@
|
|||
// the whole audio file, do it in smaller chunks
|
||||
#define VS_RESAMPLING_CHUNK 1024
|
||||
|
||||
#include "ngspice/ngspice.h"
|
||||
#include "vsjack.h"
|
||||
|
||||
extern char* inp_pathresolve(const char* name);
|
||||
|
|
@ -229,3 +231,15 @@ int vsjack_open(int d, char *file, int channel, double oversampling) {
|
|||
}
|
||||
|
||||
/* vi:set ts=8 sts=4 sw=4: */
|
||||
#else // not HAVE_LIBSNDFILE
|
||||
|
||||
double vsjack_get_value(int d, double time, double time_offset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vsjack_open(int d, char *file, int channel, double oversampling) {
|
||||
fprintf(stderr, "Error: Ngspice built without soundfile support.\n");
|
||||
controlled_exit(1);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue