本文整理汇总了C++中Voice类的典型用法代码示例。如果您正苦于以下问题:C++ Voice类的具体用法?C++ Voice怎么用?C++ Voice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Voice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: QPointF
void NoteEntryAction::renderKeyboardPreview(QPainter& painter, const MusicCursor& cursor)
{
Staff* staff = cursor.staff();
Part* part = staff->part();
Sheet* sheet = part->sheet();
Bar* bar = sheet->bar(cursor.bar());
QPointF p = bar->position() + QPointF(0, staff->top());
Voice* voice = cursor.staff()->part()->voice(cursor.voice());
VoiceBar* vb = voice->bar(bar);
if (cursor.element() >= vb->elementCount()) {
// cursor is past last element in bar, position of cursor is
// halfway between last element and end of bar
if (vb->elementCount() == 0) {
// unless entire voicebar is still empty
p.rx() += 15.0;
} else {
VoiceElement* ve = vb->element(vb->elementCount()-1);
p.rx() += (ve->x() + bar->size()) / 2;
}
} else {
// cursor is on an element, get the position of that element
p.rx() += vb->element(cursor.element())->x();
}
p.ry() += (cursor.staff()->lineCount() - 1)* cursor.staff()->lineSpacing();
p.ry() -= cursor.staff()->lineSpacing() * cursor.line() / 2;
m_tool->shape()->renderer()->renderNote(painter, m_duration < QuarterNote ? QuarterNote : m_duration, p, 0, Qt::magenta);
}
开发者ID:KDE,项目名称:calligra-history,代码行数:30,代码来源:NoteEntryAction.cpp
示例2: assert
bool VoiceManager::stopVoice(NoteUniqueId ID)
{
assert(_initialised);
// find the note in the active note map
ActiveVoiceList::iterator iter = activeVoices.find(ID);
// note not active?!
if(iter == activeVoices.end())
return false;
// release the note
Voice* v = iter->second.voice();
v->release();
// add to inactive voices vector
inactiveVoices.push_back(v);
// remove from active voices map
activeVoices.erase(iter);
assert(_sanityCheck());
// reset note counter on silence
if(activeVoices.empty() && inactiveVoices.empty())
{
_counter = 0;
}
return true;
}
开发者ID:itsthejb,项目名称:HotPants,代码行数:27,代码来源:VoiceManager.cpp
示例3: _freeAllVoices
// kill all voices and move to free stack
void VoiceManager::_freeAllVoices()
{
if(!_initialised)
return;
Voice* v;
// active voices
ActiveVoiceList::iterator iter1;
for(iter1 = activeVoices.begin();
iter1 != activeVoices.end();
++iter1)
{
v = iter1->second.voice();
v->kill();
freeVoices.push(v);
}
activeVoices.clear();
// inactive voices
InactiveVoiceList::iterator iter2;
for(iter2 = inactiveVoices.begin();
iter2 != inactiveVoices.end();
++iter2)
{
v = *iter2;
v->kill();
freeVoices.push(v);
}
inactiveVoices.clear();
// reset the note age counter
_counter = 0;
}
开发者ID:itsthejb,项目名称:HotPants,代码行数:35,代码来源:VoiceManager.cpp
示例4: setPolyphony
void VoiceHandler::process() {
global_router_.process();
int polyphony = static_cast<int>(input(kPolyphony)->at(0));
setPolyphony(utils::iclamp(polyphony, 1, polyphony));
for (int i = 0; i < numOutputs(); ++i) {
int buffer_size = voice_outputs_[i]->owner->getBufferSize();
memset(output(i)->buffer, 0, buffer_size * sizeof(mopo_float));
}
std::list<Voice*>::iterator iter = active_voices_.begin();
while (iter != active_voices_.end()) {
Voice* voice = *iter;
prepareVoiceTriggers(voice);
processVoice(voice);
// Remove voice if the right processor has a full silent buffer.
if (voice_killer_ && voice->state().event != kVoiceOn &&
utils::isSilent(voice_killer_->buffer, buffer_size_)) {
free_voices_.push_back(voice);
iter = active_voices_.erase(iter);
}
else
iter++;
}
}
开发者ID:drstkova,项目名称:helm,代码行数:26,代码来源:voice_handler.cpp
示例5: new_voice
void Prog::initial_config()
{
Voice *voice = new_voice();
if (!voice) {
abort_example("Could not create initial voice.\n");
}
voice->set_pos(300, 50);
Mixer *mixer = new_mixer();
mixer->set_pos(300, 150);
voice->attach(mixer);
SampleInstance *splinst = new_sample_instance();
splinst->set_pos(220, 300);
mixer->attach(splinst);
splinst->toggle_playing();
SampleInstance *splinst2 = new_sample_instance();
splinst2->set_pos(120, 240);
mixer->attach(splinst2);
splinst2->toggle_playing();
Mixer *mixer2 = new_mixer();
mixer2->set_pos(500, 250);
mixer->attach(mixer2);
Audiostream *stream;
if ((stream = new_audiostream())) {
stream->set_pos(450, 350);
mixer2->attach(stream);
}
}
开发者ID:gitustc,项目名称:d2imdev,代码行数:32,代码来源:ex_audio_chain.cpp
示例6: Release
void AudioThread::ReleaseVoice(uint8_t MIDIKey, uint8_t Velocity) {
Voice* pVoice = ActiveVoices[MIDIKey];
if (pVoice) {
pVoice->Kill(); //TODO: for now we're rude and just kill the poor, poor voice immediately :), later we add a Release() method to the Voice class and call it here to let the voice go through it's release phase
ActiveVoices[MIDIKey] = NULL;
}
else std::cerr << "Couldn't find active voice for note off command!" << std::endl << std::flush;
}
开发者ID:svn2github,项目名称:linuxsampler,代码行数:8,代码来源:audiothread.cpp
示例7: allNotesOff
void Zerberus::allNotesOff(int channel)
{
busy = true;
for (Voice* v = activeVoices; v; v = v->next()) {
if (channel == -1 || (v->channel()->idx() == channel))
v->stop();
}
busy = false;
}
开发者ID:BlueMockingbird,项目名称:MuseScore,代码行数:9,代码来源:zerberus.cpp
示例8: sustainOff
void VoiceHandler::sustainOff() {
sustain_ = false;
std::list<Voice*>::iterator iter = sustained_voices_.begin();
for (; iter != sustained_voices_.end(); ++iter) {
Voice* voice = *iter;
voice->deactivate();
}
sustained_voices_.clear();
}
开发者ID:CCCP67,项目名称:cursynth,代码行数:9,代码来源:voice_handler.cpp
示例9: setOscillatorPitchMod
static void setOscillatorPitchMod(Voice& voice, int oscillatorNumber, double amount) {
switch (oscillatorNumber) {
case 1:
voice.setOscillatorOnePitchAmount(amount);
break;
case 2:
voice.setOscillatorTwoPitchAmount(amount);
break;
}
}
开发者ID:Add9Sus4,项目名称:Synthesis,代码行数:10,代码来源:VoiceManager.hpp
示例10: findFreeVoice
void VoiceManager::onNoteOn(int noteNumber, int velocity) {
Voice* voice = findFreeVoice();
if (!voice) {
return;
}
voice->reset();
voice->setNoteNumber(noteNumber);
voice->mVelocity = velocity;
voice->isActive = true;
voice->mVolumeEnvelope.enterStage(EnvelopeGenerator::ENVELOPE_STAGE_ATTACK);
voice->mFilterEnvelope.enterStage(EnvelopeGenerator::ENVELOPE_STAGE_ATTACK);
}
开发者ID:wpank,项目名称:PancakeHouse,代码行数:12,代码来源:VoiceManager.cpp
示例11: Voice
Voice *Prog::new_voice()
{
Voice *voice = new Voice();
if (voice->valid()) {
elements.push_back(voice);
}
else {
delete voice;
voice = NULL;
}
return voice;
}
开发者ID:gitustc,项目名称:d2imdev,代码行数:12,代码来源:ex_audio_chain.cpp
示例12: playNote
void playNote(int note) {
Voice* best = &voices[0];
double busy = best->getBusiness();
for (Voice& v : voices) {
double b = v.getBusiness();
if (b < busy) {
busy = b;
best = &v;
}
}
best->play(note);
}
开发者ID:2bt,项目名称:little-synths,代码行数:12,代码来源:main.cpp
示例13: MOPO_ASSERT
void VoiceHandler::noteOn(mopo_float note, mopo_float velocity, int sample, int channel) {
MOPO_ASSERT(sample >= 0 && sample < buffer_size_);
MOPO_ASSERT(channel >= 0 && channel < NUM_MIDI_CHANNELS);
Voice* voice = grabVoice();
pressed_notes_.push_front(note);
if (last_played_note_ < 0)
last_played_note_ = note;
voice->activate(note, velocity, last_played_note_, pressed_notes_.size(), sample, channel);
active_voices_.push_back(voice);
last_played_note_ = note;
}
开发者ID:drstkova,项目名称:helm,代码行数:13,代码来源:voice_handler.cpp
示例14: MidiNote
void mi::MidiNote(int const channel, int const value, int const velocity)
{
Voice * v;
if(velocity > 0)
{
v = voice_manager->GetVoice();
v->SetMidiNote(value);
voice_manager->TriggerNewVoice(helper::midinote_to_buzz(value), filter_freq, v);
}
if(velocity == 0)
{
voice_manager->InitiateReleaseForMidiNote(value);
}
}
开发者ID:eriser,项目名称:buzzmachines,代码行数:14,代码来源:SyndSynth.cpp
示例15: while
void Zerberus::process(unsigned frames, float* p, float*, float*)
{
if (busy)
return;
while (!midiEvents.empty())
process(midiEvents.pop());
Voice* v = activeVoices;
Voice* pv = 0;
int n = 0;
int nn = 0;
while (v) {
++nn;
v->process(frames, p);
if (v->isOff()) {
if (pv)
pv->setNext(v->next());
else
activeVoices = v->next();
++n;
freeVoices.push(v);
}
else
pv = v;
v = v->next();
}
}
开发者ID:michaelf87,项目名称:MuseScore,代码行数:27,代码来源:zerberus.cpp
示例16: mousePress
void NoteEntryAction::mousePress(Staff* staff, int bar, const QPointF& pos)
{
Clef* clef = staff->lastClefChange(bar);
Voice* voice = staff->part()->voice(m_tool->voice());
VoiceBar* vb = voice->bar(bar);
// find element before which to insert the chord
int before = 0;
for (int i = 0; i < vb->elementCount(); i++) {
VoiceElement* e = vb->element(i);
if (e->x() >= pos.x()) break;
before++;
}
int line = staff->line(pos.y());
int pitch = 0, accidentals = 0;
if (clef && !m_isRest) {
pitch = clef->lineToPitch(line);
// get correct accidentals for note
KeySignature* ks = staff->lastKeySignatureChange(bar);
if (ks) accidentals = ks->accidentals(pitch);
for (int i = 0; i < before; i++) {
Chord* c = dynamic_cast<Chord*>(vb->element(i));
if (!c) continue;
for (int n = 0; n < c->noteCount(); n++) {
if (c->note(n)->pitch() == pitch) {
accidentals = c->note(n)->accidentals();
}
}
}
}
Chord* join = NULL;
if (before > 0) join = dynamic_cast<Chord*>(vb->element(before-1));
if (join && join->x() + join->width() >= pos.x()) {
if (clef && !m_isRest) {
m_tool->addCommand(new AddNoteCommand(m_tool->shape(), join, staff, m_duration, pitch, accidentals));
} else {
m_tool->addCommand(new MakeRestCommand(m_tool->shape(), join));
}
} else {
if (clef && !m_isRest) {
m_tool->addCommand(new CreateChordCommand(m_tool->shape(), vb, staff, m_duration, before, pitch, accidentals));
} else {
m_tool->addCommand(new CreateChordCommand(m_tool->shape(), vb, staff, m_duration, before));
}
}
}
开发者ID:KDE,项目名称:calligra-history,代码行数:49,代码来源:NoteEntryAction.cpp
示例17: noteOn
void VoiceHandler::noteOn(mopo_float note, mopo_float velocity) {
Voice* voice = 0;
pressed_notes_.push_back(note);
if (free_voices_.size() && active_voices_.size() < polyphony_) {
voice = free_voices_.front();
free_voices_.pop_front();
}
else {
voice = active_voices_.front();
active_voices_.pop_front();
}
voice->activate(note, velocity);
active_voices_.push_back(voice);
}
开发者ID:CCCP67,项目名称:cursynth,代码行数:15,代码来源:voice_handler.cpp
示例18: StopByOwner
//
// StopByOwner
//
// Stop all voices with the given owner id
//
void StopByOwner(U32 id)
{
if (Initialized())
{
for (U32 i = 0; i < totalVoices; i++)
{
// Get the voice at this index
Voice *voice = voices[i];
if (voice->owner == id)
{
voice->Stop();
}
}
}
}
开发者ID:grasmanek94,项目名称:darkreign2,代码行数:21,代码来源:sound_digital_output.cpp
示例19: while
void VoiceHandler::setPolyphony(size_t polyphony) {
while (all_voices_.size() < polyphony) {
Voice* new_voice = createVoice();
all_voices_.push_back(new_voice);
active_voices_.push_back(new_voice);
}
int num_voices_to_kill = active_voices_.size() - polyphony;
for (int i = 0; i < num_voices_to_kill; ++i) {
Voice* sacrifice = getVoiceToKill();
if (sacrifice)
sacrifice->kill();
}
polyphony_ = polyphony;
}
开发者ID:drstkova,项目名称:helm,代码行数:16,代码来源:voice_handler.cpp
示例20: _wipeLists
void VoiceManager::initialise(SamplingRate rate)
{
// initialise all voices with the sampling rate
_wipeLists();
for(unsigned int i = 0; i < kMaxPolyphony; ++i)
{
Voice* v = new Voice(core);
v->initialise(rate);
freeVoices.push(v);
}
inactiveVoices.reserve(kMaxPolyphony);
assert(freeVoices.size() == kMaxPolyphony);
_freeAllVoices();
_initialised = true;
}
开发者ID:itsthejb,项目名称:HotPants,代码行数:16,代码来源:VoiceManager.cpp
注:本文中的Voice类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论