void QSPCallBacks::PlayFile(QSPString file, int volume) { FMOD_SOUND *newSound; FMOD_CHANNEL *newChannel; QSPSound snd; if (SetVolume(file, volume)) return; CloseFile(file); wxString strFile(wxFileName(wxString(file.Str, file.End), wxPATH_DOS).GetFullPath()); #if defined(__WXMSW__) || defined(__WXOSX__) if (!FMOD_System_CreateSound(m_sys, wxConvFile.cWX2MB(strFile.c_str()), FMOD_SOFTWARE | FMOD_CREATESTREAM, 0, &newSound)) #else FMOD_CREATESOUNDEXINFO exInfo; memset(&exInfo, 0, sizeof(FMOD_CREATESOUNDEXINFO)); exInfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); wxString dlsPath(QSPTools::GetAppPath() + QSP_MIDIDLS); wxCharBuffer dlsCharPath(wxConvFile.cWX2MB(dlsPath.c_str())); exInfo.dlsname = dlsCharPath; if (!FMOD_System_CreateSound(m_sys, wxConvFile.cWX2MB(strFile.c_str()), FMOD_SOFTWARE | FMOD_CREATESTREAM, &exInfo, &newSound)) #endif { UpdateSounds(); FMOD_System_PlaySound(m_sys, FMOD_CHANNEL_FREE, newSound, FALSE, &newChannel); snd.Channel = newChannel; snd.Sound = newSound; snd.Volume = volume; m_sounds.insert(QSPSounds::value_type(strFile.Upper(), snd)); SetVolume(file, volume); } }
/* ProcessPlayKey routine This routine processes the play/pause button depending on the current mode of operation. */ void ProcessPlayKey(Uint8 Key) { if (IdleTime == 0) { // If was idle if (IdleVolume > 47){ // If not muted then we have headphones if (Input == MP3In) { MP3_Pause(!MP3Paused); // otherwise toggle the paused state of MP3 engine } else { if (PreMuteVolume) { Volume = PreMuteVolume; SetVolume(Volume); } else { PreMuteVolume = Volume; Volume = 0; SetVolume(Volume); } } }else{ ProcessTrackKey(NextTrack); // The process the same as if next track key pressed } } else { if (Input == MP3In) { MP3_Pause(!MP3Paused); // otherwise toggle the paused state of MP3 engine } else { if (PreMuteVolume) { Volume = PreMuteVolume; SetVolume(Volume); } else { PreMuteVolume = Volume; Volume = 0; SetVolume(Volume); } } } }
void CPulseAEStream::SetMute(const bool mute) { if (mute) SetVolume(-1.f); else SetVolume(m_Volume); }
LRESULT YouTubeWebPageView::OnStateChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { T_enPlayerState enState = static_cast<T_enPlayerState>(static_cast<int>(lParam)); ATLTRACE(_T("%08x: OnStateChanged: %s (%i)\n"), m_hWnd, GetStateCodeText(enState), lParam); if (enState == playerStateInitialized) { // simulate a WM_SIZE message to adjust web page size CRect rc; GetClientRect(&rc); BOOL bHandled = false; OnSize(WM_SIZE, 0, MAKELPARAM(rc.Width(),rc.Height()), bHandled); } else if (enState == playerStateVideoCued) { switch(m_enActionWhenReady) { case actionPlayVideo: SetVolume(100); PlayVideo(); break; case actionSeekAndPause: m_uiSeekAndPauseStopCounter = 2; SetVolume(0); // note: calling SeekTo starts playing, so we pause the video when we reach the exact second SeekTo(m_dSeconds, true); break; case actionDoNothing: default: break; } } else if (enState == playerStatePlaying) // playing { // started playing due to SeekTo() call? if (m_enActionWhenReady == actionSeekAndPause) { CheckSeekToStart(); SetTimer(IDT_SEEK_AND_PAUSE, 200); } } else if (enState == playerStatePaused) // paused { KillTimer(IDT_SEEK_AND_PAUSE); m_enActionWhenReady = actionDoNothing; } return 0; }
/* ProcessVolumeKey routine This routine process a volume key press. */ void ProcessVolumeKey(Uint8 Key) { if (IdleTime == 0) { // If was idle IdleTime = Settings.IdlePeriod; SetDefaultBay(); if (Settings.DefaultInput <= RightTablet) { SetAllInputs(Settings.DefaultInput); } else if ((Config == OneBayTwoSources) || (Config == TwoBaysTwoSources)) { SetAllInputs(LCDIn); } else { SetAllInputs(MP3In); } if(IdleVolume <= 47){ //no headphone up to default MP3_Track(1); Track = 1; Ramp = RampDefault; } } if (Ramp == RampDefault) return; while (GetKey()) { // Handle key held repeats // Do the actual volume change if (Key == VolUp) { if (Volume < MaxVolume) { if (Volume + Settings.VolumeStep <= MaxVolume) Volume += Settings.VolumeStep; else Volume = MaxVolume; SetVolume(Volume); } } else { if (Volume >= MinVolume + Settings.VolumeStep) Volume -= Settings.VolumeStep; else Volume = MinVolume; SetVolume(Volume); } // Wait the repeat time keeping the MP3 chip feed and comms running Timer_Clear(); while (Timer_Read() < VolStepDelay) { MP3_Process(); CheckForBoardMsg(); RefreshLamps(); wdt_reset(); // Volume up down long time press, so need feed watchdog } FlashPhase += 3; } }
void Musicplayer::Tick(bool attenuate) { if(FileNames.empty()) return; if(!attenuate && CurrentVolume < Volume) SetVolume(CurrentVolume + FadeRate > Volume ? Volume : CurrentVolume + FadeRate); else if(attenuate && CurrentVolume > 0) SetVolume(CurrentVolume - FadeRate < 0 ? 0 : CurrentVolume - FadeRate); if(!attenuate && !MusicFile.IsPlaying()) Next(); }
void CClientSound::RelateDimension ( unsigned short usDimension ) { if ( usDimension == m_usDimension ) { SetVolume ( m_fVolume ); } else { m_fVolume = GetVolume (); SetVolume ( 0.0f ); } }
/* ------------------------------------------------------------------------------------ */ int StreamingAudio::Play(bool bLooping) { if(mp3) { if(Mpeg3 == NULL) return RGF_FAILURE; m_fActive = true; m_bLoops = bLooping; Mpeg3->PlayMp3((LONG)(CCD->MenuManager()->GetmVolLevel()*1000.0f), bLooping); return RGF_SUCCESS; } LONG ScaledVolume; LONG nVolume = (LONG)(CCD->MenuManager()->GetmVolLevel()*10000.0f); if(nVolume <= 1) ScaledVolume = -10000; else if(nVolume > 10000) ScaledVolume = 0; else //ScaledVolume = (LONG)(log10(nVolume)/4*10000 - 10000); ScaledVolume = (LONG)(log10((double)nVolume)*2500 - 10000); nVolume = ScaledVolume; if(ogg) { if(Ogg == NULL) return RGF_FAILURE; m_fActive = true; m_bLoops = bLooping; Ogg->Play(bLooping); SetVolume(nVolume); return RGF_SUCCESS; } // Check for stream availability if(m_pStream == NULL) return RGF_FAILURE; // No stream // changed RF064 if(m_fActive == true) return RGF_SUCCESS; // end change RF064 m_fActive = true; m_bLoops = bLooping; m_pStream->Play(0, 0, DSBPLAY_LOOPING); // Start playback SetVolume(nVolume); return RGF_SUCCESS; }
void CN3SndObj::Tick() { if(NULL == m_lpDSBuff || m_ePlayState == SNDSTATE_STOP) return; m_fTmpSecPerFrm += CN3Base::s_fSecPerFrm; if(m_ePlayState==SNDSTATE_DELAY && m_fTmpSecPerFrm >= m_fStartDelayTime) { m_fTmpSecPerFrm = 0; m_ePlayState = SNDSTATE_FADEIN; RealPlay(); } if(m_ePlayState==SNDSTATE_FADEIN) { if(m_fTmpSecPerFrm >= m_fFadeInTime) { m_fTmpSecPerFrm = 0; m_ePlayState = SNDSTATE_PLAY; this->SetVolume(m_iMaxVolume); } else { int vol = 0; if(m_fFadeInTime>0.0f) vol = ((m_fTmpSecPerFrm/m_fFadeInTime)*(float)m_iMaxVolume); SetVolume(vol); } } if(m_ePlayState==SNDSTATE_PLAY) { if(!m_bIsLoop) m_ePlayState = SNDSTATE_STOP; } if(m_ePlayState==SNDSTATE_FADEOUT) { if(m_fTmpSecPerFrm >= m_fFadeOutTime) { m_fTmpSecPerFrm = 0; m_ePlayState = SNDSTATE_STOP; this->SetVolume(0); HRESULT hr = m_lpDSBuff->Stop(); } else { //볼륨 점점 작게.... int vol = 0; if(m_fFadeOutTime>0.0f) vol = (((m_fFadeOutTime - m_fTmpSecPerFrm)/m_fFadeOutTime)*(float)m_iMaxVolume); SetVolume(vol); } } }
/* Load playlist */ void bshAudioPlaylist::loadPlayList(char* szPlaylistFileName) { FILE* plFile; int i; szString temp; char filePath[1024]; gApplicationLog.printf("\nbshAudioPlaylist::loadPlayList() - Loading playlist"); plFile = fopen(szPlaylistFileName,"rt"); fscanf(plFile,"%d",&m_trackCount); fscanf(plFile,"\n"); for(i = 0; i < m_trackCount; i++) { fgets(temp,1024,plFile); if (i < m_trackCount - 1) temp[strlen(temp) - 1] = 0; gApplicationLog.printf("\nbshAudioPlaylist::loadPlayList() - (%d/%d) %s",i + 1,m_trackCount,temp); stripNewLine(temp); strcpy(m_trackList[i],temp); // Load audio track sprintf(filePath,"he-music/%s",m_trackList[i]); m_pTrack[i] = Mix_LoadMUS(filePath); if(m_pTrack[i] == nullptr) gApplicationLog.printf("\nbshAudioPlaylist::loadPlayList() - ERROR(%s)",Mix_GetError()); } fclose(plFile); m_currentTrack = 0; gApplicationLog.printf("\nbshAudioPlaylist::loadPlayList() - DONE!"); SetVolume(gSoundVolume); }
void OpenALSound::SetGlobalVolume( float globalVolume ) { _globalVolume = globalVolume; if ( _isActive ) { SetVolume( _volume ); } }
//---------------------------------------------- TeffHit::TeffHit( TsceneGame *game, const Vector2D &pos, const Vector2D &velocity) :TobjEffect( game, pos, // position 0.5, // radius velocity, // velocity 0.5, // max_speed Vec2DNormalize(velocity), // heading 0., // mass Vector2D(0.08, 0.08), // scale 0, // turn_rate 1, // max_force 1 // vitality ), FiTimer(0), FiAlpha(1.0) { iImageWidth=TRIMMING__IMAGE_RBX - TRIMMING__IMAGE_LTX; iImageHeight=TRIMMING__IMAGE_RBY - TRIMMING__IMAGE_LTY; // ヒット時の効果音 int ch = PlayDxSound( SND_SE_SHOT ); int bgm_vol = GetVolume(ch); SetVolume(ch, -200); }
PCEFast_PSG::PCEFast_PSG(Blip_Buffer* bbs) : sbuf(bbs) { Synth.treble_eq(-2.0); lastts = 0; for(int ch = 0; ch < 6; ch++) { channel[ch].blip_prev_samp[0] = 0; channel[ch].blip_prev_samp[1] = 0; channel[ch].lastts = 0; } SetVolume(1.0); for(int vl = 0; vl < 32; vl++) { double flub = 1; if(vl) flub /= pow(2, (double)1 / 4 * vl); // ~1.5dB reduction per increment of vl if(vl == 0x1F) flub = 0; for(int samp = 0; samp < 32; samp++) { int eff_samp = samp * 2 - 0x1F; dbtable[vl][samp] = (int32)(flub * eff_samp * 128); dbtable_volonly[vl] = (int32)(flub * 65536); } } Power(0); }
void CMPlayerUtility::SetVolPer(UINT32 nPer) { if (nPer > 100) nPer = 100; int nVol = nPer * MaxVolume() / 100; SetVolume(nVol); }
// Update a song's fade status void Song::Update() { if (fade) { // Get fade progression from 0.0f - 1.0f depending on number of milliseconds elapsed since fade started float progress = min(static_cast<float>(GetTickCount() - fadeStartTick) / fadeLength, 1.0f); // Fade is over if progression is at 1.0f if (progress == 1.0f) fade = false; // Translate linear progress into a smooth sine-squared fade effect float volume = static_cast<float>(sin(progress * M_PI / 2)); volume *= volume; // Scale volume between start and target volumes volume = volume * (fadeTargetVol - fadeStartVol) + fadeStartVol; // Alter song volume SetVolume(volume); // Post-fade processing if (!fade) SetPaused(fadePauseAfter); } }
bool C4MusicFileOgg::Play(bool loop) { // Valid file? if (!loaded) return false; // stop previous Stop(); // Get channel to use alGenSources(1, (ALuint*)&channel); if (!channel) return false; playing = true; streaming_done = false; this->loop = loop; byte_pos_total = 0; // initial volume setting SetVolume(float(::Config.Sound.MusicVolume) / 100.0f); // prepare read ogg_info.sound_data.resize(num_buffers * buffer_size); alGenBuffers(num_buffers, buffers); ov_pcm_seek(&ogg_file, 0); // Fill initial buffers for (size_t i=0; i<num_buffers; ++i) if (!FillBuffer(i)) break; // if this fails, the piece is shorter than the initial buffers // play! alErrorCheck(alSourcePlay(channel)); return true; }
Sound& Sound::operator =(const Sound& right) { // Here we don't use the copy-and-swap idiom, because it would mess up // the list of sound instances contained in the buffers // Detach the sound instance from the previous buffer (if any) if (myBuffer) { Stop(); myBuffer->DetachSound(this); myBuffer = NULL; } // Copy the sound attributes if (right.myBuffer) SetBuffer(*right.myBuffer); SetLoop(right.GetLoop()); SetPitch(right.GetPitch()); SetVolume(right.GetVolume()); SetPosition(right.GetPosition()); SetRelativeToListener(right.IsRelativeToListener()); SetMinDistance(right.GetMinDistance()); SetAttenuation(right.GetAttenuation()); return *this; }
//---------------------------------------------- TobjShot::TobjShot( TsceneGame *game, Vector2D position, double radius, Vector2D velocity, double max_speed, Vector2D heading, double mass, Vector2D scale, double turn_rate, double max_force, double vitality) : TBaseMovingObject( game, TBaseObject::shot, position, radius, velocity, max_speed, heading, mass, scale, turn_rate, max_force, vitality) { // プレイヤーショットの効果音を再生 int ch = PlayDxSound( SND_SE_SHOT ); int bgm_vol = GetVolume(ch); SetVolume(ch, -300); }
//--------------------------------------------------------------------------- void tTJSNI_BaseSoundBuffer::TimerBeatHandler() { // fade handling if(!Owner) return; // "Owner" indicates the owner object is valid if(!InFading) return; if(BlankLeft) { BlankLeft -= TVP_SB_BEAT_INTERVAL; if(BlankLeft < 0) BlankLeft = 0; } else if(FadeCount) { if(FadeCount == 1) { StopFade(true, true); } else { FadeCount--; tjs_int v; v = GetVolume(); v += DeltaVolume; if(v<0) v = 0; if(v>100000) v = 100000; SetVolume(v); } } }
BOOL CSoundBuffer::Play(BOOL bLoop, long lPan, int iVol) { HRESULT rval; LPDIRECTSOUNDBUFFER Buffer = NULL; if(m_lpDS == NULL) return FALSE; Buffer = GetIdleBuffer(); if(Buffer == NULL) return FALSE; SetVolume(iVol); if (lPan < DSBPAN_LEFT) lPan = DSBPAN_LEFT; else if (lPan > DSBPAN_RIGHT) lPan = DSBPAN_RIGHT; Buffer->SetPan(lPan); m_bIsLooping = bLoop; if (bLoop == FALSE) rval = Buffer->Play(0, 0, 0); else rval = Buffer->Play(0, 0, DSBPLAY_LOOPING ); if(rval != DS_OK) return FALSE; return TRUE; }
LRESULT CSoundFader::ResetVolume(void){ CVolumeFadeInfo& info = m_FadeInfo; info.m_bFadeIn = false; info.m_bFadeOut = false; SetVolume(DSBVOLUME_MAX); return 0; }
static void RunUI(Port &port, OperationEnvironment &env) { WriteMenu(); while (true) { fprintf(stdout, "> "); char in[20]; if (fgets(in, 20, stdin) == NULL || strlen(in) == 0) { fprintf(stdout, "Invalid input\n"); continue; } switch (in[0]) { case '?': case 'h': case 'H': WriteMenu(); break; case '1': SetMC(port, env); break; case '2': SetBallast(port, env); break; case '3': SetBugs(port, env); break; case '4': SetAltitudeOffset(port, env); break; case '5': SetQNH(port, env); break; case '6': SetVolume(port, env); break; case 'p': case 'P': SetPolar(port, env); break; case 'f': case 'F': SetFilters(port, env); break; case 's': case 'S': SetSCSettings(port, env); break; case 'q': case 'Q': fprintf(stdout, "Closing LX1600 Utils ...\n"); return; default: fprintf(stdout, "Invalid input\n"); break; } } }
//---------------------------------------------- TeffFinalBigExplosion::TeffFinalBigExplosion( TsceneGame *game, const Vector2D &pos, const Vector2D &velocity) :TobjEffect( game, pos, // position 0.5, // radius velocity, // velocity 0.5, // max_speed Vec2DNormalize(velocity), // heading 0., // mass Vector2D(5.0, 5.0), // scale 0, // turn_rate 1, // max_force 1 // vitality ), FiTimer(0), FiAlpha(1.0), FiFrame(0) { iImageWidth=TRIMMING__IMAGE_RBX - TRIMMING__IMAGE_LTX; iImageHeight=TRIMMING__IMAGE_RBY - TRIMMING__IMAGE_LTY; // ボス独自の爆発音を発生 int ch = PlayDxSound( SND_SE_BOSS_DEATH ); int bgm_vol = GetVolume(ch); SetVolume(ch, -300); }
void CWndOptSound::OnLButtonDown( UINT nFlags, CPoint point ) { SetCapture(); int nResult = 0; nResult = GetSliderStep( WIDC_CUSTOM1, m_nStep[0], point ); if( nResult == -1 ) { m_bLButtonClick = TRUE; return; } else if( nResult == 1 ) { g_Option.m_fEffectVolume = m_nStep[0]*0.1f; g_SoundMng.m_nSoundVolume = (int)( -(1.0f-g_Option.m_fEffectVolume)*5000 ); } ///////////////////////////////////////// nResult = GetSliderStep( WIDC_CUSTOM2, m_nStep[1], point ); if( nResult == -1 ) { m_bLButtonClick2 = TRUE; return; } else if( nResult == 1 ) { g_Option.m_fBGMVolume = m_nStep[1]*0.1f; SetVolume(g_Option.m_fBGMVolume); } }
void CAudioManager::Fadein(int id, int targetVolume, float time){ if(m_bValidAudio == false) return; int currentVolume = 0; double timeStep = 0; double volumeStep = 0; for(int i = 0; i < m_AudioClip.size(); i++){ if(m_AudioClip[i].AudioID == id){// && IsPlaying(id) == true){ if(IsPlaying(i) == false){ PlaySoundClip(i, 0); SetVolume(i, 0); } m_AudioClip[i].targetVolume = targetVolume; currentVolume = GetVolume(i); if(targetVolume > currentVolume && time > 0){ timeStep = time/ 0.1; volumeStep = (double)(targetVolume - currentVolume) / timeStep; m_AudioClip[i].fadeStep = volumeStep; m_AudioClip[i].bFadein = true; } } }//for }
void CWndOptVideo::OnMouseMove(UINT nFlags, CPoint point) { #ifdef __SFX_OPT if( m_bLButtonClick ) { GetRangeSlider( WIDC_CUSTOM2, m_nStep[0], point, 5); g_Option.m_nSfxLevel = m_nStep[0]; } if( m_bLButtonClick2 ) { GetRangeSlider( WIDC_CUSTOM3, m_nStep[1], point,1); g_Option.m_bSFXRenderOff = !m_nStep[1]; } #else if( m_bLButtonClick ) { GetRangeSlider( WIDC_CUSTOM2, m_nStep[0], point ); g_Option.m_fEffectVolume = m_nStep[0]*0.1f; g_SoundMng.m_nSoundVolume = -(1.0f-g_Option.m_fEffectVolume)*5000; } if( m_bLButtonClick2 ) { GetRangeSlider( WIDC_CUSTOM3, m_nStep[1], point ); g_Option.m_fBGMVolume = m_nStep[1]*0.1f; SetVolume(g_Option.m_fBGMVolume); } #endif #if __VER <= 8 //__Y_GAMMA_CONTROL_8 #ifdef __DISABLE_GAMMA_WND if(g_Neuz.m_bStartFullscreen) { #endif if( m_bLButtonClick3 ) { GetRangeSlider( WIDC_CUSTOM1, m_nStep[2], point ); g_Option.m_fGamma = (FLOAT)m_nStep[2] / (FLOAT)5.0f; g_Neuz.Drv_SetGamma( g_Neuz.GetSafeHwnd(), g_Option.m_fGamma, g_Option.m_nOverBright, g_Option.m_fContrast ); } if( m_bLButtonClick4 ) { GetRangeSlider( WIDC_CUSTOM4, m_nStep[3], point ); g_Option.m_nOverBright = m_nBrightTable[m_nStep[3]]; g_Neuz.Drv_SetGamma( g_Neuz.GetSafeHwnd(), g_Option.m_fGamma, g_Option.m_nOverBright, g_Option.m_fContrast ); } if( m_bLButtonClick5 ) { GetRangeSlider( WIDC_CUSTOM5, m_nStep[4], point ); g_Option.m_fContrast = (FLOAT)m_nStep[4] / (FLOAT)5.0f; g_Neuz.Drv_SetGamma( g_Neuz.GetSafeHwnd(), g_Option.m_fGamma, g_Option.m_nOverBright, g_Option.m_fContrast ); } #ifdef __DISABLE_GAMMA_WND } #endif #endif //__Y_GAMMA_CONTROL_8 }
ClResult ClSoundDS::playVoice(int &handle,int arcFileNum,char *fname,BOOL bLoop) { char workBuf[64]; BOOL ret; ClSoundBuffer *lpSoundBuffer; wsprintf(workBuf,"%s.ogg",fname); int num = readFile->SearchFile(arcFileNum,workBuf); if(num==-1){ myOutputDebugString("Voiceファイル『%s』が見つかりませんでした。\n",workBuf); return Cl_PCM_NOTFOUND; } if(0==sysInf.voiceVolume)return Cl_OK; if(keyState.data_skip || sysInf.bAlreadyRead)return Cl_OK; lpSoundBuffer = SelectSoundBuffer(handle); if(lpSoundBuffer){ int status = GetStatus(handle); if(status != PCM_STOP){ Stop(handle); } ret = CreateStreamBuffer(handle,arcFileNum,num); if(-1==ret)return Cl_PCM_NOTFOUND; }else{ CreateSoundObj(handle,arcFileNum,num,TRUE); if(-1==handle)return Cl_PCM_NOTFOUND; } int volume = sysInf.voiceVolume*0xff /10; SetVolume(handle,volume); if(FALSE==bLoop){ play(handle,1); }else{ play(handle,0); } return Cl_OK; } // ClSoundDS::playVoice
/***************************************************************************** ** Procedure: CDSPhone::UnsolicitedEvent ** ** Arguments: 'lpBuff' - Data buffer (structure) specific to code ** ** Returns: void ** ** Description: This function processes any responses from the device which ** are not matched to a pending line request. ** *****************************************************************************/ bool CDSPhone::UnsolicitedEvent(LPCVOID lpBuff) { USES_CONVERSION; EVENTBUFF* pevBuff = (EVENTBUFF*) lpBuff; switch (pevBuff->dwResponse) { // A lamp has changed states. case EMRESULT_LAMPCHANGED: { LPEMLAMPCHANGE lpChange = (LPEMLAMPCHANGE) pevBuff->lpBuff; SetLampState ((int)lpChange->wButtonLampID, g_LampStates[lpChange->wLampState]); } break; // A hookswitch device has changed states. case EMRESULT_HSCHANGED: { LPEMHOOKSWITCHCHANGE lpChange = (LPEMHOOKSWITCHCHANGE) pevBuff->lpBuff; _TSP_ASSERTE (lpChange->wHookswitchID == HSDEVICE_HANDSET); SetHookSwitch (PHONEHOOKSWITCHDEV_HANDSET, g_hsStates[lpChange->wHookswitchState]); } break; // A button has changed case EMRESULT_BUTTONCHANGED: { LPEMBUTTONCHANGE lpChange = (LPEMBUTTONCHANGE) pevBuff->lpBuff; SetButtonState (lpChange->wButtonLampID, g_ButtonStates[lpChange->wButtonState]); } break; // Ringer mode changed case EMRESULT_RINGCHANGE: SetRingMode (*((LPDWORD)pevBuff->lpBuff)); break; // Volume/Gain of the handset changed case EMRESULT_LEVELCHANGED: { LPEMLEVELCHANGE lpChange = (LPEMLEVELCHANGE) pevBuff->lpBuff; if (lpChange->wLevelType == LEVELTYPE_MIC) SetGain (PHONEHOOKSWITCHDEV_HANDSET, lpChange->wLevel); else if (lpChange->wLevelType == LEVELTYPE_SPEAKER) SetVolume (PHONEHOOKSWITCHDEV_HANDSET, lpChange->wLevel); } break; // The display has changed. case EMRESULT_DISPLAYCHANGED: { LPEMDISPLAY lpChange = (LPEMDISPLAY) pevBuff->lpBuff; SetDisplay (A2T(lpChange->szDisplay)); } break; } return true; }// CDSPhone::UnsolicitedEvent
bool PAPlayer::HandleFFwdRewd() { if (!m_IsFFwdRewding && m_iSpeed == 1) return true; // nothing to do if (m_IsFFwdRewding && m_iSpeed == 1) { // stop ffwd/rewd m_IsFFwdRewding = false; SetVolume(g_settings.m_nVolumeLevel); FlushStreams(); return true; } // we're definitely fastforwarding or rewinding int snippet = m_BytesPerSecond / 2; if ( m_bytesSentOut >= snippet ) { // Calculate offset to seek if we do FF/RW __int64 time = GetTime(); if (m_IsFFwdRewding) snippet = (int)m_bytesSentOut; time += (__int64)((double)snippet * (m_iSpeed - 1.0) / m_BytesPerSecond * 1000.0); // Is our offset inside the track range? if (time >= 0 && time <= m_decoder[m_currentDecoder].TotalTime()) { // just set next position to read m_IsFFwdRewding = true; time += m_currentFile->m_lStartOffset * 1000 / 75; m_timeOffset = m_decoder[m_currentDecoder].Seek(time); FlushStreams(); SetVolume(g_settings.m_nVolumeLevel - VOLUME_FFWD_MUTE); // override xbmc mute } else if (time < 0) { // ...disable seeking and start the track again time = m_currentFile->m_lStartOffset * 1000 / 75; m_timeOffset = m_decoder[m_currentDecoder].Seek(time); FlushStreams(); m_iSpeed = 1; SetVolume(g_settings.m_nVolumeLevel); // override xbmc mute } // is our next position greater then the end sector... else //if (time > m_codec->m_TotalTime) { // restore volume level so the next track isn't muted SetVolume(g_settings.m_nVolumeLevel); CLog::Log(LOGDEBUG, "PAPlayer: End of track reached while seeking"); return false; } } return true; }
//=============================================== //コンストラクタ //=============================================== //[input] // name:ファイル名 //[return] // なし //=============================================== CSound::CSound(char *name, int index) { // ZeroMemory(&m_pSound->pFile, sizeof(FILEDATA) ); CreateFromFile(name, true, index); SetVolume(100, index); }