Mercurial > audlegacy
changeset 479:0b9507985f0d trunk
[svn] Use the VFS subsystem and delete the unused demo source.
author | chainsaw |
---|---|
date | Sat, 21 Jan 2006 06:32:50 -0800 |
parents | 5064517c685c |
children | c1dfb4b13be8 |
files | Plugins/Input/console/Audacious_Driver.cpp Plugins/Input/console/Fir_Resampler.cpp Plugins/Input/console/Gb_Apu.cpp Plugins/Input/console/Gbs_Emu.cpp Plugins/Input/console/Gbs_Emu.h Plugins/Input/console/Gym_Emu.cpp Plugins/Input/console/Gym_Emu.h Plugins/Input/console/Nsf_Emu.cpp Plugins/Input/console/Nsf_Emu.h Plugins/Input/console/Spc_Emu.cpp Plugins/Input/console/Spc_Emu.h Plugins/Input/console/Vgm_Emu.cpp Plugins/Input/console/Vgm_Emu.h Plugins/Input/console/abstract_file.cpp Plugins/Input/console/abstract_file.h Plugins/Input/console/demo.cpp Plugins/Input/console/demo_effects.cpp Plugins/Input/console/demo_panning.cpp Plugins/Input/console/ym2612.cpp |
diffstat | 19 files changed, 171 insertions(+), 312 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Input/console/Audacious_Driver.cpp Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Audacious_Driver.cpp Sat Jan 21 06:32:50 2006 -0800 @@ -26,7 +26,6 @@ struct AudaciousConsoleConfig audcfg = { 180, FALSE, 32000 }; #include <cstring> -#include <stdio.h> #include <cstdlib> #include <cctype> @@ -130,7 +129,7 @@ static gchar *get_title_nsf(gchar *filename) { gchar *title; - Emu_Std_Reader reader; + Nsf_Reader reader; Nsf_Emu::header_t header; reader.open(filename); @@ -163,7 +162,7 @@ static gchar *get_title_gbs(gchar *filename) { gchar *title; - Emu_Std_Reader reader; + Gbs_Reader reader; Gbs_Emu::header_t header; reader.open(filename); @@ -196,7 +195,7 @@ static gchar *get_title_gym(gchar *filename) { gchar *title; - Emu_Std_Reader reader; + Gym_Reader reader; Gym_Emu::header_t header; reader.open(filename); @@ -316,7 +315,7 @@ static void play_file_nsf(char *filename) { gchar *name; - Emu_Std_Reader reader; + Nsf_Reader reader; Nsf_Emu::header_t header; gint samplerate; @@ -357,7 +356,7 @@ static void play_file_gbs(char *filename) { gchar *name; - Emu_Std_Reader reader; + Gbs_Reader reader; Gbs_Emu::header_t header; gint samplerate; @@ -398,7 +397,7 @@ static void play_file_gym(char *filename) { gchar *name; - Emu_Std_Reader reader; + Gym_Reader reader; Gym_Emu::header_t header; gint samplerate; @@ -442,7 +441,7 @@ static void play_file_vgm(char *filename) { gchar *name; - Emu_Std_Reader reader; + Vgm_Reader reader; Vgm_Emu::header_t header; gint samplerate;
--- a/Plugins/Input/console/Fir_Resampler.cpp Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Fir_Resampler.cpp Sat Jan 21 06:32:50 2006 -0800 @@ -3,7 +3,7 @@ #include "Fir_Resampler.h" -#include <stdio.h> +#include "libaudacious/vfs.h" #include <string.h> #include <stdlib.h> #include <math.h>
--- a/Plugins/Input/console/Gb_Apu.cpp Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Gb_Apu.cpp Sat Jan 21 06:32:50 2006 -0800 @@ -3,7 +3,7 @@ #include "Gb_Apu.h" -#include <stdio.h> +#include "libaudacious/vfs.h" #include <string.h> /* Copyright (C) 2003-2005 Shay Green. This module is free software; you
--- a/Plugins/Input/console/Gbs_Emu.cpp Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Gbs_Emu.cpp Sat Jan 21 06:32:50 2006 -0800 @@ -350,3 +350,25 @@ return cpu_time; } +Gbs_Reader::Gbs_Reader() : file( NULL ) { +} + +Gbs_Reader::~Gbs_Reader() { + close(); +} + +blargg_err_t Gbs_Reader::read_head(Gbs_Emu::header_t *header) { + vfs_fread(&header->tag, 1, 3,file); + vfs_fread(&header->vers, 1, 1,file); + vfs_fread(&header->track_count,1, 1,file); + vfs_fread(&header->first_track,1, 1,file); + vfs_fread(&header->load_addr, 1, 2,file); + vfs_fread(&header->init_addr, 1, 2,file); + vfs_fread(&header->play_addr, 1, 2,file); + vfs_fread(&header->stack_ptr, 1, 2,file); + vfs_fread(&header->timer_modulo,1, 1,file); + vfs_fread(&header->timer_mode, 1, 2,file); + vfs_fread(&header->game, 1,32,file); + vfs_fread(&header->author, 1,32,file); + vfs_fread(&header->copyright, 1,32,file); +}
--- a/Plugins/Input/console/Gbs_Emu.h Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Gbs_Emu.h Sat Jan 21 06:32:50 2006 -0800 @@ -91,5 +91,15 @@ static void write_ram( Gbs_Emu*, gb_addr_t, int ); }; +class Gbs_Reader : public Std_File_Reader { + VFSFile* file; +public: + Gbs_Reader(); + ~Gbs_Reader(); + + // Custom reader for Gbs headers [tempfix] + blargg_err_t read_head( Gbs_Emu::header_t* ); +}; + #endif
--- a/Plugins/Input/console/Gym_Emu.cpp Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Gym_Emu.cpp Sat Jan 21 06:32:50 2006 -0800 @@ -439,3 +439,21 @@ sn.end( blip_buf ); } + +Gym_Reader::Gym_Reader() : file( NULL ) { +} + +Gym_Reader::~Gym_Reader() { + close(); +} + +blargg_err_t Gym_Reader::read_head(Gym_Emu::header_t *header) { + vfs_fread(&header->tag, 1, 4,file); + vfs_fread(&header->song, 1, 32,file); + vfs_fread(&header->game, 1, 32,file); + vfs_fread(&header->emulator, 1, 32,file); + vfs_fread(&header->dumper, 1, 32,file); + vfs_fread(&header->comment, 1,256,file); + vfs_fread(&header->loop, 1, 4,file); + vfs_fread(&header->packed, 1, 4,file); +}
--- a/Plugins/Input/console/Gym_Emu.h Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Gym_Emu.h Sat Jan 21 06:32:50 2006 -0800 @@ -97,5 +97,15 @@ void unload(); }; +class Gym_Reader : public Std_File_Reader { + VFSFile* file; +public: + Gym_Reader(); + ~Gym_Reader(); + + // Custom reader for SPC headers [tempfix] + blargg_err_t read_head( Gym_Emu::header_t* ); +}; + #endif
--- a/Plugins/Input/console/Nsf_Emu.cpp Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Nsf_Emu.cpp Sat Jan 21 06:32:50 2006 -0800 @@ -4,7 +4,7 @@ #include "Nsf_Emu.h" #include <string.h> -#include <stdio.h> +#include "libaudacious/vfs.h" #include "blargg_endian.h" @@ -471,3 +471,28 @@ return duration; } +Nsf_Reader::Nsf_Reader() : file( NULL ) { +} + +Nsf_Reader::~Nsf_Reader() { + close(); +} + +blargg_err_t Nsf_Reader::read_head(Nsf_Emu::header_t *header) { + vfs_fread(&header->tag, 1, 5,file); + vfs_fread(&header->vers, 1, 1,file); + vfs_fread(&header->track_count, 1, 1,file); + vfs_fread(&header->first_track, 1, 1,file); + vfs_fread(&header->load_addr, 1, 2,file); + vfs_fread(&header->init_addr, 1, 2,file); + vfs_fread(&header->play_addr, 1, 2,file); + vfs_fread(&header->game, 1,32,file); + vfs_fread(&header->author, 1,32,file); + vfs_fread(&header->copyright, 1,32,file); + vfs_fread(&header->ntsc_speed, 1, 2,file); + vfs_fread(&header->banks, 1, 3,file); + vfs_fread(&header->pal_speed, 1, 2,file); + vfs_fread(&header->speed_flags, 1, 1,file); + vfs_fread(&header->chip_flags, 1, 1,file); + vfs_fread(&header->unused, 1, 2,file); +}
--- a/Plugins/Input/console/Nsf_Emu.h Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Nsf_Emu.h Sat Jan 21 06:32:50 2006 -0800 @@ -123,5 +123,14 @@ friend class Nsf_Remote_Emu; // hack }; +class Nsf_Reader : public Std_File_Reader { + VFSFile* file; +public: + Nsf_Reader(); + ~Nsf_Reader(); + + // Custom reader for SPC headers [tempfix] + blargg_err_t read_head( Nsf_Emu::header_t* ); +}; #endif
--- a/Plugins/Input/console/Spc_Emu.cpp Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Spc_Emu.cpp Sat Jan 21 06:32:50 2006 -0800 @@ -19,12 +19,6 @@ #include BLARGG_SOURCE_BEGIN -#ifndef RAISE_ERROR - #define RAISE_ERROR( str ) return str -#endif - -typedef Spc_Reader::error_t error_t; - Spc_Emu::Spc_Emu() { resample_ratio = 1.0; @@ -125,66 +119,26 @@ close(); } -error_t Spc_Reader::open( const char* path ) -{ - file = fopen( path, "rb" ); - if ( !file ) - RAISE_ERROR( "Couldn't open file" ); - return NULL; -} - blargg_err_t Spc_Reader::read_head(Spc_Emu::header_t *header) { - fread(&header->tag, 1,35,file); - fread(&header->format, 1, 1,file); - fread(&header->version, 1, 1,file); - fread(&header->pc, 1, 2,file); - fread(&header->a, 1, 1,file); - fread(&header->x, 1, 1,file); - fread(&header->y, 1, 1,file); - fread(&header->psw, 1, 1,file); - fread(&header->sp, 1, 1,file); - fread(&header->unused, 1, 2,file); - fread(&header->song, 1,32,file); - fread(&header->game, 1,32,file); - fread(&header->dumper, 1,16,file); - fread(&header->comment, 1,32,file); - fread(&header->date, 1,11,file); - fread(&header->len_secs,1, 3,file); - fread(&header->fade_msec,1,5,file); - fread(&header->author, 1,32,file); - fread(&header->mute_mask,1,1,file); - fread(&header->emulator,1, 1,file); - fread(&header->unused2, 1,45,file); + vfs_fread(&header->tag, 1,35,file); + vfs_fread(&header->format, 1, 1,file); + vfs_fread(&header->version, 1, 1,file); + vfs_fread(&header->pc, 1, 2,file); + vfs_fread(&header->a, 1, 1,file); + vfs_fread(&header->x, 1, 1,file); + vfs_fread(&header->y, 1, 1,file); + vfs_fread(&header->psw, 1, 1,file); + vfs_fread(&header->sp, 1, 1,file); + vfs_fread(&header->unused, 1, 2,file); + vfs_fread(&header->song, 1,32,file); + vfs_fread(&header->game, 1,32,file); + vfs_fread(&header->dumper, 1,16,file); + vfs_fread(&header->comment, 1,32,file); + vfs_fread(&header->date, 1,11,file); + vfs_fread(&header->len_secs,1, 3,file); + vfs_fread(&header->fade_msec,1,5,file); + vfs_fread(&header->author, 1,32,file); + vfs_fread(&header->mute_mask,1,1,file); + vfs_fread(&header->emulator,1, 1,file); + vfs_fread(&header->unused2, 1,45,file); } - -long Spc_Reader::size() const -{ - long pos = tell(); - fseek( file, 0, SEEK_END ); - long result = tell(); - fseek( file, pos, SEEK_SET ); - return result; -} - -long Spc_Reader::read_avail( void* p, long s ) { - return fread( p, 1, s, file ); -} - -long Spc_Reader::tell() const { - return ftell( file ); -} - -error_t Spc_Reader::seek( long n ) -{ - if ( fseek( file, n, SEEK_SET ) != 0 ) - RAISE_ERROR( "Error seeking in file" ); - return NULL; -} - -void Spc_Reader::close() -{ - if ( file ) { - fclose( file ); - file = NULL; - } -}
--- a/Plugins/Input/console/Spc_Emu.h Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Spc_Emu.h Sat Jan 21 06:32:50 2006 -0800 @@ -10,9 +10,6 @@ #include "Music_Emu.h" #include "Snes_Spc.h" -#include "blargg_common.h" -#include "abstract_file.h" - class Spc_Emu : public Music_Emu { public: Spc_Emu(); @@ -80,24 +77,14 @@ apu.mute_voices( m ); } -class Spc_Reader : public File_Reader { - FILE* file; +class Spc_Reader : public Std_File_Reader { + VFSFile* file; public: Spc_Reader(); ~Spc_Reader(); - error_t open( const char* ); - // Custom reader for SPC headers [tempfix] blargg_err_t read_head( Spc_Emu::header_t* ); - - long size() const; - long read_avail( void*, long ); - - long tell() const; - error_t seek( long ); - - void close(); }; #endif
--- a/Plugins/Input/console/Vgm_Emu.cpp Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Vgm_Emu.cpp Sat Jan 21 06:32:50 2006 -0800 @@ -284,3 +284,23 @@ return end_time; } +Vgm_Reader::Vgm_Reader() : file( NULL ) { +} + +Vgm_Reader::~Vgm_Reader() { + close(); +} + +blargg_err_t Vgm_Reader::read_head(Vgm_Emu::header_t *header) { + vfs_fread(&header->tag, 1, 4,file); + vfs_fread(&header->data_size, 1, 4,file); + vfs_fread(&header->vers, 1, 4,file); + vfs_fread(&header->psg_rate, 1, 4,file); + vfs_fread(&header->fm_rate, 1, 4,file); + vfs_fread(&header->g3d_offset, 1, 4,file); + vfs_fread(&header->sample_count,1, 4,file); + vfs_fread(&header->loop_offset, 1, 4,file); + vfs_fread(&header->loop_duration,1,4,file); + vfs_fread(&header->frame_rate, 1, 4,file); + vfs_fread(&header->unused, 1,0x18,file); +}
--- a/Plugins/Input/console/Vgm_Emu.h Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/Vgm_Emu.h Sat Jan 21 06:32:50 2006 -0800 @@ -71,5 +71,15 @@ void unload(); }; +class Vgm_Reader : public Std_File_Reader { + VFSFile* file; +public: + Vgm_Reader(); + ~Vgm_Reader(); + + // Custom reader for SPC headers [tempfix] + blargg_err_t read_head( Vgm_Emu::header_t* ); +}; + #endif
--- a/Plugins/Input/console/abstract_file.cpp Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/abstract_file.cpp Sat Jan 21 06:32:50 2006 -0800 @@ -137,7 +137,7 @@ error_t Std_File_Reader::open( const char* path ) { - file = fopen( path, "rb" ); + file = vfs_fopen( path, "rb" ); if ( !file ) RAISE_ERROR( "Couldn't open file" ); return NULL; @@ -146,23 +146,23 @@ long Std_File_Reader::size() const { long pos = tell(); - fseek( file, 0, SEEK_END ); + vfs_fseek( file, 0, SEEK_END ); long result = tell(); - fseek( file, pos, SEEK_SET ); + vfs_fseek( file, pos, SEEK_SET ); return result; } long Std_File_Reader::read_avail( void* p, long s ) { - return fread( p, 1, s, file ); + return vfs_fread( p, 1, s, file ); } long Std_File_Reader::tell() const { - return ftell( file ); + return vfs_ftell( file ); } error_t Std_File_Reader::seek( long n ) { - if ( fseek( file, n, SEEK_SET ) != 0 ) + if ( vfs_fseek( file, n, SEEK_SET ) != 0 ) RAISE_ERROR( "Error seeking in file" ); return NULL; } @@ -170,7 +170,7 @@ void Std_File_Reader::close() { if ( file ) { - fclose( file ); + vfs_fclose( file ); file = NULL; } } @@ -186,7 +186,7 @@ error_t Std_File_Writer::open( const char* path ) { - file = fopen( path, "wb" ); + file = vfs_fopen( path, "wb" ); if ( !file ) RAISE_ERROR( "Couldn't open file for writing" ); @@ -198,7 +198,7 @@ error_t Std_File_Writer::write( const void* p, long s ) { - long result = fwrite( p, 1, s, file ); + long result = vfs_fwrite( p, 1, s, file ); if ( result != s ) RAISE_ERROR( "Couldn't write to file" ); return NULL; @@ -207,7 +207,7 @@ void Std_File_Writer::close() { if ( file ) { - fclose( file ); + vfs_fclose( file ); file = NULL; } }
--- a/Plugins/Input/console/abstract_file.h Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/abstract_file.h Sat Jan 21 06:32:50 2006 -0800 @@ -6,7 +6,7 @@ #ifndef ABSTRACT_FILE_H #define ABSTRACT_FILE_H -#include <stdio.h> +#include "libaudacious/vfs.h" // to do: built-in buffering? @@ -78,17 +78,13 @@ }; class Std_File_Reader : public File_Reader { - FILE* file; - //FILE* owned_file; + VFSFile* file; public: Std_File_Reader(); ~Std_File_Reader(); error_t open( const char* ); - // Forward read requests to file. Caller must close file later. - //void forward( FILE* ); - long size() const; long read_avail( void*, long ); @@ -118,7 +114,7 @@ }; class Std_File_Writer : public Data_Writer { - FILE* file; + VFSFile* file; public: Std_File_Writer(); ~Std_File_Writer();
--- a/Plugins/Input/console/demo.cpp Fri Jan 20 07:17:03 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ - -// Play "test.nsf" using Nsf_Emu and record to "out.wav". - -#include "Nsf_Emu.h" -#include "Wave_Writer.hpp" - -#include <stdlib.h> -#include <stdio.h> - -static void exit_if_error( const char* str ) -{ - if ( str ) { - fprintf( stderr, "Error: %s\n", str ); - exit( EXIT_FAILURE ); - } -} - -int main() -{ - const long sample_rate = 44100; - - // Prepare emulator - Nsf_Emu* emu = new Nsf_Emu; - if ( !emu ) - exit_if_error( "Out of memory" ); - exit_if_error( emu->init( sample_rate ) ); - - // Load file - Emu_Std_Reader reader; - exit_if_error( reader.open( "test.nsf" ) ); - Nsf_Emu::header_t header; - exit_if_error( reader.read( &header, sizeof header ) ); - exit_if_error( emu->load( header, reader ) ); - - // Print game and song info - printf( "Game : %-32s\n", header.game ? (char*) header.game : "" ); - printf( "Song : %-32s\n", header.song ? (char*) header.song : "" ); - printf( "Author : %-32s\n", header.author ? (char*) header.author : "" ); - printf( "Copyright: %-32s\n", header.copyright ? (char*) header.copyright : "" ); - printf( "Tracks : %d\n", emu->track_count() ); - printf( "\n" ); - - // Record first track for several seconds - exit_if_error( emu->start_track( 0 ) ); - Wave_Writer wave( sample_rate, "out.wav" ); - wave.stereo( true ); - while ( wave.sample_count() < 2 * sample_rate * 10 ) - { - const long buf_size = 1024; // must be even - Music_Emu::sample_t buf [buf_size]; - - // fill buffer - exit_if_error( emu->play( buf_size, buf ) ); - - // write to sound file - wave.write( buf, buf_size ); - } - - delete emu; - - return 0; -} -
--- a/Plugins/Input/console/demo_effects.cpp Fri Jan 20 07:17:03 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ - -// Use Effects_Buffer to add stereo effects while playing "test.gbs" using Gbs_Emu, -// and record to "out.wav". - -#include "Gbs_Emu.h" -#include "Wave_Writer.hpp" -#include "Effects_Buffer.h" - -#include <stdlib.h> -#include <stdio.h> - -static void exit_if_error( const char* str ) -{ - if ( str ) { - fprintf( stderr, "Error: %s\n", str ); - exit( EXIT_FAILURE ); - } -} - -int main() -{ - const long sample_rate = 44100; - - // Create effects buffer with 1/30 second length - Effects_Buffer buf; - exit_if_error( buf.sample_rate( sample_rate, 1000 / 30 ) ); - - // Create emulator and output to effects buffer - Gbs_Emu* emu = new Gbs_Emu; - if ( !emu ) - exit_if_error( "Out of memory" ); - exit_if_error( emu->init( &buf ) ); - - // Load file - Emu_Std_Reader reader; - exit_if_error( reader.open( "test.gbs" ) ); - Gbs_Emu::header_t header; - exit_if_error( reader.read( &header, sizeof header ) ); - exit_if_error( emu->load( header, reader ) ); - - // Configure effects buffer - Effects_Buffer::config_t cfg; - cfg.pan_1 = -0.12; // put first two oscillators slightly off-center - cfg.pan_2 = 0.12; - cfg.reverb_delay = 88; // delays are in milliseconds - cfg.reverb_level = 0.20; // significant reverb - cfg.echo_delay = 61; // echo applies to noise and percussion oscillators - cfg.echo_level = 0.15; - cfg.delay_variance = 18; // left/right delays must differ for stereo effect - cfg.effects_enabled = true; - buf.config( cfg ); - - // Record first track for several seconds - exit_if_error( emu->start_track( 0 ) ); - Wave_Writer wave( sample_rate, "out.wav" ); - wave.stereo( true ); - while ( wave.sample_count() < 2 * sample_rate * 10 ) - { - const long buf_size = 1024; // must be even - Music_Emu::sample_t buf [buf_size]; - - exit_if_error( emu->play( buf_size, buf ) ); - - wave.write( buf, buf_size ); - } - - delete emu; - - return 0; -} -
--- a/Plugins/Input/console/demo_panning.cpp Fri Jan 20 07:17:03 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ - -// Use Panning_Buffer to add left/right panning while playing "test.vgm" using Vgm_Emu, -// and record to "out.wav". - -#include "Vgm_Emu.h" -#include "Wave_Writer.hpp" -#include "Panning_Buffer.h" - -#include <stdlib.h> -#include <stdio.h> - -static void exit_if_error( const char* str ) -{ - if ( str ) { - fprintf( stderr, "Error: %s\n", str ); - exit( EXIT_FAILURE ); - } -} - -int main() -{ - const long sample_rate = 44100; - - // Create panning buffer with 1/30 second length - Panning_Buffer buf; - exit_if_error( buf.sample_rate( sample_rate, 1000 / 30 ) ); - - // Prepare emulator with output set to panning buffer - Vgm_Emu* emu = new Vgm_Emu; - if ( !emu ) - exit_if_error( "Out of memory" ); - exit_if_error( emu->init( &buf ) ); - - // Load file - Emu_Std_Reader reader; - exit_if_error( reader.open( "test.vgm" ) ); - Vgm_Emu::header_t header; - exit_if_error( reader.read( &header, sizeof header ) ); - exit_if_error( emu->load( header, reader ) ); - - // Configure panning buffer - buf.set_pan( 0, 1.40, 0.60 ); // pulse 1 - left - buf.set_pan( 1, 1.00, 1.00 ); // pulse 2 - center - buf.set_pan( 2, 0.40, 1.60 ); // pulse 3 - right - buf.set_pan( 3, 1.00,-1.00 ); // noise - "surround" (phase-inverted left/right) - - // Record first track for several seconds - exit_if_error( emu->start_track( 0 ) ); - Wave_Writer wave( sample_rate, "out.wav" ); - wave.stereo( true ); - while ( wave.sample_count() < 2 * sample_rate * 10 ) - { - const long buf_size = 1234; // can be any size - Music_Emu::sample_t buf [buf_size]; - - // fill buffer - exit_if_error( emu->play( buf_size, buf ) ); - - // write to sound file - wave.write( buf, buf_size ); - } - - delete emu; - - return 0; -} -
--- a/Plugins/Input/console/ym2612.cpp Fri Jan 20 07:17:03 2006 -0800 +++ b/Plugins/Input/console/ym2612.cpp Sat Jan 21 06:32:50 2006 -0800 @@ -4,7 +4,7 @@ #include "ym2612.h" #include <string.h> -#include <stdio.h> +#include "libaudacious/vfs.h" #include <math.h> /* Copyright (C) 2002 Stéphane Dallongeville (gens@consolemul.com) */