• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sf_strerror函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sf_strerror函数的典型用法代码示例。如果您正苦于以下问题:C++ sf_strerror函数的具体用法?C++ sf_strerror怎么用?C++ sf_strerror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sf_strerror函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{

   printf("Wav Read Test\n");
   SF_INFO sndInfo;
   
   SNDFILE *sndFile = sf_open(argv[1], SFM_READ, &sndInfo);

   if (sndFile == NULL) {
      fprintf(stderr, "Error reading source file '%s': %s\n", argv[1], sf_strerror(sndFile));
      return 1;
   }
   // Check format - 16bit PCM
   if (sndInfo.format != (SF_FORMAT_WAV | SF_FORMAT_PCM_16)) {
      fprintf(stderr, "Input should be 16bit Wav\n");
      sf_close(sndFile);
      return 1;
   }

   // Allocate memory
   double *waveTable = malloc(sndInfo.channels * sndInfo.frames * sizeof(double));   


   if (waveTable == NULL) {
      fprintf(stderr, "Could not allocate memory for data\n");
      sf_close(sndFile);
      return 1;
   }

   // Load data
   long numFrames = sf_readf_double(sndFile, waveTable, sndInfo.channels*sndInfo.frames);

   long i;
   for(i=0;i<sndInfo.frames;i+=10000){
	printf("Sample %d :\t%f \n",i,waveTable[i]);
   }

   // Output Info
   printf("Read %ld frames from %s, Sample rate: %d, Length: %fs\n",
      numFrames, argv[1], sndInfo.samplerate, (float)numFrames/sndInfo.samplerate);


    long size = 38+5*BLOCKSIZE+MFCC_FREQ_BANDS;
    double *FVec;

    sf_close(sndFile);
    double *wavetable=malloc(BLOCKSIZE*sizeof(double));//{0};
    for(i=0;i<numFrames;i+=BLOCKSIZE){
	wavetable=&(waveTable[i]);
	FVec = extractall(wavetable,sndInfo.frames,sndInfo.samplerate);
    }
    
    for(i=0;i<size;i++)
	printf("%f\t",FVec[i]);
    
    return 0;

}
开发者ID:GanAlps,项目名称:Extracting-Features-from-audio,代码行数:58,代码来源:simpletest.c


示例2: mast_fill_input_buffer

/*
  mast_fill_input_buffer()
  Make sure input buffer if full of audio
*/
size_t mast_fill_input_buffer( MastAudioBuffer* buffer )
{
    size_t total_read = 0;
    int frames_wanted = buffer->get_write_space();
    int frames_read = 0;

    if (frames_wanted==0) {
        // No audio wanted
        MAST_DEBUG( "Tried to fill buffer when it is full" );
        return 0;
    }

    // Loop until buffer is full
    while( frames_wanted > 0 ) {
        frames_wanted = buffer->get_write_space();
        frames_read = sf_readf_float( g_input_file, buffer->get_write_ptr(), frames_wanted );

        // Add on the frames read
        if (frames_read > 0) {
            buffer->add_frames( frames_read );
            total_read += frames_read;
        }

        // Reached end of file?
        if (frames_read < frames_wanted) {
            MAST_DEBUG("Reached end of file (frames_wanted=%d, frames_read=%d)", frames_wanted, frames_read);
            if (g_loop_file) {
                // Seek back to the beginning
                if (sf_seek( g_input_file, 0, SEEK_SET )) {
                    MAST_ERROR("Failed to seek to start of file: %s", sf_strerror( g_input_file ) );
                    return 0;
                }
            } else {
                // Reached end of file (and don't want to loop)
                break;
            }
        }
    }

    if (total_read == 0) {
        MAST_ERROR("Failed to read from file: %s", sf_strerror( g_input_file ) );
    }

    return total_read;
}
开发者ID:njh,项目名称:mast,代码行数:49,代码来源:mast_filecast.cpp


示例3: encode_file

