annotate snes_spc/spc.cpp @ 9:477c36226481 tip

added old scripts for historical interest.
author Robert McIntyre <rlm@mit.edu>
date Fri, 21 Oct 2011 07:46:18 -0700
parents e38dacceb958
children
rev   line source
rlm@0 1 // snes_spc 0.9.0. http://www.slack.net/~ant/
rlm@0 2
rlm@0 3 #include "spc.h"
rlm@0 4
rlm@0 5 #include "SNES_SPC.h"
rlm@0 6 #include "SPC_Filter.h"
rlm@0 7
rlm@0 8 /* Copyright (C) 2004-2007 Shay Green. This module is free software; you
rlm@0 9 can redistribute it and/or modify it under the terms of the GNU Lesser
rlm@0 10 General Public License as published by the Free Software Foundation; either
rlm@0 11 version 2.1 of the License, or (at your option) any later version. This
rlm@0 12 module is distributed in the hope that it will be useful, but WITHOUT ANY
rlm@0 13 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
rlm@0 14 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
rlm@0 15 details. You should have received a copy of the GNU Lesser General Public
rlm@0 16 License along with this module; if not, write to the Free Software Foundation,
rlm@0 17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
rlm@0 18
rlm@0 19 #include "blargg_source.h"
rlm@0 20
rlm@0 21 SNES_SPC* spc_new( void )
rlm@0 22 {
rlm@0 23 // be sure constants match
rlm@0 24 assert( spc_sample_rate == (int) SNES_SPC::sample_rate );
rlm@0 25 assert( spc_rom_size == (int) SNES_SPC::rom_size );
rlm@0 26 assert( spc_clock_rate == (int) SNES_SPC::clock_rate );
rlm@0 27 assert( spc_clocks_per_sample == (int) SNES_SPC::clocks_per_sample );
rlm@0 28 assert( spc_port_count == (int) SNES_SPC::port_count );
rlm@0 29 assert( spc_voice_count == (int) SNES_SPC::voice_count );
rlm@0 30 assert( spc_tempo_unit == (int) SNES_SPC::tempo_unit );
rlm@0 31 assert( spc_file_size == (int) SNES_SPC::spc_file_size );
rlm@0 32 #if !SPC_NO_COPY_STATE_FUNCS
rlm@0 33 assert( spc_state_size == (int) SNES_SPC::state_size );
rlm@0 34 #endif
rlm@0 35
rlm@0 36 SNES_SPC* s = new SNES_SPC;
rlm@0 37 if ( s && s->init() )
rlm@0 38 {
rlm@0 39 delete s;
rlm@0 40 s = 0;
rlm@0 41 }
rlm@0 42 return s;
rlm@0 43 }
rlm@0 44
rlm@0 45 void spc_delete ( SNES_SPC* s ) { delete s; }
rlm@0 46 void spc_init_rom ( SNES_SPC* s, unsigned char const r [64] ) { s->init_rom( r ); }
rlm@0 47 void spc_set_output ( SNES_SPC* s, spc_sample_t* p, int n ) { s->set_output( p, n ); }
rlm@0 48 int spc_sample_count ( SNES_SPC const* s ) { return s->sample_count(); }
rlm@0 49 void spc_reset ( SNES_SPC* s ) { s->reset(); }
rlm@0 50 void spc_soft_reset ( SNES_SPC* s ) { s->soft_reset(); }
rlm@0 51 int spc_read_port ( SNES_SPC* s, spc_time_t t, int p ) { return s->read_port( t, p ); }
rlm@0 52 void spc_write_port ( SNES_SPC* s, spc_time_t t, int p, int d ) { s->write_port( t, p, d ); }
rlm@0 53 void spc_end_frame ( SNES_SPC* s, spc_time_t t ) { s->end_frame( t ); }
rlm@0 54 void spc_mute_voices ( SNES_SPC* s, int mask ) { s->mute_voices( mask ); }
rlm@0 55 void spc_disable_surround( SNES_SPC* s, int disable ) { s->disable_surround( disable ); }
rlm@0 56 void spc_set_tempo ( SNES_SPC* s, int tempo ) { s->set_tempo( tempo ); }
rlm@0 57 spc_err_t spc_load_spc ( SNES_SPC* s, void const* p, long n ) { return s->load_spc( p, n ); }
rlm@0 58 void spc_clear_echo ( SNES_SPC* s ) { s->clear_echo(); }
rlm@0 59 spc_err_t spc_play ( SNES_SPC* s, int count, short* out ) { return s->play( count, out ); }
rlm@0 60 spc_err_t spc_skip ( SNES_SPC* s, int count ) { return s->skip( count ); }
rlm@0 61 #if !SPC_NO_COPY_STATE_FUNCS
rlm@0 62 void spc_copy_state ( SNES_SPC* s, unsigned char** p, spc_copy_func_t f ) { s->copy_state( p, f ); }
rlm@0 63 void spc_init_header ( void* spc_out ) { SNES_SPC::init_header( spc_out ); }
rlm@0 64 void spc_save_spc ( SNES_SPC* s, void* spc_out ) { s->save_spc( spc_out ); }
rlm@0 65 int spc_check_kon ( SNES_SPC* s ) { return s->check_kon(); }
rlm@0 66 #endif
rlm@0 67
rlm@0 68 SPC_Filter* spc_filter_new( void ) { return new SPC_Filter; }
rlm@0 69 void spc_filter_delete( SPC_Filter* f ) { delete f; }
rlm@0 70 void spc_filter_run( SPC_Filter* f, spc_sample_t* p, int s ) { f->run( p, s ); }
rlm@0 71 void spc_filter_clear( SPC_Filter* f ) { f->clear(); }
rlm@0 72 void spc_filter_set_gain( SPC_Filter* f, int gain ) { f->set_gain( gain ); }
rlm@0 73 void spc_filter_set_bass( SPC_Filter* f, int bass ) { f->set_bass( bass ); }