/*------------------------------------------------ copy date/time text to clipboard --------------------------------------------------*/ void OnCopy(HWND hwnd, const wchar_t* pfmt) { wchar_t format[BUFSIZE_FORMAT]; wchar_t ws[BUFSIZE_FORMAT]; HGLOBAL hg; if(pfmt) { if(wcslen(pfmt) < BUFSIZE_FORMAT - 5) { wcscpy(format, L"<%"); wcscat(format, pfmt); wcscat(format, L"%>"); pfmt = format; } else return; } MakeFormat(ws, NULL, pfmt, BUFSIZE_FORMAT); if(!OpenClipboard(hwnd)) return; EmptyClipboard(); if(g_winver&WINNT) { wchar_t *p; hg = GlobalAlloc(GMEM_DDESHARE, (wcslen(ws) + 1) * sizeof(wchar_t)); p = (wchar_t*)GlobalLock(hg); wcscpy(p, ws); GlobalUnlock(hg); SetClipboardData(CF_UNICODETEXT, hg); } else { char s[BUFSIZE_FORMAT], *p; WideCharToMultiByte(CP_ACP, 0, ws, -1, s, BUFSIZE_FORMAT-1, NULL, NULL); hg = GlobalAlloc(GMEM_DDESHARE, strlen(s) + 1); p = (char*)GlobalLock(hg); strcpy(p, s); GlobalUnlock(hg); SetClipboardData(CF_TEXT, hg); } CloseClipboard(); }
/*------------------------------------------------ ツールチップの表示内容取得 --------------------------------------------------*/ static void TooltipUpdateText(void) { const static char * const aszRegEntry[3] = { "Tooltip", "Tooltip2", "Tooltip3", }; SYSTEMTIME t; int beat100; char fmt[LEN_TOOLTIP], s[LEN_TOOLTIP], tiptitle[300], tipt[300], ini_key[10]; DWORD dw; RECT rcClock; int clLen, mPos; BOOL bTooltip2, bTooltip3, bTooltipTate; bTooltipUpdated = TRUE; bTooltip2 = GetMyRegLongEx("Tooltip", "Tip2Use", FALSE, gConfigNo); if (bTooltip2) { bTooltip3 = GetMyRegLongEx("Tooltip", "Tip3Use", FALSE, gConfigNo); bTooltipTate = GetMyRegLongEx("Tooltip", "TipTateFlg", FALSE, gConfigNo); GetWindowRect(hwndClock, &rcClock); dw = GetMessagePos(); if (bTooltipTate) { clLen = rcClock.bottom - rcClock.top; mPos = GET_Y_LPARAM(dw) - rcClock.top; } else { clLen = rcClock.right - rcClock.left; mPos = GET_X_LPARAM(dw) - rcClock.left; } if (bTooltip3) { if ( mPos > (2*clLen/3) ) iTooltipSelected = 2; if ( mPos <= (2*clLen/3) && mPos >= (clLen/3) ) iTooltipSelected = 1; if ( mPos < (clLen/3) ) iTooltipSelected = 0; } else { if ( mPos > (clLen/2) ) iTooltipSelected = 1; if ( mPos <= (clLen/2) ) iTooltipSelected = 0; } } else { iTooltipSelected = 0; } strcpy(ini_key, aszRegEntry[iTooltipSelected]); GetMyRegStrEx("Tooltip", ini_key, fmt, sizeof(fmt), "", gConfigNo); if(fmt[0] == 'f' && fmt[1] == 'i' && fmt[2] == 'l' && fmt[3] == 'e' && fmt[4] == ':') { memmove( fmt, fmt + 5, (size_t)((strchr(fmt,'\0')-1)-fmt)); if(!GetTooltipText(fmt)){ strcpy(fmt, "ファイル取得失敗"); } } if(fmt[0] == 0) { strcpy(fmt, "TClock <%LDATE%>"); } GetDisplayTime(&t, &beat100); MakeFormat(s, &t, beat100, fmt); strcpy(formatTooltip, s); //635@p5 GetMyRegStrEx("", "TipTitle", tiptitle, 300, "", gConfigNo); if(tiptitle[0] != 0) { MakeFormat(tipt, &t, beat100, tiptitle); strcpy(titleTooltip, tipt); } else { titleTooltip[0] = 0; } }
bool AsiHpiDevice::start(QString *err) { #ifdef ASIHPI hpi_err_t herr; struct hpi_format fmt; uint16_t state=0; uint32_t buffer_size=0; uint32_t data_recorded=0; uint32_t samples_recorded=0; uint32_t aux_data_recorded=0; hpi_handle_t handle; short lvls[HPI_MAX_CHANNELS]; // // Open Mixer // if(HpiLog(HPI_MixerOpen(NULL,asihpi_adapter_index,&asihpi_mixer))==0) { // // Input Gain // if(HPI_MixerGetControl(NULL,asihpi_mixer, HPI_SOURCENODE_LINEIN,asihpi_input_index, HPI_DESTNODE_NONE,0,HPI_CONTROL_VOLUME, &handle)==0) { for(unsigned i=0; i<HPI_MAX_CHANNELS; i++) { lvls[i]=asihpi_input_gain*100; } HpiLog(HPI_VolumeSetGain(NULL,handle,lvls)); } // // Input Source // if(HpiLog(HPI_MixerGetControl(NULL,asihpi_mixer,0,0, HPI_DESTNODE_ISTREAM,asihpi_input_index, HPI_CONTROL_MULTIPLEXER,&handle))==0) { HpiLog(HPI_Multiplexer_SetSource(NULL,handle,asihpi_input_source, asihpi_input_index)); } // // Input Type // if((HpiLog(HPI_MixerGetControl(NULL,asihpi_mixer, HPI_SOURCENODE_LINEIN,asihpi_input_index, HPI_DESTNODE_NONE,0, HPI_CONTROL_MULTIPLEXER,&handle)))==0) { HpiLog(HPI_Multiplexer_SetSource(NULL,handle,asihpi_input_type, asihpi_input_index)); } // // Channel Mode // if((HpiLog(HPI_MixerGetControl(NULL,asihpi_mixer,0,0, HPI_DESTNODE_ISTREAM,asihpi_input_index, HPI_CONTROL_CHANNEL_MODE, &handle)))==0) { HpiLog(HPI_ChannelModeSet(NULL,handle,asihpi_channel_mode)); } // // Input Meter // if((HpiLog(HPI_MixerGetControl(NULL,asihpi_mixer,0,0,HPI_DESTNODE_ISTREAM, asihpi_input_index,HPI_CONTROL_METER,&asihpi_input_meter)))==0) { asihpi_meter_timer->start(100); } } // // Open Input Stream // if((herr=HPI_InStreamOpen(NULL,asihpi_adapter_index,asihpi_input_index,&asihpi_input_stream))!=0) { *err=tr("HPI error")+": "+hpi_strerror(herr); return false; } // // Find Supported Format // MakeFormat(&fmt,HPI_FORMAT_PCM32_FLOAT); if((herr=HPI_InStreamQueryFormat(NULL,asihpi_input_stream,&fmt))!=0) { *err=tr("HPI error")+": "+hpi_strerror(herr); return false; } // // Set Format // if((herr=HPI_InStreamSetFormat(NULL,asihpi_input_stream,&fmt))!=0) { *err=tr("HPI error")+": "+hpi_strerror(herr); return false; } // // Start input stream // if((herr=HPI_InStreamStart(NULL,asihpi_input_stream))!=0) { *err=tr("HPI error")+": "+hpi_strerror(herr); return false; } // // Create PCM buffer // if((herr=HPI_InStreamGetInfoEx(NULL,asihpi_input_stream,&state,&buffer_size, &data_recorded,&samples_recorded, &aux_data_recorded))!=0) { *err=tr("HPI error")+": "+hpi_strerror(herr); return false; } asihpi_pcm_buffer=new uint8_t[buffer_size]; asihpi_read_timer->start(ASIHPI_READ_INTERVAL); return true; #else return false; #endif // ASIHPI }