static void
encode_file (const char *infilename, const char *outfilename, int filetype)
{	static float buffer [BUFFER_LEN] ;

	SNDFILE		*infile, *outfile ;
	SF_INFO		sfinfo ;
	int			k, readcount ;

	printf ("    %s -> %s ", infilename, outfilename) ;
	fflush (stdout) ;

	k = 16 - strlen (outfilename) ;
	PUT_DOTS (k) ;

	if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
	{	printf ("Error : could not open file : %s\n", infilename) ;
		puts (sf_strerror (NULL)) ;
		exit (1) ;
		}

	sfinfo.format = filetype ;

	if (! sf_format_check (&sfinfo))
	{	sf_close (infile) ;
		printf ("Invalid encoding\n") ;
		return ;
		} ;

	if (! (outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)))
	{	printf ("Error : could not open file : %s\n", outfilename) ;
		puts (sf_strerror (NULL)) ;
		exit (1) ;
		} ;

	while ((readcount = sf_read_float (infile, buffer, BUFFER_LEN)) > 0)
		sf_write_float (outfile, buffer, BUFFER_LEN) ;

	sf_close (infile) ;
	sf_close (outfile) ;

	printf ("ok\n") ;

	return ;
} /* encode_file */
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:44,代码来源:generate.c


示例4: SendFailure

bool BufReadCmd::Stage2()
{
#ifdef NO_LIBSNDFILE
	SendFailure(&mReplyAddress, "/b_read", "scsynth compiled without libsndfile\n");
 	scprintf("scsynth compiled without libsndfile\n");
	return false;
#else
	SF_INFO fileinfo;

	SndBuf *buf = World_GetNRTBuf(mWorld, mBufIndex);
	int framesToEnd = buf->frames - mBufOffset;
	if (framesToEnd <= 0) return true;

	SNDFILE* sf = sf_open(mFilename, SFM_READ, &fileinfo);
	if (!sf) {
		char str[512];
		sprintf(str, "File '%s' could not be opened: %s\n", mFilename, sf_strerror(NULL));
		SendFailureWithIntValue(&mReplyAddress, "/b_read", str, mBufIndex); //SendFailure(&mReplyAddress, "/b_read", str);
		scprintf(str);
		return false;
	}
	if (fileinfo.channels != buf->channels) {
		char str[512];
		sf_close(sf);
		sprintf(str, "Channel mismatch. File '%s' has %d channels. Buffer has %d channels.\n", mFilename, fileinfo.channels, buf->channels);
		SendFailureWithIntValue(&mReplyAddress, "/b_read", str, mBufIndex); //SendFailure(&mReplyAddress, "/b_read", str);
		scprintf(str);
		return false;
	}

	if (mFileOffset < 0) mFileOffset = 0;
	else if (mFileOffset > fileinfo.frames) mFileOffset = fileinfo.frames;
	if (mNumFrames < 0 || mNumFrames + mFileOffset > fileinfo.frames) mNumFrames = fileinfo.frames - mFileOffset;

	if (mNumFrames > framesToEnd) mNumFrames = framesToEnd;

	sf_seek(sf, mFileOffset, SEEK_SET);
	if (mNumFrames > 0) {
		sf_readf_float(sf, buf->data + (mBufOffset * buf->channels), mNumFrames);
	}

	if(buf->sndfile)
		sf_close(buf->sndfile);

	if (mLeaveFileOpen) {
		buf->sndfile = sf;
	} else {
		sf_close(sf);
		buf->sndfile = 0;
	}

	mSampleRate = (double)fileinfo.samplerate;

	return true;
#endif
}
开发者ID:ARTisERR0R,项目名称:supercollider,代码行数:56,代码来源:SC_SequencedCommand.cpp


示例5: alsa_play

