upse.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * UPSE: the unix playstation sound emulator.
  3. *
  4. * Filename: upse.h
  5. * Purpose: libupse development header
  6. *
  7. * Copyright (c) 2007 William Pitcock <nenolod@sacredspiral.co.uk>
  8. *
  9. * UPSE is free software, released under the GNU General Public License,
  10. * version 2.
  11. *
  12. * A copy of the GNU General Public License, version 2, is included in
  13. * the UPSE source kit as COPYING.
  14. *
  15. * UPSE is offered without any warranty of any kind, explicit or implicit.
  16. */
  17. #ifndef __UPSE_LIBUPSE_UPSE_H_GUARD
  18. #define __UPSE_LIBUPSE_UPSE_H_GUARD
  19. #include <unistd.h>
  20. //#include <upse-types.h>
  21. typedef struct _upse_psftag
  22. {
  23. struct _upse_psftag *next;
  24. char *key;
  25. char *value;
  26. } upse_psftag_t;
  27. typedef struct
  28. {
  29. u32 length;
  30. u32 stop;
  31. u32 fade;
  32. char *title;
  33. char *artist;
  34. char *game;
  35. char *year;
  36. char *genre;
  37. char *psfby;
  38. char *comment;
  39. char *copyright;
  40. upse_psftag_t *taglist;
  41. } upse_psf_t;
  42. int upse_seek(u32 t);
  43. void upse_stop(void);
  44. void upse_execute(void);
  45. typedef struct
  46. {
  47. void *(*open_impl) (char *path, char *mode);
  48. size_t(*read_impl) (void *ptr, size_t size, size_t nmemb, void *file);
  49. int (*seek_impl) (void *file, long offset, int whence);
  50. int (*close_impl) (void *file);
  51. } upse_iofuncs_t;
  52. upse_psf_t *upse_load(char *path, upse_iofuncs_t * iofuncs);
  53. upse_psf_t *upse_get_psf_metadata(char *path, upse_iofuncs_t * iofuncs);
  54. void upse_free_psf_metadata(upse_psf_t * info);
  55. typedef void (*upse_audio_callback_func_t) (unsigned char *, long, void *);
  56. void upse_set_audio_callback(upse_audio_callback_func_t func, void *user_data);
  57. typedef void (*upse_breakpoint_callback_func_t) (u32, void *);
  58. void upse_set_breakpoint_callback(upse_breakpoint_callback_func_t func, void *user_data, u32 address);
  59. /*
  60. * Set the interpolation mode.
  61. *
  62. * 1: interpolation (like a real PSX/PS2)
  63. * 0: interpolation only on reverb
  64. * (PeOPS/Neill Corlett's model says interpolation always but doesn't do it)
  65. */
  66. void upse_set_interpolation_mode(u32 setting);
  67. /*
  68. * Set a custom interpolation coefficient.
  69. * Implies that interpolation_mode is non-zero.
  70. */
  71. void upse_set_interpolation_coefficient(double setting);
  72. /*
  73. * Enable or disable reverb.
  74. */
  75. void upse_set_reverb_mode(u32 setting);
  76. /*
  77. * Enable or disable non-downsampled reverb. [EXPERIMENTAL]
  78. */
  79. void upse_set_reverb_no_downsample(u32 setting);
  80. /*
  81. * Custom BIOS stuff.
  82. */
  83. int upse_has_custom_bios(void);
  84. const char *upse_get_custom_bios(void);
  85. void upse_set_custom_bios(const char *bios);
  86. #endif