diff options
author | 2019-05-16 09:17:00 +0900 | |
---|---|---|
committer | 2019-05-15 20:17:00 -0400 | |
commit | ab8dbd3db0f69c61140c6c5d61080dcbab268138 (patch) | |
tree | 2116c14b7f5b0aab09eb3493b32da4dfd213544c /src/devices/sound/samples.h | |
parent | 17ff4768526cf5ba9d0c97d0a048afaf05dbc0b5 (diff) |
Partial support for encrypted audio in k573dio (Konami System 573 Digital I/O) (#5055)
* Add support for pcnfrk2m - Percussion Freaks 2nd Mix (GE912 VER. KAA)
* WIP audio for k573dio
* WIP
* Move 3rd party library to 3rdparty folder
* Use MAME's BIT and bitswap
* Fix regression which caused songs to stutter/lag when they should have been read completely in one shot
* Replace gain_to_db switch with equivalent math
Diffstat (limited to 'src/devices/sound/samples.h')
-rw-r--r-- | src/devices/sound/samples.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/devices/sound/samples.h b/src/devices/sound/samples.h index f5f1ca088f0..ea50f51ea30 100644 --- a/src/devices/sound/samples.h +++ b/src/devices/sound/samples.h @@ -26,6 +26,7 @@ DECLARE_DEVICE_TYPE(SAMPLES, samples_device) //************************************************************************** #define SAMPLES_START_CB_MEMBER(_name) void _name() +#define SAMPLES_UPDATE_CB_MEMBER(_name) void _name() // ======================> samples_device @@ -34,6 +35,7 @@ class samples_device : public device_t, { public: typedef device_delegate<void ()> start_cb_delegate; + typedef device_delegate<void ()> update_cb_delegate; // construction/destruction samples_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); @@ -53,13 +55,30 @@ public: set_samples_start_callback(start_cb_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr))); } + // update callback helpers + void set_samples_update_callback(update_cb_delegate callback) { + m_samples_update_cb = callback; + m_samples_update_cb.bind_relative_to(*owner()); + } + + template <class FunctionClass> void set_samples_update_callback(const char *devname, void (FunctionClass::*callback)(), const char *name) + { + set_samples_update_callback(update_cb_delegate(callback, name, devname, static_cast<FunctionClass *>(nullptr))); + } + template <class FunctionClass> void set_samples_update_callback(void (FunctionClass::*callback)(), const char *name) + { + set_samples_update_callback(update_cb_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr))); + } + // getters bool playing(uint8_t channel) const; uint32_t base_frequency(uint8_t channel) const; + uint32_t get_position(uint8_t channel); // start/stop helpers void start(uint8_t channel, uint32_t samplenum, bool loop = false); void start_raw(uint8_t channel, const int16_t *sampledata, uint32_t samples, uint32_t frequency, bool loop = false); + void update_raw(uint8_t channel, const int16_t *sampledata, uint32_t samples, uint32_t frequency, bool loop = false); void pause(uint8_t channel, bool pause = true); void stop(uint8_t channel); void stop_all(); @@ -116,6 +135,7 @@ protected: bool load_samples(); start_cb_delegate m_samples_start_cb; // optional callback + start_cb_delegate m_samples_update_cb; // optional callback // internal state std::vector<channel_t> m_channel; |