static void
alsa_play (int argc, char *argv [])
{	static float buffer [BUFFER_LEN] ;
	SNDFILE *sndfile ;
	SF_INFO sfinfo ;
	snd_pcm_t * alsa_dev ;
	int		k, readcount, subformat ;

	for (k = 1 ; k < argc ; k++)
	{	memset (&sfinfo, 0, sizeof (sfinfo)) ;

		printf ("Playing %s\n", argv [k]) ;
		if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
		{	puts (sf_strerror (NULL)) ;
			continue ;
			} ;

		if (sfinfo.channels < 1 || sfinfo.channels > 2)
		{	printf ("Error : channels = %d.\n", sfinfo.channels) ;
			continue ;
			} ;

		if ((alsa_dev = alsa_open (sfinfo.channels, (unsigned) sfinfo.samplerate, SF_FALSE)) == NULL)
			continue ;

		subformat = sfinfo.format & SF_FORMAT_SUBMASK ;

		if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
		{	double	scale ;
			int 	m ;

			sf_command (sndfile, SFC_CALC_SIGNAL_MAX, &scale, sizeof (scale)) ;
			if (scale < 1e-10)
				scale = 1.0 ;
			else
				scale = 32700.0 / scale ;

			while ((readcount = sf_read_float (sndfile, buffer, BUFFER_LEN)))
			{	for (m = 0 ; m < readcount ; m++)
					buffer [m] *= scale ;
				alsa_write_float (alsa_dev, buffer, BUFFER_LEN / sfinfo.channels, sfinfo.channels) ;
				} ;
			}
		else
		{	while ((readcount = sf_read_float (sndfile, buffer, BUFFER_LEN)))
				alsa_write_float (alsa_dev, buffer, BUFFER_LEN / sfinfo.channels, sfinfo.channels) ;
			} ;

		snd_pcm_drain (alsa_dev) ;
		snd_pcm_close (alsa_dev) ;

		sf_close (sndfile) ;
		} ;

	return ;
} /* alsa_play */
开发者ID:5in4,项目名称:libsox.dll,代码行数:56,代码来源:sndfile-play.c


示例6: main

int main(int argc, char **argv)
{
    MastSendTool *tool = NULL;
    SF_INFO sfinfo;


    // Create the send tool object
    tool = new MastSendTool( MAST_TOOL_NAME );
    tool->enable_scheduling();

    // Parse the command line arguments
    // and configure the session
    parse_cmd_line( argc, argv, tool );

    // Open the input file by filename
    memset( &sfinfo, 0, sizeof(sfinfo) );
    g_input_file = sf_open(g_filename, SFM_READ, &sfinfo);
    if (g_input_file == NULL) MAST_FATAL("Failed to open input file:\n%s", sf_strerror(NULL));
    tool->set_input_channels( sfinfo.channels );
    tool->set_input_samplerate( sfinfo.samplerate );

    // Display some information about the input file
    print_file_info( g_input_file, &sfinfo );

    // Setup signal handlers
    mast_setup_signals();

    // Run the main loop
    tool->run();

    // Clean up
    delete tool;


    // Close input file
    if (sf_close( g_input_file )) {
        MAST_ERROR("Failed to close input file:\n%s", sf_strerror(g_input_file));
    }


    // Success !
    return 0;
}
开发者ID:njh,项目名称:mast,代码行数:43,代码来源:mast_filecast.cpp


示例7: SndFile

 SndFile(Reader reader)
 :   file(NULL), reader(buffer.frontReader())
 {
     info.format = 0;
     buffer.resize(reader.resource().size() - reader.position());
     reader.read(buffer.data(), buffer.size());
     file = sf_open_virtual(ioInterface(), SFM_READ, &info, this);
     if (!file)
         throw std::runtime_error(std::string(sf_strerror(NULL)));
 }
开发者ID:Sophrinix,项目名称:gosu,代码行数:10,代码来源:SndFile.hpp


示例8: error_close_test

