I’m having a hell of a time simply recording sound from individual channels on my ASIO box.
There’s so many conflicting incomplete examples and forum posts from the last 20 years I’m going in circles and am pretty amazed at the lack of working examples in the API demos.
I’m using Unity, but I guess it’s mostly the pure C# part that I’m interested in (I want to manually read the values directly from a recorded clip from 3 separate channels). It seems most of the API and examples assume all sorts of stuff, like 5.1 and I can’t see how to just say “Open driver 2. Record channel 3” like you can in something like Reaper. I can’t see any way to display the ASIO driver channels either.
Any help is appreciated!
I think the best place to look for an example on how to record from a specific audio device is the record_enumeration Core API example available in the FMOD Engine download.
To output a channel on a specific speaker you can use Channel.setMixLevelsOutput
. The best place for an example on how to use this is the multiple_speaker Core API example, also available in the FMOD Engine download.
These examples are all in C++, but if you are only familiar with C# then you can read it approximately with the following guidelines:
- Ignore any
*
- Replace
&
without
- Replace
::
or->
with a.
operator - Replace
nullptr
withIntPtr.Zero
- For example:
//C++
struct RECORD_STATE
{
FMOD::Sound *sound;
FMOD::Channel *channel;
};
//C#
struct RECORD_STATE
{
FMOD.Sound sound;
FMOD.Channel channel;
};
//C++
result = system->createSound("mySound.wav", FMOD_LOOP_NORMAL | FMOD_OPENUSER, nullptr, &sound);
//C#
result = system.createSound("mySound.wav", FMOD_LOOP_NORMAL | FMOD_OPENUSER, IntPtr.Zero, out sound);