void UpdateWhatsPlaying() { char buf[4097] = ""; if (getIsConnected()) { if(api->core_getCurrent(0) != NULL) { memset(buf, '\000', sizeof(buf)); api->metadb_getMetaData(api->core_getCurrent(0), MT_NAME, buf, 4096, MDT_STRINGZ); if (setCurrentSongTitle((char *)buf)) { pOddcast->m_MetadataValue->setName((char *)buf); } } // const char *szurl = api->core_getCurrent(0); } /* if (szurl == NULL || strstr(szurl, "http://") == NULL) { m_titleText->setName(NO_STREAM_MSG); return; } std::string msg = "Press start to rip "; msg += szurl; m_titleText->setName(msg.c_str()); */ }
v8::Handle<v8::Value> JSPresenceStruct::struct_setVelocity(const Vector3f& newVel) { if (!getIsConnected()) return v8::ThrowException(v8::Exception::Error(v8::String::New("Error when calling setVelocity on presence. The presence is not connected to any space, and therefore has no velocity to set."))); jsObjScript->setVelocityFunction(sporefToListenTo,newVel); return v8::Undefined(); }
//called from jsobjectscript. void JSPresenceStruct::disconnectCalledFromObjScript() { if (getIsCleared()) return; if (! getIsConnected()) JSLOG(error, "Error when calling disconnect on presence. The presence wasn't already connected."); isConnected = false; if (mContext != NULL) mContext->checkContextDisconnectCallback(this); }
void JSPresenceStruct::connect(const SpaceObjectReference& _sporef) { v8::HandleScope handle_scope; if (getIsConnected()) { JSLOG(error, "Error when calling connect on presence. The presence was already connected."); deregisterAsPosAndMeshListener(); } isConnected = true; JSPositionListener::setListenTo(&_sporef,NULL); JSPositionListener::registerAsPosAndMeshListener(); callConnectedCallback(); }
int OddcastWnd::handleChildNotify (int msg, int objId, int param1, int param2) { if (msg != ChildNotify::BUTTON_LEFTPUSH) return 0; int ret; switch(objId) { case ODDCAST_VU: if (m_vu_on_off) { m_vu_on_off = 0; } else { m_vu_on_off = 1; } break; case ODDCAST_CONNECT: if (getIsConnected()) { disconnectFromServer(); setForceStop(1); if (getLiveRecordingSetFlag()) { stopRecording(); } setCurrentSongTitle(""); m_connect->setButtonText("Connect", EXB_BUTTON_FONT_SIZE); gAvgRight = 0; gAvgLeft = 0; invalidate(); } else { char message[1024] = ""; char error[1024] = ""; int ret = 1; #ifdef WIN32 if (getWMAFlag()) { ret = startWMAServer(message,error); } #endif if (ret == 0) { MessageBox(NULL,message, NULL, MB_OK); MessageBox(NULL,error, NULL, MB_OK); } else { if (startOddcast(NULL)) { // gThreadHandle = CreateThread(NULL, 0, startOddcast, NULL, 0, &gThreadID); m_connect->setButtonText("Stop", EXB_BUTTON_FONT_SIZE); } } } break; case ODDCAST_CONFIG: if (!getIsConnected()) { STARTUPINFO si = {0}; PROCESS_INFORMATION pi = {0}; si.cb = sizeof (si); si.lpReserved = si.lpDesktop = si.lpTitle = NULL; si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOW; si.cbReserved2 = 0; si.lpReserved2 = 0; DWORD dwError; CreateProcess (NULL, "oddcast_editConfig.exe", NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi); WaitForSingleObject (pi.hProcess, INFINITE); initializeGlobals(); transcode_init(); } else { MessageBox(NULL, "Sorry, but you cannot edit the settings while connected", "Error", MB_OK); } break; } return 1; }
OddcastWnd::~OddcastWnd() { if (getIsConnected()) { disconnectFromServer(); setForceStop(1); if (getLiveRecordingSetFlag()) { stopRecording(); } setCurrentSongTitle(""); m_connect->setButtonText("Connect", EXB_BUTTON_FONT_SIZE); gAvgRight = 0; gAvgLeft = 0; invalidate(); } /* if (m_ServerDescText) { delete m_ServerDescText; } if (m_ServerDescValue) { delete m_ServerDescValue; } if (m_DestinationText) { delete m_DestinationText; } if (m_DestinationValue) { delete m_DestinationValue; } if (m_MetadataText) { delete m_MetadataText; } if (m_MetadataValue) { delete m_MetadataValue; } if (m_BPSText) { delete m_BPSText; } if (m_BPSValue) { delete m_BPSValue; } if (m_BitrateText) { delete m_BitrateText; } if (m_BitrateValue) { delete m_BitrateValue; } if (m_StatusText) { delete m_StatusText; } if (m_StatusValue) { delete m_StatusValue; } if (m_LiveRecordingText) { delete m_LiveRecordingText; } if (m_connect) { delete m_connect; } if (m_config) { delete m_config; } if (m_vu) { delete m_vu; } */ api->core_delCallback(0, this); m_pcurInst = NULL; }