static void
error_close_test (void)
{	static short buffer [SHORT_BUFFER] ;
	const char	*filename = "error_close.wav" ;
	SNDFILE		*sndfile ;
	SF_INFO		sfinfo ;
	FILE		*file ;

	print_test_name (__func__, filename) ;

	/* Open a FILE* from which we will extract a file descriptor. */
	if ((file = fopen (filename, "w")) == NULL)
	{	printf ("\n\nLine %d : fopen returned NULL.\n", __LINE__) ;
		exit (1) ;
	} ;

	/* Set parameters for writing the file. */
	memset (&sfinfo, 0, sizeof (sfinfo)) ;
	sfinfo.channels = 1 ;
	sfinfo.samplerate = 44100 ;
	sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;

	sndfile = sf_open_fd (fileno (file), SFM_WRITE, &sfinfo, SF_TRUE) ;
	if (sndfile == NULL)
	{	printf ("\n\nLine %d : sf_open_fd failed : %s\n", __LINE__, sf_strerror (NULL)) ;
		exit (1) ;
	} ;

	test_write_short_or_die (sndfile, 0, buffer, ARRAY_LEN (buffer), __LINE__) ;

	/* Now close the fd associated with file before calling sf_close. */
	fclose (file) ;

	if (sf_close (sndfile) == 0)
	{
#if OS_IS_WIN32
		OSVERSIONINFOEX osvi ;

		memset (&osvi, 0, sizeof (OSVERSIONINFOEX)) ;
		osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX) ;

		if (GetVersionEx ((OSVERSIONINFO *) &osvi))
		{	printf ("\n\nLine %d : sf_close should not have returned zero.\n", __LINE__) ;
			printf ("\nHowever, this is a known bug in version %d.%d of windows so we'll ignore it.\n\n",
							(int) osvi.dwMajorVersion, (int) osvi.dwMinorVersion) ;
		} ;
#else
		printf ("\n\nLine %d : sf_close should not have returned zero.\n", __LINE__) ;
		exit (1) ;
#endif
	} ;

	unlink (filename) ;
	puts ("ok") ;
} /* error_close_test */
开发者ID:stohrendorf,项目名称:libsndfile,代码行数:55,代码来源:error_test.c


示例9: broadcast_dump

static int
broadcast_dump (const char *filename)
{	SNDFILE	 *file ;
	SF_INFO	 sfinfo ;
	SF_BROADCAST_INFO_2K bext ;
	double time_ref_sec ;
	int got_bext ;

	memset (&sfinfo, 0, sizeof (sfinfo)) ;

	if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
	{	printf ("Error : Not able to open input file %s.\n", filename) ;
		fflush (stdout) ;
		memset (data, 0, sizeof (data)) ;
		puts (sf_strerror (NULL)) ;
		return 1 ;
		} ;

	memset (&bext, 0, sizeof (SF_BROADCAST_INFO_2K)) ;

	got_bext = sf_command (file, SFC_GET_BROADCAST_INFO, &bext, sizeof (bext)) ;
	sf_close (file) ;

	if (got_bext == SF_FALSE)
	{	printf ("Error : File '%s' does not contain broadcast information.\n\n", filename) ;
		return 1 ;
		} ;

	/*
	**	From : http://www.ebu.ch/en/technical/publications/userguides/bwf_user_guide.php
	**
	**	Time Reference:
	**		This field is a count from midnight in samples to the first sample
	**		of the audio sequence.
	*/

	time_ref_sec = ((pow (2.0, 32) * bext.time_reference_high) + (1.0 * bext.time_reference_low)) / sfinfo.samplerate ;

	printf ("Description      : %.*s\n", (int) sizeof (bext.description), bext.description) ;
	printf ("Originator       : %.*s\n", (int) sizeof (bext.originator), bext.originator) ;
	printf ("Origination ref  : %.*s\n", (int) sizeof (bext.originator_reference), bext.originator_reference) ;
	printf ("Origination date : %.*s\n", (int) sizeof (bext.origination_date), bext.origination_date) ;
	printf ("Origination time : %.*s\n", (int) sizeof (bext.origination_time), bext.origination_time) ;

	if (bext.time_reference_high == 0 && bext.time_reference_low == 0)
		printf ("Time ref         : 0\n") ;
	else
		printf ("Time ref         : 0x%x%08x (%.6f seconds)\n", bext.time_reference_high, bext.time_reference_low, time_ref_sec) ;

	printf ("BWF version      : %d\n", bext.version) ;
	printf ("UMID             : %.*s\n", (int) sizeof (bext.umid), bext.umid) ;
	printf ("Coding history   : %.*s\n", bext.coding_history_size, bext.coding_history) ;

	return 0 ;
} /* broadcast_dump */
开发者ID:5in4,项目名称:libsox.dll,代码行数:55,代码来源:sndfile-info.c


示例10: m_file

