summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/audio/vboy.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/audio/vboy.h')
-rw-r--r--src/mame/audio/vboy.h91
1 files changed, 44 insertions, 47 deletions
diff --git a/src/mame/audio/vboy.h b/src/mame/audio/vboy.h
index fce19d5b5b4..72793b66404 100644
--- a/src/mame/audio/vboy.h
+++ b/src/mame/audio/vboy.h
@@ -6,72 +6,33 @@
By Richard Bannister and Gil Pedersen.
MESS device adaptation by R. Belmont
*/
+#ifndef MAME_AUDIO_VBOY_H
+#define MAME_AUDIO_VBOY_H
#pragma once
-#ifndef __VBOY_SND_H__
-#define __VBOY_SND_H__
-
-//**************************************************************************
-// CONSTANTS
-//**************************************************************************
-
-#define AUDIO_FREQ 44100
-#define CHANNELS 4
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_VBOYSND_ADD(_tag) \
- MCFG_DEVICE_ADD(_tag, VBOYSND, AUDIO_FREQ)
+ MCFG_DEVICE_ADD(_tag, VBOYSND, vboysnd_device::AUDIO_FREQ)
#define MCFG_VBOYSND_REPLACE(_tag) \
- MCFG_DEVICE_REPLACE(_tag, VBOYSND, AUDIO_FREQ)
+ MCFG_DEVICE_REPLACE(_tag, VBOYSND, vboysnd_device::AUDIO_FREQ)
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-struct s_snd_channel {
- int8_t playing; // the sound is playing
-
- // state when sound was enabled
- uint32_t env_steptime; // Envelope step time
- uint8_t env0; // Envelope data
- uint8_t env1; // Envelope data
- uint8_t volLeft; // Left output volume
- uint8_t volRight; // Right output volume
- uint8_t sample[580]; // sample to play
- int sample_len; // length of sample
-
- // values that change, as the sample is played
- int offset; // current offset in sample
- int time; // the duration that this sample is to be played
- uint8_t envelope; // Current envelope level (604)
- int env_time; // The duration between envelope decay/grow (608)
-};
-
-struct s_regchan {
- int32_t sINT;
- int32_t sLRV;
- int32_t sFQL;
- int32_t sFQH;
- int32_t sEV0;
- int32_t sEV1;
- int32_t sRAM;
-};
-
-struct s_sreg {
- // Sound registers structure
- s_regchan c[4];
-};
-
// ======================> vboysnd_device
class vboysnd_device : public device_t, public device_sound_interface
{
public:
+ static constexpr unsigned AUDIO_FREQ = 44100;
+
// construction/destruction
vboysnd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -81,6 +42,42 @@ public:
sound_stream *m_stream;
protected:
+ static constexpr unsigned CHANNELS = 4;
+
+ struct s_snd_channel {
+ int8_t playing; // the sound is playing
+
+ // state when sound was enabled
+ uint32_t env_steptime; // Envelope step time
+ uint8_t env0; // Envelope data
+ uint8_t env1; // Envelope data
+ uint8_t volLeft; // Left output volume
+ uint8_t volRight; // Right output volume
+ uint8_t sample[580]; // sample to play
+ int sample_len; // length of sample
+
+ // values that change, as the sample is played
+ int offset; // current offset in sample
+ int time; // the duration that this sample is to be played
+ uint8_t envelope; // Current envelope level (604)
+ int env_time; // The duration between envelope decay/grow (608)
+ };
+
+ struct s_regchan {
+ int32_t sINT;
+ int32_t sLRV;
+ int32_t sFQL;
+ int32_t sFQH;
+ int32_t sEV0;
+ int32_t sEV1;
+ int32_t sRAM;
+ };
+
+ struct s_sreg {
+ // Sound registers structure
+ s_regchan c[4];
+ };
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -100,6 +97,6 @@ protected:
};
// device type definition
-extern const device_type VBOYSND;
+DECLARE_DEVICE_TYPE(VBOYSND, vboysnd_device)
-#endif //__VBOY_SND_H__
+#endif //MAME_AUDIO_VBOY_H