Mercurial > spc_convert
diff snes_spc/spc.cpp @ 0:e38dacceb958
initial import
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 21 Oct 2011 05:53:11 -0700 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/snes_spc/spc.cpp Fri Oct 21 05:53:11 2011 -0700 1.3 @@ -0,0 +1,73 @@ 1.4 +// snes_spc 0.9.0. http://www.slack.net/~ant/ 1.5 + 1.6 +#include "spc.h" 1.7 + 1.8 +#include "SNES_SPC.h" 1.9 +#include "SPC_Filter.h" 1.10 + 1.11 +/* Copyright (C) 2004-2007 Shay Green. This module is free software; you 1.12 +can redistribute it and/or modify it under the terms of the GNU Lesser 1.13 +General Public License as published by the Free Software Foundation; either 1.14 +version 2.1 of the License, or (at your option) any later version. This 1.15 +module is distributed in the hope that it will be useful, but WITHOUT ANY 1.16 +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 1.17 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 1.18 +details. You should have received a copy of the GNU Lesser General Public 1.19 +License along with this module; if not, write to the Free Software Foundation, 1.20 +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ 1.21 + 1.22 +#include "blargg_source.h" 1.23 + 1.24 +SNES_SPC* spc_new( void ) 1.25 +{ 1.26 + // be sure constants match 1.27 + assert( spc_sample_rate == (int) SNES_SPC::sample_rate ); 1.28 + assert( spc_rom_size == (int) SNES_SPC::rom_size ); 1.29 + assert( spc_clock_rate == (int) SNES_SPC::clock_rate ); 1.30 + assert( spc_clocks_per_sample == (int) SNES_SPC::clocks_per_sample ); 1.31 + assert( spc_port_count == (int) SNES_SPC::port_count ); 1.32 + assert( spc_voice_count == (int) SNES_SPC::voice_count ); 1.33 + assert( spc_tempo_unit == (int) SNES_SPC::tempo_unit ); 1.34 + assert( spc_file_size == (int) SNES_SPC::spc_file_size ); 1.35 + #if !SPC_NO_COPY_STATE_FUNCS 1.36 + assert( spc_state_size == (int) SNES_SPC::state_size ); 1.37 + #endif 1.38 + 1.39 + SNES_SPC* s = new SNES_SPC; 1.40 + if ( s && s->init() ) 1.41 + { 1.42 + delete s; 1.43 + s = 0; 1.44 + } 1.45 + return s; 1.46 +} 1.47 + 1.48 +void spc_delete ( SNES_SPC* s ) { delete s; } 1.49 +void spc_init_rom ( SNES_SPC* s, unsigned char const r [64] ) { s->init_rom( r ); } 1.50 +void spc_set_output ( SNES_SPC* s, spc_sample_t* p, int n ) { s->set_output( p, n ); } 1.51 +int spc_sample_count ( SNES_SPC const* s ) { return s->sample_count(); } 1.52 +void spc_reset ( SNES_SPC* s ) { s->reset(); } 1.53 +void spc_soft_reset ( SNES_SPC* s ) { s->soft_reset(); } 1.54 +int spc_read_port ( SNES_SPC* s, spc_time_t t, int p ) { return s->read_port( t, p ); } 1.55 +void spc_write_port ( SNES_SPC* s, spc_time_t t, int p, int d ) { s->write_port( t, p, d ); } 1.56 +void spc_end_frame ( SNES_SPC* s, spc_time_t t ) { s->end_frame( t ); } 1.57 +void spc_mute_voices ( SNES_SPC* s, int mask ) { s->mute_voices( mask ); } 1.58 +void spc_disable_surround( SNES_SPC* s, int disable ) { s->disable_surround( disable ); } 1.59 +void spc_set_tempo ( SNES_SPC* s, int tempo ) { s->set_tempo( tempo ); } 1.60 +spc_err_t spc_load_spc ( SNES_SPC* s, void const* p, long n ) { return s->load_spc( p, n ); } 1.61 +void spc_clear_echo ( SNES_SPC* s ) { s->clear_echo(); } 1.62 +spc_err_t spc_play ( SNES_SPC* s, int count, short* out ) { return s->play( count, out ); } 1.63 +spc_err_t spc_skip ( SNES_SPC* s, int count ) { return s->skip( count ); } 1.64 +#if !SPC_NO_COPY_STATE_FUNCS 1.65 +void spc_copy_state ( SNES_SPC* s, unsigned char** p, spc_copy_func_t f ) { s->copy_state( p, f ); } 1.66 +void spc_init_header ( void* spc_out ) { SNES_SPC::init_header( spc_out ); } 1.67 +void spc_save_spc ( SNES_SPC* s, void* spc_out ) { s->save_spc( spc_out ); } 1.68 +int spc_check_kon ( SNES_SPC* s ) { return s->check_kon(); } 1.69 +#endif 1.70 + 1.71 +SPC_Filter* spc_filter_new( void ) { return new SPC_Filter; } 1.72 +void spc_filter_delete( SPC_Filter* f ) { delete f; } 1.73 +void spc_filter_run( SPC_Filter* f, spc_sample_t* p, int s ) { f->run( p, s ); } 1.74 +void spc_filter_clear( SPC_Filter* f ) { f->clear(); } 1.75 +void spc_filter_set_gain( SPC_Filter* f, int gain ) { f->set_gain( gain ); } 1.76 +void spc_filter_set_bass( SPC_Filter* f, int bass ) { f->set_bass( bass ); }