WavFileReader::WavFileReader(FileSource source, bool fileUpdating) :
    m_file(0),
    m_source(source),
    m_path(source.getLocalFilename()),
    m_buffer(0),
    m_bufsiz(0),
    m_lastStart(0),
    m_lastCount(0),
    m_updating(fileUpdating)
{
    m_frameCount = 0;
    m_channelCount = 0;
    m_sampleRate = 0;

    m_fileInfo.format = 0;
    m_fileInfo.frames = 0;
    m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo);

    if (!m_file || (!fileUpdating && m_fileInfo.channels <= 0)) {
	std::cerr << "WavFileReader::initialize: Failed to open file at \""
                  << m_path << "\" ("
		  << sf_strerror(m_file) << ")" << std::endl;

	if (m_file) {
	    m_error = QString("Couldn't load audio file '%1':\n%2")
		.arg(m_path).arg(sf_strerror(m_file));
	} else {
	    m_error = QString("Failed to open audio file '%1'")
		.arg(m_path);
	}
	return;
    }

    if (m_fileInfo.channels > 0) {
        m_frameCount = m_fileInfo.frames;
        m_channelCount = m_fileInfo.channels;
        m_sampleRate = m_fileInfo.samplerate;
    }

//    std::cerr << "WavFileReader: Frame count " << m_frameCount << ", channel count " << m_channelCount << ", sample rate " << m_sampleRate << std::endl;

}
开发者ID:iopenstack,项目名称:sonic-annotator,代码行数:42,代码来源:WavFileReader.cpp


示例11: printf

void testApp::loadSoundFiles(){
		
		//assume libsndfile looks in the folder where the app is run
		//therefore ../../../ gets to the bin folder
		//we then need dat/sounds/to get to the sound folder
		//this is different to the usual OF default folder
		const char	*infilename = "../../../data/03Ingenue.wav";//PicturesMixer6.aif";//
		//ac_guitar_final.wav
		string loadfilename = "03Ingenue.wav";//PicturesMixer6.aif";
				
		loadedAudio.loadSound(loadfilename);
		
		// Open Input File with lib snd file
    if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
    {   // Open failed
        printf ("SF OPEN routine Not able to open input file %s.\n", infilename) ;
        // Print the error message from libsndfile. 
        puts (sf_strerror (NULL)) ;

        } else{
		printf("SF OPEN opened file %s okay.\n", infilename);
		sndfileInfoString = "Opened okay ";
			
		};
		
//end adam

//end libsndfile load part


  

  const char	*outfilename = "../../../output.wav" ; // output file name

    // Open the output file. 
    if (! (outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)))
    {   printf ("Not able to open output file %s.\n", outfilename) ;
	sndfileInfoString = "NOT OPENED";
        puts (sf_strerror (NULL)) ;
        } ;

}
开发者ID:firmread,项目名称:meitar,代码行数:42,代码来源:testApp.cpp


示例12: linux_play

static void
linux_play (int argc, char *argv [])
{	static short buffer [BUFFER_LEN] ;
	SNDFILE *sndfile ;
	SF_INFO sfinfo ;
	int		k, audio_device, readcount, subformat ;

	for (k = 1 ; k < argc ; k++)
	{	memset (&sfinfo, 0, sizeof (sfinfo)) ;

		printf ("Playing %s\n", argv [k]) ;
		if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
		{	puts (sf_strerror (NULL)) ;
			continue ;
			} ;

		if (sfinfo.channels < 1 || sfinfo.channels > 2)
		{	printf ("Error : channels = %d.\n", sfinfo.channels) ;
			continue ;
			} ;

		audio_device = linux_open_dsp_device (sfinfo.channels, sfinfo.samplerate) ;

		subformat = sfinfo.format & SF_FORMAT_SUBMASK ;

		if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
		{	static float float_buffer [BUFFER_LEN] ;
			double	scale ;
			int 	m ;

			sf_command (sndfile, SFC_CALC_SIGNAL_MAX, &scale, sizeof (scale)) ;
			if (scale < 1e-10)
				scale = 1.0 ;
			else
				scale = 32700.0 / scale ;

			while ((readcount = sf_read_float (sndfile, float_buffer, BUFFER_LEN)))
			{	for (m = 0 ; m < readcount ; m++)
					buffer [m] = scale * float_buffer [m] ;
				write (audio_device, buffer, readcount * sizeof (short)) ;
				} ;
			}
		else
		{	while ((readcount = sf_read_short (sndfile, buffer, BUFFER_LEN)))
				write (audio_device, buffer, readcount * sizeof (short)) ;
			} ;

		sf_close (sndfile) ;

		close (audio_device) ;
		} ;

	return ;
} /* linux_play */
开发者ID:Kirushanr,项目名称:audacity,代码行数:54,代码来源:sndfile-play.c


