HRESULT Update( DECL_EXTERNAL_CODECS_LOC_VARS IInStream *inStream, const CArchiveDatabaseEx *database, const CObjectVector<CUpdateItem> &updateItems, ISequentialOutStream *seqOutStream, IArchiveUpdateCallback *updateCallback, const CUpdateOptions &options) { #ifdef _7Z_VOL if (seqOutStream) #endif return Update2( EXTERNAL_CODECS_LOC_VARS inStream, database, updateItems, seqOutStream, updateCallback, options); #ifdef _7Z_VOL if (options.VolumeMode) return UpdateVolume(inStream, database, updateItems, seqOutStream, updateCallback, options); COutVolumeStream *volStreamSpec = new COutVolumeStream; CMyComPtr<ISequentialOutStream> volStream = volStreamSpec; CMyComPtr<IArchiveUpdateCallback2> volumeCallback; RINOK(updateCallback->QueryInterface(IID_IArchiveUpdateCallback2, (void **)&volumeCallback)); if (!volumeCallback) return E_NOTIMPL; volStreamSpec->Init(volumeCallback, L"a.7z"); volStreamSpec->_options = options; RINOK(Update2(inStream, database, updateItems, volStream, updateCallback, options)); return volStreamSpec->Flush(); #endif }
VOID CSoundSourceFMod::Play(VOID) { //停止 Stop(); //播放 if(_Sample) { CSoundBufferFMod* bufFMod= static_cast<CSoundBufferFMod*>(_Sample); _State= source_playing; //以暂停模式开始播放声音 if(bufFMod->m_pFModSample) _FModChannel= FSOUND_PlaySoundEx(FSOUND_FREE, bufFMod->m_pFModSample, NULL, true); //在Channel播放 if(_FModChannel!=-1) { FSOUND_SetLoopMode(_FModChannel, _Loop?FSOUND_LOOP_NORMAL:FSOUND_LOOP_OFF); //音量 UpdateVolume(); //开始播放 FSOUND_SetPaused(_FModChannel, false); } } }
void SettingsAudioOutput::OnOutputProperties(wxCommandEvent& event) { wxTreeItemId selection = m_AudioOutput->GetSelection(); AudioItemData* data = GetObject(selection); if (data && data->type == AudioItemData::AUDIO_NODE) { int latency = data->latency; latency = wxGetNumberFromUser(_("Desired output latency"), _("Desired latency:"), _("Audio device settings"), latency, 0, 999, this); if (latency == -1) return; data->latency = latency; UpdateDevice(selection); } else if (data && data->type == AudioItemData::GROUP_NODE) { wxString current = wxString::Format(wxT("%f"), data->volume >= -120 ? data->volume : -120); current = wxGetTextFromUser(_("Please enter new volume in dB:"), _("Change audio group"), current); if (current == wxEmptyString) return; double volume; if (!current.ToDouble(&volume) || volume < -120.0 || volume > 40.0) { wxMessageBox(_("Please enter a volume between -120 and 40 dB") , _("Error"), wxOK | wxICON_ERROR, this); return; } data->volume = volume; UpdateVolume(selection, data->volume); } UpdateButtons(); }
void CSoundSourceFMod::SetPos( const fVector3& pos ) { _Pos = pos; //3d模式 if(_b3DMode) { UpdateVolume(); } }
wxTreeItemId SettingsAudioOutput::AddGroupNode(const wxTreeItemId& channel, const wxString& name, bool left) { wxTreeItemId current; current = GetGroupNode(channel, name, left); if (current.IsOk()) return current; current = m_AudioOutput->AppendItem(channel, name, -1, -1, new AudioItemData(name, left, -121)); m_AudioOutput->Expand(current); m_AudioOutput->Expand(channel); UpdateVolume(current, -121); return current; }
void SettingsAudioOutput::OnOutputDefault(wxCommandEvent& event) { if (wxMessageBox(_("Should the audio config be reverted to the default stereo configuration?"), _("Revert"), wxYES_NO, this) == wxNO) return; wxTreeItemId root = m_AudioOutput->GetRootItem(); wxTreeItemId audio, channel, group; wxTreeItemIdValue i; wxString dev_name = wxEmptyString; audio = m_AudioOutput->GetFirstChild(root, i); while(audio.IsOk()) { if (dev_name == wxEmptyString) dev_name = ((AudioItemData*)m_AudioOutput->GetItemData(audio))->name; audio = m_AudioOutput->GetNextChild(root, i); } m_AudioOutput->DeleteChildren(root); std::vector<wxString> groups = m_GroupCallback.GetGroups(); audio = AddDeviceNode(dev_name); channel = AddChannelNode(audio, 0); for(unsigned i = 0; i < groups.size(); i++) { group = AddGroupNode(channel, groups[i], true); UpdateVolume(group, 0); } channel = AddChannelNode(audio, 1); for(unsigned i = 0; i < groups.size(); i++) { group = AddGroupNode(channel, groups[i], false); UpdateVolume(group, 0); } m_AudioOutput->ExpandAll(); UpdateButtons(); }
void SettingsAudioOutput::OnOutputChange(wxCommandEvent& event) { wxTreeItemId selection = m_AudioOutput->GetSelection(); AudioItemData* data = GetObject(selection); if (data && data->type == AudioItemData::AUDIO_NODE) { int index; wxArrayString devs; std::vector<wxString> devices = GetRemainingAudioDevices(); for(unsigned i = 0; i < devices.size(); i++) devs.Add(devices[i]); devs.Insert(data->name, 0); index = wxGetSingleChoiceIndex(_("Change audio device"), _("Change audio device"), devs, this); if (index == -1 || index == 0) return; unsigned channels = m_AudioOutput->GetChildrenCount(selection, false); bool error = false; for(unsigned i = 0; i < m_DeviceList.size(); i++) if (m_DeviceList[i].name == devs[index]) if (channels > m_DeviceList[i].channels) error = true; if (error) { wxMessageBox(_("Too many audio channels configured for the new audio interface") , _("Error"), wxOK | wxICON_ERROR, this); return; } data->name = devs[index]; UpdateDevice(selection); } else if (data && data->type == AudioItemData::GROUP_NODE) { int index; std::vector<std::pair<wxString, bool> > groups; wxArrayString names; groups = GetRemainingAudioGroups(m_AudioOutput->GetItemParent(selection)); groups.insert(groups.begin(), std::pair<wxString, bool>(data->name, data->left)); for(unsigned i = 0; i < groups.size(); i++) names.Add(wxString::Format(groups[i].second ? _("%s - left") : _("%s - right"), groups[i].first.c_str())); index = wxGetSingleChoiceIndex(_("Change audio group"), _("Change audio group"), names, this); if (index == -1 || index == 0) return; data->name = groups[index].first; data->left = groups[index].second; UpdateVolume(selection, data->volume); } UpdateButtons(); }
HRESULT DShowPlayer::OpenFile(const WCHAR* sFileName) { HRESULT hr = S_OK; IBaseFilter *pSource = NULL; // Create a new filter graph. (This also closes the old one, if any.) hr = InitializeGraph(); // Add the source filter to the graph. if (SUCCEEDED(hr)) { hr = m_pGraph->AddSourceFilter(sFileName, NULL, &pSource); } // Try to render the streams. if (SUCCEEDED(hr)) { hr = RenderStreams(pSource); } // Get the seeking capabilities. if (SUCCEEDED(hr)) { hr = m_pSeek->GetCapabilities(&m_seekCaps); } // Set the volume. if (SUCCEEDED(hr)) { hr = UpdateVolume(); } // Update our state. if (SUCCEEDED(hr)) { m_state = STATE_STOPPED; } SAFE_RELEASE(pSource); return hr; }
void ReadVolume(char *prefix) { char imgFile[100]; ifstream inputFileStream; // Reading the header file ReadHeader(prefix, iWidth, iHeight, iDepth); INFO("Volume size: [" + ITS(iWidth) + "X" + ITS(iHeight) + "x" + ITS(iDepth) + "]"); // Adding the ".img" prefix to the dataset path sprintf(imgFile, "%s.img", prefix); INFO("Reading the volume file " + CATS(imgFile)); // Total number of voxels numVoxels = iWidth * iHeight * iDepth; INFO("Number of voxels : " + ITS(numVoxels)); // Allocating the luminance image luminanceImage = new GLubyte [numVoxels]; // Allocating the RGBA image rgbaImage = new GLubyte [numVoxels * 4]; // Reading the volume image (luminance values) inputFileStream.open(imgFile, ios::in); if (inputFileStream.fail()) { INFO("Could not open " + CATS(imgFile)); EXIT(0); } // Read the image byte by byte inputFileStream.read((char *)luminanceImage, numVoxels); // Closing the input volume stream inputFileStream.close(); // Update the volume UpdateVolume(); INFO("The volume has been read successfull and the RGBA one is DONE"); }
void SettingsAudioOutput::OnOutputAdd(wxCommandEvent& event) { wxTreeItemId selection = m_AudioOutput->GetSelection(); AudioItemData* data = GetObject(selection); if (data && data->type == AudioItemData::AUDIO_NODE) { unsigned channels = m_AudioOutput->GetChildrenCount(selection, false); for(unsigned i = 0; i < m_DeviceList.size(); i++) if (m_DeviceList[i].name == data->name) if (channels < m_DeviceList[i].channels) AddChannelNode(selection, channels); } else if (data && data->type == AudioItemData::CHANNEL_NODE) { std::vector<std::pair<wxString, bool> > groups; wxArrayString names; int index; groups = GetRemainingAudioGroups(selection); for(unsigned i = 0; i < groups.size(); i++) names.Add(wxString::Format(groups[i].second ? _("%s - left") : _("%s - right"), groups[i].first.c_str())); index = wxGetSingleChoiceIndex(_("Add new audio group"), _("New audio group"), names, this); if (index == -1) return; wxTreeItemId id = AddGroupNode(selection, groups[index].first, groups[index].second); UpdateVolume(id, 0); } else if (data && data->type == AudioItemData::ROOT_NODE) { int index; wxArrayString devs; std::vector<wxString> devices = GetRemainingAudioDevices(); for(unsigned i = 0; i < devices.size(); i++) devs.Add(devices[i]); index = wxGetSingleChoiceIndex(_("Add new audio device"), _("New audio device"), devs, this); if (index == -1) return; wxMessageBox(_("Using more than one audio interface is currently not supported.") , _("Warning"), wxOK | wxICON_WARNING, this); wxTreeItemId audio = AddDeviceNode(devices[index]); AddChannelNode(audio, 0); } UpdateButtons(); }
bool C4MusicSystem::Init(const char * PlayList) { // init mod if (!MODInitialized && !InitializeMOD()) return false; // Might be reinitialisation ClearSongs(); // Global music file LoadDir(Config.AtSystemDataPath(C4CFN_Music)); // User music file LoadDir(Config.AtUserDataPath(C4CFN_Music)); // read MoreMusic.txt LoadMoreMusic(); // set play list SCounter = 0; if (PlayList) SetPlayList(PlayList); else SetPlayList(0); // set initial volume UpdateVolume(); // ok return true; }
void FMixerSource::Update() { SCOPE_CYCLE_COUNTER(STAT_AudioUpdateSources); if (!WaveInstance || !MixerSourceVoice || Paused || !bInitialized) { return; } UpdatePitch(); UpdateVolume(); UpdateSpatialization(); UpdateEffects(); UpdateChannelMaps(); FSoundSource::DrawDebugInfo(); }
HRESULT DShowPlayer::Mute(BOOL bMute) { m_bMute = bMute; return UpdateVolume(); }
HRESULT DShowPlayer::SetVolume(long lVolume) { m_lVolume = lVolume; return UpdateVolume(); }
void PDF::slotPrintButton() { QDir monRepertoire; bool firstpage = true; SeriesInfos.SetChapter(ui->StartChap->value()); monRepertoire.setPath(SeriesInfos.GetChapterFolder()); if (monRepertoire.exists()) { QPdfWriter pdfWriter(SeriesInfos.GetSeriesFolder() + "/" + SeriesInfos.GetSeriesName() + " Tome " + SeriesInfos.GetVolume() + ".pdf"); pdfWriter.setPageSize(QPagedPaintDevice::A4); const qreal horizontalMarginMM = 10.0; // 10 mm margin on each side const qreal verticalMarginMM = 10.0; QPagedPaintDevice::Margins margins; margins.left = margins.right = horizontalMarginMM; margins.top = margins.bottom = verticalMarginMM; pdfWriter.setMargins(margins); QPixmap pixmap; QPainter painter; while ((monRepertoire.exists()) && (ui->EndChap->value() >= SeriesInfos.GetChapter().toInt())) { QStringList listOfFiles = monRepertoire.entryList(); for (int i = 2; i < listOfFiles.size(); i++) { QString imagePath = monRepertoire.absolutePath() + "/" + listOfFiles.at(i); if ((imagePath.contains("jpg")) || (imagePath.contains("png"))) { pixmap.load(imagePath); if (pixmap.width() > pixmap.height()) { if (ui->Vertical->isChecked()) { if (firstpage == false) { pdfWriter.newPage(); } else { painter.begin(&pdfWriter); } QTransform t; pixmap = pixmap.transformed(t.rotate(90),Qt::SmoothTransformation); painter.drawPixmap(QRectF(0, 0, pdfWriter.width(), pdfWriter.height()), pixmap, QRectF(0, 0, pixmap.width(), pixmap.height())); } else { pdfWriter.setPageOrientation(QPageLayout::Landscape); if (firstpage == false) { pdfWriter.newPage(); } else { painter.begin(&pdfWriter); } painter.drawPixmap(QRectF(0, 0, pdfWriter.width(), pdfWriter.height()), pixmap, QRectF(0, 0, pixmap.width(), pixmap.height())); pdfWriter.setPageOrientation(QPageLayout::Portrait); } } else { if (firstpage == false) { pdfWriter.newPage(); } else { painter.begin(&pdfWriter); } painter.drawPixmap(QRectF(0, 0, pdfWriter.width(), pdfWriter.height()), pixmap, QRectF(0, 0, pixmap.width(), pixmap.height())); } firstpage = false; } } SeriesInfos.UpdateChapterVal(); monRepertoire.setPath(SeriesInfos.GetChapterFolder()); } emit UpdateVolume(CurrentIdx); painter.end(); } this->close(); }
void CMultiMix::SetMasterVolume(float Volume) { m_MasterVolBar.SetVolume(Volume); UpdateVolume(); }
SettingsAudioOutput::SettingsAudioOutput(GOrgueSound& sound, GOAudioGroupCallback& callback, wxWindow* parent) : wxPanel(parent, wxID_ANY), m_Sound(sound), m_GroupCallback(callback) { wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL); topSizer->AddSpacer(5); m_AudioOutput = new wxTreeCtrl(this, ID_OUTPUT_LIST, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_SINGLE); topSizer->Add(m_AudioOutput, 1, wxALIGN_LEFT | wxEXPAND); topSizer->AddSpacer(5); wxBoxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL); buttonSizer->AddSpacer(5); m_Change = new wxButton(this, ID_OUTPUT_CHANGE, _("Change")); m_Add = new wxButton(this, ID_OUTPUT_ADD, _("&Add")); m_Del = new wxButton(this, ID_OUTPUT_DEL, _("&Delete")); m_Properties = new wxButton(this, ID_OUTPUT_PROPERTIES, _("Properties")); m_Default = new wxButton(this, ID_OUTPUT_DEFAULT, _("Revert to Default")); buttonSizer->Add(m_Add, 0, wxALIGN_LEFT | wxALL, 5); buttonSizer->Add(m_Del, 0, wxALIGN_LEFT | wxALL, 5); buttonSizer->Add(m_Change, 0, wxALIGN_RIGHT | wxALL, 5); buttonSizer->Add(m_Properties, 0, wxALIGN_RIGHT | wxALL, 5); buttonSizer->Add(m_Default, 0, wxALIGN_RIGHT | wxALL, 5); topSizer->Add(buttonSizer, 0, wxALL, 5); m_AudioOutput->AddRoot(_("Audio Output"), -1, -1, new AudioItemData()); std::vector<GOAudioDeviceConfig> audio_config = m_Sound.GetSettings().GetAudioDeviceConfig(); for(unsigned i = 0; i < audio_config.size(); i++) { wxTreeItemId audio = AddDeviceNode(audio_config[i].name, audio_config[i].desired_latency); for(unsigned j = 0; j < audio_config[i].channels; j++) { wxTreeItemId channel = AddChannelNode(audio, j); if (j >= audio_config[i].scale_factors.size()) continue; for(unsigned k = 0; k < audio_config[i].scale_factors[j].size(); k++) { if (audio_config[i].scale_factors[j][k].left >= -120) { wxTreeItemId group; group = AddGroupNode(channel, audio_config[i].scale_factors[j][k].name, true); UpdateVolume(group, audio_config[i].scale_factors[j][k].left); } if (audio_config[i].scale_factors[j][k].right >= -120) { wxTreeItemId group; group = AddGroupNode(channel, audio_config[i].scale_factors[j][k].name, false); UpdateVolume(group, audio_config[i].scale_factors[j][k].right); } } } } m_AudioOutput->ExpandAll(); m_DeviceList = m_Sound.GetAudioDevices(); topSizer->AddSpacer(5); this->SetSizer(topSizer); topSizer->Fit(this); UpdateButtons(); }
int32_t C4MusicSystem::SetGameMusicLevel(int32_t volume_percent) { game_music_level = Clamp<int32_t>(volume_percent, 0, 500); // allow max 5x the user setting UpdateVolume(); return game_music_level; }
void GstEnginePipeline::SetVolume(int percent) { volume_percent_ = percent; UpdateVolume(); }
void CChanAudio::SetVolume(float Volume) { m_Volume = Volume; UpdateVolume(); }
void GstEnginePipeline::SetVolumeModifier(qreal mod) { volume_modifier_ = mod; UpdateVolume(); }
void CMixereView::SetVolume(float Volume) { if (IsWindow(m_VolumeBar.m_hWnd)) m_VolumeBar.SetVolume(Volume); UpdateVolume(); }
NAudioUnit::NAudioUnit() { int i; OSStatus err; _bInitialized = _bRunning = false; _iLastFrameNr = _iFrameRepeat = 0; _pBuffers[0] = _pBuffers[1] = NULL; _pTempBuf = NULL; // setup sound manager structures SndCallBackUPP callBackUPP = NewSndCallBackUPP(SMCallBackFunc); _sndChannel = NULL; err = SndNewChannel(&_sndChannel, sampledSynth, initMono, callBackUPP); if(err != noErr) { _sndChannel = NULL; NotifyUser(kSoundErrStringNr, kSoundErrStringNr + 1, kOKButtonStringNr); } memset(&_eshHeader, 0, sizeof(_eshHeader)); _eshHeader.numChannels = 1; _eshHeader.encode = extSH; _eshHeader.baseFrequency = kMiddleC; _eshHeader.sampleSize = 16; // allocate sample memory for(i=0; i<4; i++) _pSquares[i] = new double[kSampleSize]; _pTriangle = new double[kSampleSize]; _pNoise = new double[kNoiseSampleSize]; // generate default samples GenSquare16(_pSquares[0], 87.5); GenSquare16(_pSquares[1], 75.0); GenSquare16(_pSquares[2], 50.0); GenSquare16(_pSquares[3], 25.0); GenTriangle16(_pTriangle); GenNoise16(_pNoise); // setup tables _iDMCMaxAmp = 4; _iDMCMinAmp = -4; _fNoiseStepTab[ 0] = 1.0/1.0001831390; _fNoiseStepTab[ 1] = 1.0/1.0001526112; _fNoiseStepTab[ 2] = 1.0/1.0002075626; _fNoiseStepTab[ 3] = 1.0/1.0002197749; _fNoiseStepTab[ 4] = 1.0/1.5772803851; _fNoiseStepTab[ 5] = 1.0/2.3661293817; _fNoiseStepTab[ 6] = 1.0/3.1545304016; _fNoiseStepTab[ 7] = 1.0/3.9398821691; _fNoiseStepTab[ 8] = 1.0/4.9777777778; _fNoiseStepTab[ 9] = 1.0/6.2596469779; _fNoiseStepTab[10] = 1.0/9.3610970036; _fNoiseStepTab[11] = 1.0/12.5176200936; _fNoiseStepTab[12] = 1.0/18.7746371276; _fNoiseStepTab[13] = 1.0/25.0328495034; _fNoiseStepTab[14] = 1.0/50.0529531568; _fNoiseStepTab[15] = 1.0/50.4640657084; _iTimeConvTab[ 0] = 5; _iTimeConvTab[ 1] = 127; _iTimeConvTab[ 2] = 10; _iTimeConvTab[ 3] = 1; _iTimeConvTab[ 4] = 20; _iTimeConvTab[ 5] = 2; _iTimeConvTab[ 6] = 40; _iTimeConvTab[ 7] = 3; _iTimeConvTab[ 8] = 80; _iTimeConvTab[ 9] = 4; _iTimeConvTab[10] = 30; _iTimeConvTab[11] = 5; _iTimeConvTab[12] = 7; _iTimeConvTab[13] = 6; _iTimeConvTab[14] = 14; _iTimeConvTab[15] = 7; _iTimeConvTab[16] = 6; _iTimeConvTab[17] = 8; _iTimeConvTab[18] = 12; _iTimeConvTab[19] = 9; _iTimeConvTab[20] = 24; _iTimeConvTab[21] = 10; _iTimeConvTab[22] = 48; _iTimeConvTab[23] = 11; _iTimeConvTab[24] = 96; _iTimeConvTab[25] = 12; _iTimeConvTab[26] = 36; _iTimeConvTab[27] = 13; _iTimeConvTab[28] = 8; _iTimeConvTab[29] = 14; _iTimeConvTab[30] = 16; _iTimeConvTab[31] = 15; for(i=0; i<16; i++) _fVolTab[i] = sin((1.5707963435/15.0)*((double)i)); // get volume from prefs UpdateVolume(); // initialize playback Initialize(kAPU_44kHz, 1); }