Basic_Gb_Apu.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // Gb_Snd_Emu 0.1.4. http://www.slack.net/~ant/libs/
  2. #include "Basic_Gb_Apu.h"
  3. /* Copyright (C) 2003-2005 Shay Green. This module is free software; you
  4. can redistribute it and/or modify it under the terms of the GNU Lesser
  5. General Public License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version. This
  7. module is distributed in the hope that it will be useful, but WITHOUT ANY
  8. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
  10. more details. You should have received a copy of the GNU Lesser General
  11. Public License along with this module; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  13. blip_time_t const frame_length = 70224;
  14. Basic_Gb_Apu::Basic_Gb_Apu()
  15. {
  16. time = 0;
  17. }
  18. Basic_Gb_Apu::~Basic_Gb_Apu()
  19. {
  20. }
  21. blargg_err_t Basic_Gb_Apu::set_sample_rate( long rate )
  22. {
  23. apu.output( buf.center(), buf.left(), buf.right() );
  24. buf.clock_rate( 4194304 );
  25. return buf.set_sample_rate( rate );
  26. }
  27. void Basic_Gb_Apu::write_register( blip_time_t addr, int data )
  28. {
  29. apu.write_register( clock(), addr, data );
  30. }
  31. int Basic_Gb_Apu::read_register( blip_time_t addr )
  32. {
  33. return apu.read_register( clock(), addr );
  34. }
  35. void Basic_Gb_Apu::end_frame()
  36. {
  37. time = 0;
  38. apu.end_frame( frame_length );
  39. buf.end_frame( frame_length );
  40. }
  41. long Basic_Gb_Apu::samples_avail() const
  42. {
  43. return buf.samples_avail();
  44. }
  45. long Basic_Gb_Apu::read_samples( sample_t* out, long count )
  46. {
  47. return buf.read_samples( out, count );
  48. }
  49. //added by 589 --->
  50. void Basic_Gb_Apu::reset()
  51. {
  52. apu.reset();
  53. }
  54. void Basic_Gb_Apu::treble_eq( const blip_eq_t& eq )
  55. {
  56. apu.treble_eq( eq );
  57. }
  58. void Basic_Gb_Apu::bass_freq( int bf )
  59. {
  60. buf.bass_freq( bf );
  61. }
  62. // <---