示例13: aubio_sink_sndfile_close

uint_t aubio_sink_sndfile_close (aubio_sink_sndfile_t *s) {
  if (!s->handle) {
    return AUBIO_FAIL;
  }
  if (sf_close(s->handle)) {
    AUBIO_ERR("sink_sndfile: Error closing file %s: %s", s->path, sf_strerror (NULL));
    return AUBIO_FAIL;
  }
  s->handle = NULL;
  return AUBIO_OK;
}
开发者ID:XunjunYin,项目名称:aubio,代码行数:11,代码来源:sink_sndfile.c


示例14: error_str_sndfile

/* Return error string (or NULL) */
static const char* error_str_sndfile( audioin_t* audioin )
{
    SNDFILE* file = audioin->file;

    if (sf_error(file) == SF_ERR_NO_ERROR) {
        // No error
        return NULL;
    } else {
        // Return error string
        return sf_strerror( file );
    }
}
开发者ID:nicklecoder,项目名称:Audacity,代码行数:13,代码来源:audioin_sndfile.c


示例15: memset

bool SndfileSoundLoader::Load(const char* path)
{
    memset(&m_sfinfo, 0, sizeof(m_sfinfo));
    m_sndfile = sf_open(path, SFM_READ, &m_sfinfo);
    if (m_sndfile == NULL) {
        const char* err = sf_strerror(NULL);
        wxLogWarning("Cannot open file %s: %s", path, err);
        return false;
    }
    wxLogMessage("Using libsndfile sound loader.");
    return true;
}
开发者ID:OpenCPN,项目名称:OpenCPN,代码行数:12,代码来源:SndfileSoundLoader.cpp


示例16: sf_close

void SoundSourceSndFile::close() {
    if (m_pSndFile) {
        const int closeResult = sf_close(m_pSndFile);
        if (0 == closeResult) {
            m_pSndFile = nullptr;
        } else {
            qWarning() << "Failed to close file:" << closeResult
                    << sf_strerror(m_pSndFile)
                    << getUrlString();
        }
    }
}
开发者ID:PetrBarborka,项目名称:mixxx,代码行数:12,代码来源:soundsourcesndfile.cpp


示例17: sf_readf_float

SINT SoundSourceSndFile::readSampleFrames(
        SINT numberOfFrames, CSAMPLE* sampleBuffer) {
    const sf_count_t readCount =
            sf_readf_float(m_pSndFile, sampleBuffer, numberOfFrames);
    if (0 <= readCount) {
        return readCount;
    } else {
        qWarning() << "Failed to read from libsnd file:" << readCount
                << sf_strerror(m_pSndFile);
        return 0;
    }
}
开发者ID:PetrBarborka,项目名称:mixxx,代码行数:12,代码来源:soundsourcesndfile.cpp


示例18: cart_dump

