cmRtSysMsg.h,cmRtNet.h/c: Added use of kMsgSetRtId to all non-net-sync msg's sent via network.
This commit is contained in:
parent
48884c3389
commit
6dfbab8037
19
cmRtNet.c
19
cmRtNet.c
@ -734,14 +734,16 @@ cmRtNetRC_t cmRtNetSend( cmRtNetH_t h, cmRtNetEndptH_t epH, const void* msg, uns
|
||||
cmRtNetRC_t rc = kOkNetRC;
|
||||
cmRtNet_t* p = _cmRtNetHandleToPtr(h);
|
||||
cmRtNetEnd_t* ep = (cmRtNetEnd_t*)epH.h;
|
||||
|
||||
|
||||
assert( ep != NULL );
|
||||
|
||||
unsigned dN = sizeof(unsigned) + msgByteCnt;
|
||||
unsigned dN = sizeof(cmRtSysMsgHdr_t) + msgByteCnt;
|
||||
char data[ dN ];
|
||||
unsigned *hdr = (unsigned*)data;
|
||||
hdr[0] = ep->id;
|
||||
memcpy(hdr+1,msg,msgByteCnt);
|
||||
|
||||
cmRtSysMsgHdr_t* hdr = (cmRtSysMsgHdr_t*)data;
|
||||
hdr->rtSubIdx = ep->id;
|
||||
hdr->selId = kMsgSelRtId;
|
||||
memcpy(data+sizeof(cmRtSysMsgHdr_t),msg,msgByteCnt);
|
||||
|
||||
if( cmUdpSendTo(p->udpH, data, dN, &ep->np->sockaddr ) != kOkUdpRC )
|
||||
return cmErrMsg(&p->err,kUdpPortFailNetRC,"Send to node:%s endpt:%s failed.\n",cmStringNullGuard(ep->np->label),cmStringNullGuard(ep->label));
|
||||
@ -812,6 +814,7 @@ void cmRtNetReport( cmRtNetH_t h )
|
||||
//==========================================================================
|
||||
#include "cmThread.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cmThreadH_t thH;
|
||||
@ -819,12 +822,14 @@ typedef struct
|
||||
unsigned msgVal;
|
||||
} _cmRtNetTest_t;
|
||||
|
||||
// This function is called within the context of cmRtNetReceive().
|
||||
void _cmRtNetTestRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
|
||||
{
|
||||
//_cmRtNetTest_t* p = (_cmRtNetTest_t*)cbArg;
|
||||
|
||||
unsigned* hdr = (unsigned*)data;
|
||||
printf("%i %i\n",hdr[0],hdr[1]);
|
||||
cmRtSysMsgHdr_t* hdr = (cmRtSysMsgHdr_t*)data;
|
||||
unsigned i = *(unsigned*)(data + sizeof(cmRtSysMsgHdr_t));
|
||||
printf("%i %i\n",hdr->rtSubIdx,i);
|
||||
|
||||
}
|
||||
|
||||
|
19
cmRtNet.h
19
cmRtNet.h
@ -93,26 +93,26 @@ extern "C" {
|
||||
|
||||
Machine A Machine B
|
||||
================================== ====================================
|
||||
broadcast 'hello' --------------------> create node-A w/ ei=0 -------+
|
||||
broadcast 'hello' ------------------=-> create node-A w/ ei=0 -------+
|
||||
|
|
||||
+<-- create node-B w/ ei=0 <----------- send 'node' <----------------+
|
||||
+<-- create node-B w/ ei=0 <--------=-- send 'node' <----------------+
|
||||
|
|
||||
+--> switch(ei,m_t)
|
||||
| ei < en : send endpt[ei++] ---> create endpt[] on node-A -->+
|
||||
| ei < en : send endpt[ei++] -=--> create endpt[] on node-A -->+
|
||||
| |
|
||||
| ei == en : ++ei,send 'done' -------------------------------->+ |
|
||||
| ei == en : ++ei,send 'done' -=------------------------------->+ |
|
||||
| |
|
||||
| m_t!='done' : send 'done' -------------------------------->+ |
|
||||
| m_t!='done': send 'done' -=------------------------------->+ |
|
||||
| |
|
||||
| (stop) : |
|
||||
| (stop) : |
|
||||
| |
|
||||
| v
|
||||
| switch(ei,m_t)
|
||||
+<-- create endpt[] on node-B <--------- send endpt[ei++] : ei < en
|
||||
+<-- create endpt[] on node-B <---=----- send endpt[ei++] : ei < en
|
||||
|
|
||||
+<--------------------------------------- send 'done',++ei : ei == en
|
||||
+<---------------------------------=----- send 'done',++ei : ei == en
|
||||
|
|
||||
+<--------------------------------------- send 'done' : m_t!= 'done'
|
||||
+<---------------------------------=----- send 'done' : m_t!= 'done'
|
||||
|
||||
: (stop)
|
||||
|
||||
@ -121,6 +121,7 @@ extern "C" {
|
||||
2) 'en' is the count of local endpoints.
|
||||
3) 'm_t' is the msg type (i.e.'hello','node','endpoint','done')
|
||||
of the incoming message.
|
||||
4) The symbol -=- in the flow chart implies a network transmission.
|
||||
|
||||
*/
|
||||
|
||||
|
45
cmRtSysMsg.h
45
cmRtSysMsg.h
@ -5,16 +5,18 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// Reserved DSP message selector id's (second field of all host<->audio system messages)
|
||||
// Reserved DSP message selector id's (second field of all
|
||||
// host<->audio system messages)
|
||||
enum
|
||||
{
|
||||
kMidiMsgArraySelRtId = 1000,
|
||||
kMidiSysExSelRtId,
|
||||
kUiDrvrSelRtId, // cmUiDriverArg_t message to/from the UI driver
|
||||
kUiSelRtId, // cmUiDriverArg-t message from the UI mgr to a client
|
||||
kUiMstrSelRtId, // indicates a cmDspUiHdr_t msg containing master control information for the audio system
|
||||
kStatusSelRtId, // indicates the msg is of type cmRtSysStatus_t
|
||||
kUiSelRtId, // cmUiDriverArg_t message from the UI mgr to a client
|
||||
kUiMstrSelRtId, // indicates a cmDspUiHdr_t msg containing master control information for the audio system
|
||||
kStatusSelRtId, // indicates the msg is of type cmRtSysStatus_t
|
||||
kNetSyncSelRtId, // sent with a cmDspNetMsg_t object
|
||||
kMsgSelRtId, // client defined msg transmitted between threads or network nodes
|
||||
};
|
||||
|
||||
typedef struct
|
||||
@ -46,7 +48,7 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
/// Control id's used to identify the control type of master contols.
|
||||
// Control id's used to identify the control type of master contols.
|
||||
enum
|
||||
{
|
||||
kSliderUiRtId = 0,
|
||||
@ -57,28 +59,29 @@ extern "C" {
|
||||
};
|
||||
|
||||
|
||||
/// Audio sub-system status record - this message can be transmitted to the host at
|
||||
/// periodic intervals. See cmRtSysStatusNotifyEnable().
|
||||
/// When transmitted to the host this record acts as the message header.
|
||||
/// This header is followed by two arrays of doubles containing the input and output meter values
|
||||
/// associated with the input and output audio devices.
|
||||
/// Message Layout: [ rtSubIdx kStatusSelId cmRtSysStatus_t iMeterArray[iMeterCnt] oMeterArray[oMeterCnt] ]
|
||||
// Audio sub-system status record - this message can be transmitted to the host at
|
||||
// periodic intervals. See cmRtSysStatusNotifyEnable().
|
||||
// When transmitted to the host this record acts as the message header.
|
||||
// This header is followed by two arrays of doubles containing the input
|
||||
// and output meter values associated with the input and output audio devices.
|
||||
// Message Layout:
|
||||
// [ rtSubIdx kStatusSelId cmRtSysStatus_t iMeterArray[iMeterCnt] oMeterArray[oMeterCnt] ]
|
||||
typedef struct
|
||||
{
|
||||
cmRtSysMsgHdr_t hdr;
|
||||
|
||||
unsigned updateCnt; ///< count of callbacks from the audio devices.
|
||||
unsigned wakeupCnt; ///< count of times the audio system thread has woken up after the cond. var has been signaled by the audio update thread.
|
||||
unsigned msgCbCnt; ///< count of msgs delivered via cmRtCallback() .
|
||||
unsigned audioCbCnt; ///< count of times the DSP execution was requested via cmRtCallback().
|
||||
unsigned updateCnt; // count of callbacks from the audio devices.
|
||||
unsigned wakeupCnt; // count of times the audio system thread has woken up after the cond. var has been signaled by the audio update thread.
|
||||
unsigned msgCbCnt; // count of msgs delivered via cmRtCallback() .
|
||||
unsigned audioCbCnt; // count of times the DSP execution was requested via cmRtCallback().
|
||||
|
||||
unsigned iDevIdx; ///< Input device index
|
||||
unsigned oDevIdx; ///< Output device index
|
||||
unsigned iDevIdx; // Input device index
|
||||
unsigned oDevIdx; // Output device index
|
||||
|
||||
unsigned overflowCnt; ///< count of times the audio input buffers overflowed
|
||||
unsigned underflowCnt; ///< count of times the audio output buffers underflowed
|
||||
unsigned iMeterCnt; ///< count of input meter channels
|
||||
unsigned oMeterCnt; ///< count of output meter channels
|
||||
unsigned overflowCnt; // count of times the audio input buffers overflowed
|
||||
unsigned underflowCnt; // count of times the audio output buffers underflowed
|
||||
unsigned iMeterCnt; // count of input meter channels
|
||||
unsigned oMeterCnt; // count of output meter channels
|
||||
|
||||
} cmRtSysStatus_t;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user