rink.nu / projects / musixbox / changeset 313:98411bdf3103
Implement resource 'tone:' as a x Hz tone default tip
authorRink Springer <rink@rink.nu>
Sun Oct 16 13:40:26 2011 +0200 (4 months ago ago)
changeset 31398411bdf3103
parent 312 9c5507eef4cc
Implement resource 'tone:' as a x Hz tone

This uses the tone generator, which is great for debugging purposes.
     1.1 --- a/lib/core/decoderfactory.cc	Sun Oct 09 21:09:06 2011 +0200
     1.2 +++ b/lib/core/decoderfactory.cc	Sun Oct 16 13:40:26 2011 +0200
     1.3 @@ -2,6 +2,7 @@
     1.4  #include <string.h>
     1.5  #include "config.h"
     1.6  #include "decoderfactory.h"
     1.7 +#include "core/decode_tone.h"
     1.8  #ifdef WITH_MAD
     1.9  #include "core/decode_mp3.h"
    1.10  #endif
    1.11 @@ -52,6 +53,19 @@
    1.12  	/* Initially, nothing has been constructed yet */
    1.13  	*input = NULL; *decoder = NULL; *info = NULL;
    1.14  
    1.15 +	/*
    1.16 +	 * If the resource starts with 'tone:', assume the tone generator is to be
    1.17 +	 * used.
    1.18 +	 */
    1.19 +	if (resource.find("tone:") == 0) {
    1.20 +		float tone = atof(resource.c_str() + 5);
    1.21 +		if (tone > 0.0f) {
    1.22 +			*decoder = new DecoderTone(player, NULL, output, visualizer);
    1.23 +			(dynamic_cast<DecoderTone*>(*decoder))->setFrequency(tone);
    1.24 +			return;
    1.25 +		}
    1.26 +	}
    1.27 +
    1.28  #ifdef WITH_CURL
    1.29  	/*
    1.30  	 * If we find :// in the filename and CURL is available, assume we
Powered by FreeBSD, PostgreSQL and Perl
© 2001 - 2011 Rink Springer