static int
cart_dump (const char *filename)
{	SNDFILE	*file ;
	SF_INFO	sfinfo ;
	SF_CART_INFO_VAR (1024) cart ;
	int got_cart, k ;

	memset (&sfinfo, 0, sizeof (sfinfo)) ;
	memset (&cart, 0, sizeof (cart)) ;

	if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
	{	printf ("Error : Not able to open input file %s.\n", filename) ;
		fflush (stdout) ;
		memset (data, 0, sizeof (data)) ;
		puts (sf_strerror (NULL)) ;
		return 1 ;
		} ;

	got_cart = sf_command (file, SFC_GET_CART_INFO, &cart, sizeof (cart)) ;
	sf_close (file) ;

	if (got_cart == SF_FALSE)
	{	printf ("Error : File '%s' does not contain cart information.\n\n", filename) ;
		return 1 ;
		} ;

	printf ("Version        : %.*s\n", (int) sizeof (cart.version), cart.version) ;
	printf ("Title          : %.*s\n", (int) sizeof (cart.title), cart.title) ;
	printf ("Artist         : %.*s\n", (int) sizeof (cart.artist), cart.artist) ;
	printf ("Cut id         : %.*s\n", (int) sizeof (cart.cut_id), cart.cut_id) ;
	printf ("Category       : %.*s\n", (int) sizeof (cart.category), cart.category) ;
	printf ("Classification : %.*s\n", (int) sizeof (cart.classification), cart.classification) ;
	printf ("Out cue        : %.*s\n", (int) sizeof (cart.out_cue), cart.out_cue) ;
	printf ("Start date     : %.*s\n", (int) sizeof (cart.start_date), cart.start_date) ;
	printf ("Start time     : %.*s\n", (int) sizeof (cart.start_time), cart.start_time) ;
	printf ("End date       : %.*s\n", (int) sizeof (cart.end_date), cart.end_date) ;
	printf ("End time       : %.*s\n", (int) sizeof (cart.end_time), cart.end_time) ;
	printf ("App id         : %.*s\n", (int) sizeof (cart.producer_app_id), cart.producer_app_id) ;
	printf ("App version    : %.*s\n", (int) sizeof (cart.producer_app_version), cart.producer_app_version) ;
	printf ("User defined   : %.*s\n", (int) sizeof (cart.user_def), cart.user_def) ;
	printf ("Level ref.     : %d\n", cart.level_reference) ;
	printf ("Post timers    :\n") ;

	for (k = 0 ; k < ARRAY_LEN (cart.post_timers) ; k++)
		if (cart.post_timers [k].usage [0])
			printf ("  %d   %.*s    %d\n", k, (int) sizeof (cart.post_timers [k].usage), cart.post_timers [k].usage, cart.post_timers [k].value) ;

	printf ("Reserved       : %.*s\n", (int) sizeof (cart.reserved), cart.reserved) ;
	printf ("Url            : %.*s\n", (int) sizeof (cart.url), cart.url) ;
	printf ("Tag text       : %.*s\n", cart.tag_text_size, cart.tag_text) ;

	return 0 ;
} /* cart_dump */
开发者ID:johnwbyrd,项目名称:libsndfile-cmake,代码行数:53,代码来源:sndfile-info.c


示例19: sf_open

///////////////////////////////////////////////////////////////////////////////////
// startRecording ------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////////
bool Echo::startRecording(SF_INFO * recordingInfo){
	string tempFilapath = saveFolder+filename;
	outfile = sf_open (tempFilapath.c_str(), SFM_WRITE, recordingInfo) ;
	bool success;
	if (!outfile)
	{
		cerr<<"Error opening ["<<tempFilapath<<"] : "<<sf_strerror (outfile)<<endl;
		success = false;
		return success;
	}
	success = true;
	return success;	
}
开发者ID:paulobarcelos,项目名称:MagicEcho,代码行数:16,代码来源:Echo.cpp


示例20: DEBUG_ASSERT

SINT SoundSourceSndFile::seekSampleFrame(
        SINT frameIndex) {
    DEBUG_ASSERT(isValidFrameIndex(frameIndex));

    const sf_count_t seekResult = sf_seek(m_pSndFile, frameIndex, SEEK_SET);
    if (0 <= seekResult) {
        return seekResult;
    } else {
        qWarning() << "Failed to seek libsnd file:" << seekResult
                << sf_strerror(m_pSndFile);
        return sf_seek(m_pSndFile, 0, SEEK_CUR);
    }
}
开发者ID:PetrBarborka,项目名称:mixxx,代码行数:13,代码来源:soundsourcesndfile.cpp



注:本文中的sf_strerror函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sf_update_buildInfo函数代码示例发布时间:2022-05-30
下一篇:
C++ sf_set_rtw_dwork_info函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap