本文整理汇总了C++中fmod::System::getMasterChannelGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ System::getMasterChannelGroup方法的具体用法?C++ System::getMasterChannelGroup怎么用?C++ System::getMasterChannelGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::System
的用法示例。
在下文中一共展示了System::getMasterChannelGroup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound[6];
FMOD::Channel *channel[6];
FMOD::ChannelGroup *groupA, *groupB, *masterGroup;
FMOD_RESULT result;
int key, count;
unsigned int version;
/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
printf("Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
return 0;
}
result = system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
result = system->createSound("../media/drumloop.wav", FMOD_LOOP_NORMAL, 0, &sound[0]);
ERRCHECK(result);
result = system->createSound("../media/jaguar.wav", FMOD_LOOP_NORMAL, 0, &sound[1]);
ERRCHECK(result);
result = system->createSound("../media/swish.wav", FMOD_LOOP_NORMAL, 0, &sound[2]);
ERRCHECK(result);
result = system->createSound("../media/c.ogg", FMOD_LOOP_NORMAL, 0, &sound[3]);
ERRCHECK(result);
result = system->createSound("../media/d.ogg", FMOD_LOOP_NORMAL, 0, &sound[4]);
ERRCHECK(result);
result = system->createSound("../media/e.ogg", FMOD_LOOP_NORMAL, 0, &sound[5]);
ERRCHECK(result);
result = system->createChannelGroup("Group A", &groupA);
ERRCHECK(result);
result = system->createChannelGroup("Group B", &groupB);
ERRCHECK(result);
result = system->getMasterChannelGroup(&masterGroup);
ERRCHECK(result);
printf("=======================================================================\n");
printf("ChannelGroups Example. Copyright (c) Firelight Technologies 2004-2014.\n");
printf("=======================================================================\n");
printf("\n");
printf("Group A : drumloop.wav, jaguar.wav, swish.wav\n");
printf("Group B : c.ogg, d.ogg, e.ogg\n");
printf("\n");
printf("Press 'A' to mute/unmute group A\n");
printf("Press 'B' to mute/unmute group B\n");
printf("Press 'C' to mute/unmute group A and B (master group)\n");
printf("Press 'Esc' to quit\n");
printf("\n");
/*
Instead of being independent, set the group A and B to be children of the master group.
*/
result = masterGroup->addGroup(groupA);
ERRCHECK(result);
result = masterGroup->addGroup(groupB);
ERRCHECK(result);
/*
Start all the sounds!
*/
for (count = 0; count < 6; count++)
{
result = system->playSound(FMOD_CHANNEL_FREE, sound[count], true, &channel[count]);
ERRCHECK(result);
if (count < 3)
{
result = channel[count]->setChannelGroup(groupA);
}
else
{
result = channel[count]->setChannelGroup(groupB);
}
ERRCHECK(result);
result = channel[count]->setPaused(false);
ERRCHECK(result);
}
/*
Change the volume of each group, just because we can! (And makes it less noise).
*/
result = groupA->setVolume(0.5f);
ERRCHECK(result);
result = groupB->setVolume(0.5f);
ERRCHECK(result);
//.........这里部分代码省略.........
示例2: FMOD_Main
int FMOD_Main()
{
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel;
FMOD::DSP *mydsp;
FMOD::ChannelGroup *mastergroup;
FMOD_RESULT result;
unsigned int version;
void *extradriverdata = 0;
Common_Init(&extradriverdata);
/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
Common_Fatal("FMOD lib version %08x doesn't match header version %08x", version, FMOD_VERSION);
}
result = system->init(32, FMOD_INIT_NORMAL, extradriverdata);
ERRCHECK(result);
result = system->createSound(Common_MediaPath("drumloop.wav"), FMOD_SOFTWARE | FMOD_LOOP_NORMAL, 0, &sound);
ERRCHECK(result);
result = system->playSound(sound, 0, false, &channel);
ERRCHECK(result);
/*
Create the DSP effect.
*/
{
FMOD_DSP_DESCRIPTION dspdesc;
memset(&dspdesc, 0, sizeof(dspdesc));
strncpy(dspdesc.name, "My first DSP unit", sizeof(dspdesc.name));
dspdesc.version = 0x00010000;
dspdesc.numinputbuffers = 1;
dspdesc.numoutputbuffers = 1;
dspdesc.read = myDSPCallback;
dspdesc.userdata = (void *)0x12345678;
result = system->createDSP(&dspdesc, &mydsp);
ERRCHECK(result);
}
/*
Attach the DSP, inactive by default.
*/
result = mydsp->setBypass(true);
ERRCHECK(result);
result = system->getMasterChannelGroup(&mastergroup);
ERRCHECK(result);
result = mastergroup->addDSP(0, mydsp, 0);
ERRCHECK(result);
/*
Main loop.
*/
do
{
bool bypass;
Common_Update();
result = mydsp->getBypass(&bypass);
ERRCHECK(result);
if (Common_BtnPress(BTN_ACTION1))
{
bypass = !bypass;
result = mydsp->setBypass(bypass);
ERRCHECK(result);
}
result = system->update();
ERRCHECK(result);
Common_Draw("==================================================");
Common_Draw("Custom DSP Example.");
Common_Draw("Copyright (c) Firelight Technologies 2004-2014.");
Common_Draw("==================================================");
Common_Draw("");
Common_Draw("Press %s to toggle filter bypass", Common_BtnStr(BTN_ACTION1));
Common_Draw("Press %s to quit", Common_BtnStr(BTN_QUIT));
Common_Draw("");
Common_Draw("Filter is %s", bypass ? "inactive" : "active");
Common_Sleep(50);
//.........这里部分代码省略.........
示例3: FMOD_Main
int FMOD_Main()
{
FMOD::System *system = 0;
FMOD::Sound *sound = 0;
FMOD::Channel *channel = 0;
FMOD::ChannelGroup *mastergroup = 0;
FMOD::DSP *dsplowpass = 0;
FMOD::DSP *dsphighpass = 0;
FMOD::DSP *dspecho = 0;
FMOD::DSP *dspflange = 0;
FMOD_RESULT result;
unsigned int version;
void *extradriverdata = 0;
Common_Init(&extradriverdata);
/*
Create a System object and initialize
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
Common_Fatal("FMOD lib version %08x doesn't match header version %08x", version, FMOD_VERSION);
}
result = system->init(32, FMOD_INIT_NORMAL, extradriverdata);
ERRCHECK(result);
result = system->getMasterChannelGroup(&mastergroup);
ERRCHECK(result);
result = system->createSound(Common_MediaPath("drumloop.wav"), FMOD_DEFAULT, 0, &sound);
ERRCHECK(result);
result = system->playSound(sound, 0, false, &channel);
ERRCHECK(result);
/*
Create some effects to play with
*/
result = system->createDSPByType(FMOD_DSP_TYPE_LOWPASS, &dsplowpass);
ERRCHECK(result);
result = system->createDSPByType(FMOD_DSP_TYPE_HIGHPASS, &dsphighpass);
ERRCHECK(result);
result = system->createDSPByType(FMOD_DSP_TYPE_ECHO, &dspecho);
ERRCHECK(result);
result = system->createDSPByType(FMOD_DSP_TYPE_FLANGE, &dspflange);
ERRCHECK(result);
/*
Add them to the master channel group. Each time an effect is added (to position 0) it pushes the others down the list.
*/
result = mastergroup->addDSP(0, dsplowpass);
ERRCHECK(result);
result = mastergroup->addDSP(0, dsphighpass);
ERRCHECK(result);
result = mastergroup->addDSP(0, dspecho);
ERRCHECK(result);
result = mastergroup->addDSP(0, dspflange);
ERRCHECK(result);
/*
By default, bypass all effects. This means let the original signal go through without processing.
It will sound 'dry' until effects are enabled by the user.
*/
result = dsplowpass->setBypass(true);
ERRCHECK(result);
result = dsphighpass->setBypass(true);
ERRCHECK(result);
result = dspecho->setBypass(true);
ERRCHECK(result);
result = dspflange->setBypass(true);
ERRCHECK(result);
/*
Main loop
*/
do
{
Common_Update();
if (Common_BtnPress(BTN_MORE))
{
bool paused;
result = channel->getPaused(&paused);
ERRCHECK(result);
paused = !paused;
result = channel->setPaused(paused);
ERRCHECK(result);
}
if (Common_BtnPress(BTN_ACTION1))
//.........这里部分代码省略.........
示例4: main
int main(int ac, const char **av)
{
// Create application window
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, LoadCursor(NULL, IDC_ARROW), NULL, NULL, _T("Douceur"), NULL };
RegisterClassEx(&wc);
HWND hwnd = CreateWindow(_T("Douceur"), _T("Douceur"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
// Initialize Direct3D
if (CreateDeviceD3D(hwnd) < 0)
{
CleanupDeviceD3D();
UnregisterClass(_T("Douceur"), wc.hInstance);
return 1;
}
// Show the window
ShowWindow(hwnd, SW_SHOWDEFAULT);
UpdateWindow(hwnd);
// Setup ImGui binding
ImGui_ImplDX11_Init(hwnd, g_pd3dDevice, g_pd3dDeviceContext);
// Load Fonts
// (there is a default font, this is only if you want to change it. see extra_fonts/README.txt for more details)
//ImGuiIO& io = ImGui::GetIO();
//io.Fonts->AddFontDefault();
//io.Fonts->AddFontFromFileTTF("../../extra_fonts/Cousine-Regular.ttf", 15.0f);
//io.Fonts->AddFontFromFileTTF("../../extra_fonts/DroidSans.ttf", 16.0f);
//io.Fonts->AddFontFromFileTTF("../../extra_fonts/ProggyClean.ttf", 13.0f);
//io.Fonts->AddFontFromFileTTF("../../extra_fonts/ProggyTiny.ttf", 10.0f);
//io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
bool show_test_window = true;
ImVec4 clear_col = ImColor(114, 144, 154);
// Main loop
MSG msg;
ZeroMemory(&msg, sizeof(msg));
std::string arduinoMsg;
std::string arduinoDisplayMsg;
bool messageEnded = true;
FMOD::System *fmodSystem;
FMOD::System_Create(&fmodSystem);
FMOD::Sound *sound = 0;
FMOD::Channel *channel = 0;
FMOD::ChannelGroup *mastergroup = 0;
fmodSystem->init(128, FMOD_INIT_NORMAL, 0);
fmodSystem->getMasterChannelGroup(&mastergroup);
fmodSystem->createSound("../DouceurExternal/audio-samples/Yamaha-1.wav", FMOD_LOOP_NORMAL, 0, &sound);
unsigned int soundLength = 0;
sound->getLength(&soundLength, FMOD_TIMEUNIT_MS);
Serial arduino("COM6");
Board board(fmodSystem);
while (msg.message != WM_QUIT)
{
fmodSystem->update();
if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
continue;
}
ImGui_ImplDX11_NewFrame();
static bool first = true;
static int from = 0;
static int to = 400;
static float freq = 1.f;
static float pan = 0.f;
static float pitch = 0.f;
if (!first)
{
fmodSystem->playSound(sound, mastergroup, false, &channel);
first = true;
to = soundLength;
channel->getFrequency(&freq);
channel->getPitch(&pitch);
}
{
ImGui::SetNextWindowPos(ImVec2(10, 10));
ImGui::Begin("FPS", nullptr, ImVec2(0, 0), 0.3f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
ImGui::End();
}
if (false)
{
ImGui::Begin("SoloudTest");
bool changed = ImGui::SliderInt("from", (int*)&from, 0, soundLength - 1);
//.........这里部分代码省略.........
示例5: ResumePlayback
void FMOD_System::ResumePlayback()
{
FMOD::ChannelGroup *masterGroup;
system->getMasterChannelGroup( &masterGroup );
masterGroup->setPaused( false );
}
示例6: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
int key;
unsigned int version;
/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
printf("Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
return 0;
}
result = system->init(1, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
result = system->createStream("../media/wave.mp3", FMOD_HARDWARE | FMOD_LOOP_NORMAL | FMOD_2D, 0, &sound);
ERRCHECK(result);
printf("====================================================================\n");
printf("PlayStream Example. Copyright (c) Firelight Technologies 2004-2011.\n");
printf("====================================================================\n");
printf("\n");
printf("Press space to pause, Esc to quit\n");
printf("\n");
/*
Play the sound.
*/
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
ERRCHECK(result);
/*
Main loop.
*/
do
{
if (_kbhit())
{
key = _getch();
switch (key)
{
case ' ' :
{
bool paused;
channel->getPaused(&paused);
channel->setPaused(!paused);
break;
}
case 'p' :
{
FMOD::ChannelGroup* masterGroup = NULL;
system->getMasterChannelGroup(&masterGroup);
if (masterGroup)
{
bool paused;
masterGroup->getPaused(&paused);
masterGroup->setPaused(!paused);
}
break;
}
}
}
system->update();
if (channel)
{
unsigned int ms;
unsigned int lenms;
bool playing;
bool paused;
result = channel->isPlaying(&playing);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
{
ERRCHECK(result);
}
result = channel->getPaused(&paused);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
{
ERRCHECK(result);
}
result = channel->getPosition(&ms, FMOD_TIMEUNIT_MS);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
//.........这里部分代码省略.........
示例7: FMOD_Main
int FMOD_Main()
{
FMOD::System *system;
FMOD::Sound *sound[6];
FMOD::Channel *channel[6];
FMOD::ChannelGroup *groupA, *groupB, *masterGroup;
FMOD_RESULT result;
int count;
unsigned int version;
void *extradriverdata = 0;
Common_Init(&extradriverdata);
/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
Common_Fatal("FMOD lib version %08x doesn't match header version %08x", version, FMOD_VERSION);
}
result = system->init(32, FMOD_INIT_NORMAL, extradriverdata);
ERRCHECK(result);
result = system->createSound(Common_MediaPath("drumloop.wav"), FMOD_LOOP_NORMAL, 0, &sound[0]);
ERRCHECK(result);
result = system->createSound(Common_MediaPath("jaguar.wav"), FMOD_LOOP_NORMAL, 0, &sound[1]);
ERRCHECK(result);
result = system->createSound(Common_MediaPath("swish.wav"), FMOD_LOOP_NORMAL, 0, &sound[2]);
ERRCHECK(result);
result = system->createSound(Common_MediaPath("c.ogg"), FMOD_LOOP_NORMAL, 0, &sound[3]);
ERRCHECK(result);
result = system->createSound(Common_MediaPath("d.ogg"), FMOD_LOOP_NORMAL, 0, &sound[4]);
ERRCHECK(result);
result = system->createSound(Common_MediaPath("e.ogg"), FMOD_LOOP_NORMAL, 0, &sound[5]);
ERRCHECK(result);
result = system->createChannelGroup("Group A", &groupA);
ERRCHECK(result);
result = system->createChannelGroup("Group B", &groupB);
ERRCHECK(result);
result = system->getMasterChannelGroup(&masterGroup);
ERRCHECK(result);
/*
Instead of being independent, set the group A and B to be children of the master group.
*/
result = masterGroup->addGroup(groupA);
ERRCHECK(result);
result = masterGroup->addGroup(groupB);
ERRCHECK(result);
/*
Start all the sounds.
*/
for (count = 0; count < 6; count++)
{
result = system->playSound(sound[count], 0, true, &channel[count]);
ERRCHECK(result);
result = channel[count]->setChannelGroup((count < 3) ? groupA : groupB);
ERRCHECK(result);
result = channel[count]->setPaused(false);
ERRCHECK(result);
}
/*
Change the volume of each group, just because we can! (reduce overall noise).
*/
result = groupA->setVolume(0.5f);
ERRCHECK(result);
result = groupB->setVolume(0.5f);
ERRCHECK(result);
/*
Main loop.
*/
do
{
Common_Update();
if (Common_BtnPress(BTN_ACTION1))
{
bool mute = true;
groupA->getMute(&mute);
groupA->setMute(!mute);
}
if (Common_BtnPress(BTN_ACTION2))
{
bool mute = true;
//.........这里部分代码省略.........
示例8: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound[5];
FMOD::Channel *channel[5];
FMOD::ChannelGroup *groupA, *groupB, *masterGroup;
FMOD::DSP *dspreverb, *dspflange, *dsplowpass;
FMOD_RESULT result;
int key, count;
unsigned int version;
/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
printf("Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
return 0;
}
result = system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
result = system->createSound("../media/drumloop.wav", FMOD_SOFTWARE | FMOD_LOOP_NORMAL, 0, &sound[0]);
ERRCHECK(result);
result = system->createSound("../media/jaguar.wav", FMOD_SOFTWARE | FMOD_LOOP_NORMAL, 0, &sound[1]);
ERRCHECK(result);
result = system->createSound("../media/c.ogg", FMOD_SOFTWARE | FMOD_LOOP_NORMAL, 0, &sound[2]);
ERRCHECK(result);
result = system->createSound("../media/d.ogg", FMOD_SOFTWARE | FMOD_LOOP_NORMAL, 0, &sound[3]);
ERRCHECK(result);
result = system->createSound("../media/e.ogg", FMOD_SOFTWARE | FMOD_LOOP_NORMAL, 0, &sound[4]);
ERRCHECK(result);
result = system->createChannelGroup("Group A", &groupA);
ERRCHECK(result);
result = system->createChannelGroup("Group B", &groupB);
ERRCHECK(result);
result = system->getMasterChannelGroup(&masterGroup);
ERRCHECK(result);
result = masterGroup->addGroup(groupA);
ERRCHECK(result);
result = masterGroup->addGroup(groupB);
ERRCHECK(result);
printf("======================================================================\n");
printf("Sub-mixing example. Copyright (c) Firelight Technologies 2004-2014.\n");
printf("======================================================================\n");
printf(" (drumloop.wav) \n");
printf(" / \n");
printf(" (groupA) \n");
printf(" (reverb)/ \\ \n");
printf(" / (jaguar.wav) \n");
printf("(soundcard)--(lowpass)--(mastergroup) \n");
printf(" \\ (c.ogg) \n");
printf(" (flange) / \n");
printf(" \\(groupB)--(d.ogg) \n");
printf(" \\ \n");
printf(" (e.ogg) \n");
printf("Press 'A' to mute/unmute group A\n");
printf("Press 'B' to mute/unmute group B\n");
printf("\n");
printf("Press 'R' to place reverb on group A\n");
printf("Press 'F' to place flange on group B\n");
printf("Press 'L' to place lowpass on master group (everything)\n");
printf("Press 'Esc' to quit\n");
printf("\n");
/*
Start all the sounds!
*/
for (count = 0; count < 5; count++)
{
result = system->playSound(FMOD_CHANNEL_FREE, sound[count], true, &channel[count]);
ERRCHECK(result);
if (count < 2)
{
result = channel[count]->setChannelGroup(groupA);
}
else
{
result = channel[count]->setChannelGroup(groupB);
}
ERRCHECK(result);
result = channel[count]->setPaused(false);
ERRCHECK(result);
}
/*
Create the DSP effects we want to apply to our submixes.
//.........这里部分代码省略.........