wavelength 1.0.0
Loading...
Searching...
No Matches
mutevocalspacket.h
Go to the documentation of this file.
1#pragma once
2
4#include "os/mem.h"
5
13
21public:
28 ~MuteVocalsPacket() override = default;
29
35 MuteVocalsPacket() : ExternalPacket(kFlagGuaranteed), mSection(-1), mTrack(-1), mMute(0) {
36 }
37
45 static Message *New();
46
53 void *operator new(size_t nSize) {
54 return PoolMemAlloc(static_cast<int>(nSize), "MuteVocalsPacket", 0);
55 }
56
62 void operator delete(void *pBlock) {
63 PoolMemFree(pBlock);
64 }
65
73 Message *Clone() override {
74 return new MuteVocalsPacket(*this);
75 }
76
84 int Type() override {
86 }
87
95 const char *GetName() const override {
96 return "MuteVocalsPacket";
97 }
98
106 void PrintExtra(PrnStream &stream) const override;
107
118 void saveGuts(BinStream &stream) const override;
119
127 void restoreGuts(BinStream &stream) override;
128
130 int GetMute() const {
131 return mMute;
132 }
133
135 void SetMute(int nMute) {
136 mMute = nMute;
137 }
138
140 int GetSection() const {
141 return mSection;
142 }
143
145 void SetSection(int nSection) {
146 mSection = nSection;
147 }
148
150 int GetTrack() const {
151 return mTrack;
152 }
153
155 void SetTrack(int nTrack) {
156 mTrack = nTrack;
157 }
158
159private:
160 int mSection;
161 int mTrack;
162 int mMute;
163};
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
ExternalPacket(unsigned char nFlags=0, int nReceiver=kAllPeers)
Construct a packet from an unset sender.
Definition externalpacket.h:21
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
int Type() override
Report this packet's registered identity.
Definition mutevocalspacket.h:84
int GetTrack() const
Definition mutevocalspacket.h:150
Message * Clone() override
Produce a heap copy of this packet.
Definition mutevocalspacket.h:73
void SetTrack(int nTrack)
Definition mutevocalspacket.h:155
void SetSection(int nSection)
Definition mutevocalspacket.h:145
const char * GetName() const override
Report this packet's class name.
Definition mutevocalspacket.h:95
MuteVocalsPacket()
Construct a packet with no section and no track.
Definition mutevocalspacket.h:35
~MuteVocalsPacket() override=default
Destroy the object.
void saveGuts(BinStream &stream) const override
Write the section, the track, and the mute state packed into one byte.
int GetSection() const
Definition mutevocalspacket.h:140
void SetMute(int nMute)
Definition mutevocalspacket.h:135
static Message * New()
Produce a default-constructed packet on the heap.
int GetMute() const
Definition mutevocalspacket.h:130
void PrintExtra(PrnStream &stream) const override
Write the track and the mute state to a diagnostic stream.
void restoreGuts(BinStream &stream) override
Read the byte saveGuts() writes back into the fields.
static constexpr unsigned char kFlagGuaranteed
Bit of mFlags that NetTransport::Send() turns into its guaranteed delivery bit.
Definition packet.h:28
Text output stream.
Definition prnstream.h:16
void * PoolMemAlloc(int nSize, const char *pszTag, int nAlign)
Allocate a block from the pool heaps and bill it to a tag.
void PoolMemFree(void *pBlock)
Return a block PoolMemAlloc() handed out to the pool heap that owns it.
int g_nMuteVocalsPacketType
Identity that MuteVocalsPacket::Type() reports.