Exemplo n.º 1
0
int
main (int argc, char *argv [])
{
	if (argc < 2)
	{	printf ("Usage : %s <input sound file>\n\n", argv [0]) ;
		return 1 ;
		} ;

#if defined (__linux__)
	linux_play (argc, argv) ;
#elif (defined (__MACH__) && defined (__APPLE__))
	macosx_play (argc, argv) ;
#elif (defined (sun) && defined (unix))
	solaris_play (argc, argv) ;
#elif (defined (_WIN32) || defined (WIN32))
	win32_play (argc, argv) ;
#elif defined (__BEOS__)
	printf ("This program cannot be compiled on BeOS.\n") ;
	printf ("Instead, compile the file sfplay_beos.cpp.\n") ;
	return 1 ;
#else
	#warning "*** Playing sound not yet supported on this platform."
	#warning "*** Please feel free to submit a patch."
	printf ("Error : Playing sound not yet supported on this platform.\n") ;
	return 1 ;
#endif

	return 0 ;
} /* main */
Exemplo n.º 2
0
int
main (int argc, char *argv [])
{
	if (argc < 2)
	{
		printf ("\nUsage : %s <input sound file>\n\n", program_name (argv [0])) ;
		printf ("  Using %s.\n\n", sf_version_string ()) ;
#if (OS_IS_WIN32 == 1)
		printf ("This is a Unix style command line application which\n"
				"should be run in a MSDOS box or Command Shell window.\n\n") ;
		printf ("Sleeping for 5 seconds before exiting.\n\n") ;

		Sleep (5 * 1000) ;
#endif
		return 1 ;
		} ;

#if defined (__ANDROID__)
	puts ("*** Playing sound not yet supported on Android.") ;
	puts ("*** Please feel free to submit a patch.") ;
	return 1 ;
#elif defined (__linux__)
	#if HAVE_ALSA_ASOUNDLIB_H
		if (access ("/proc/asound/cards", R_OK) == 0)
			alsa_play (argc, argv) ;
		else
	#endif
		opensoundsys_play (argc, argv) ;
#elif defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
	opensoundsys_play (argc, argv) ;
#elif (defined (__MACH__) && defined (__APPLE__) && OSX_DARWIN_VERSION <= 11)
	macosx_play (argc, argv) ;
#elif HAVE_SNDIO_H
	sndio_play (argc, argv) ;
#elif (defined (sun) && defined (unix))
	solaris_play (argc, argv) ;
#elif (OS_IS_WIN32 == 1)
	win32_play (argc, argv) ;
#elif (defined (__MACH__) && defined (__APPLE__) && OSX_DARWIN_VERSION > 11)
	printf ("OS X 10.8 and later have a new Audio API.\n") ;
	printf ("Someone needs to write code to use that API.\n") ;
	return 1 ;
#elif defined (__BEOS__)
	printf ("This program cannot be compiled on BeOS.\n") ;
	printf ("Instead, compile the file sfplay_beos.cpp.\n") ;
	return 1 ;
#else
	puts ("*** Playing sound not yet supported on this platform.") ;
	puts ("*** Please feel free to submit a patch.") ;
	return 1 ;
#endif

	return 0 ;
} /* main */
Exemplo n.º 3
0
int
main (int argc, char *argv [])
{
	if (argc < 2)
	{
		printf ("\nUsage : %s <input sound file>\n\n", argv [0]) ;
#if (OS_IS_WIN32 == 1)
		printf ("This is a Unix style command line application which\n"
				"should be run in a MSDOS box or Command Shell window.\n\n") ;
		printf ("Sleeping for 5 seconds before exiting.\n\n") ;

		/* This is the officially blessed by microsoft way but I can't get
		** it to link.
		**     Sleep (15) ;
		** Instead, use this:
		*/
		Sleep (5 * 1000) ;
#endif
		return 1 ;
		} ;

#if defined (__linux__)
	#if HAVE_ALSA_ASOUNDLIB_H
		if (access ("/proc/asound/cards", R_OK) == 0)
			alsa_play (argc, argv) ;
		else
	#endif
		opensoundsys_play (argc, argv) ;
#elif defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
	opensoundsys_play (argc, argv) ;
#elif (defined (__MACH__) && defined (__APPLE__))
	macosx_play (argc, argv) ;
#elif defined HAVE_SNDIO_H
	sndio_play (argc, argv) ;
#elif (defined (sun) && defined (unix))
	solaris_play (argc, argv) ;
#elif (OS_IS_WIN32 == 1)
	win32_play (argc, argv) ;
#elif defined (__BEOS__)
	printf ("This program cannot be compiled on BeOS.\n") ;
	printf ("Instead, compile the file sfplay_beos.cpp.\n") ;
	return 1 ;
#else
	puts ("*** Playing sound not yet supported on this platform.") ;
	puts ("*** Please feel free to submit a patch.") ;
	return 1 ;
#endif

	return 0 ;
} /* main */
Exemplo n.º 4
0
void
audio_play (get_audio_callback_t callback, AUDIO_OUT *audio_out, void *callback_data)
{

	if (callback == NULL)
	{	printf ("Error : bad callback pointer.\n") ;
		return ;
		} ;

	if (audio_out == NULL)
	{	printf ("Error : bad audio_out pointer.\n") ;
		return ;
		} ;

	if (callback_data == NULL)
	{	printf ("Error : bad callback_data pointer.\n") ;
		return ;
		} ;

#if defined (__linux__)
	linux_play (callback, audio_out, callback_data) ;
#elif (defined (__MACH__) && defined (__APPLE__))
	macosx_play (callback, audio_out, callback_data) ;
#elif (defined (sun) && defined (unix))
	solaris_play (callback, audio_out, callback_data) ;
#elif (defined (_WIN32) || defined (WIN32))
	win32_play (callback, audio_out, callback_data) ;
#else
	#warning "*** Playing sound not yet supported on this platform."
	#warning "*** Please feel free to submit a patch."
	printf ("Error : Playing sound not yet supported on this platform.\n") ;
	return ;
#endif

	return ;
} /* audio_play */