-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
using System; | ||
using Microsoft.Win32; | ||
using NAudio.Wave; | ||
using NAudio.Wave.Asio; | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Native_Modem | ||
{ | ||
|
||
|
||
class Program | ||
{ | ||
[STAThread] | ||
static void Main(string[] args) | ||
{ | ||
var Recorder = new Recorder(); | ||
Recorder.printASIODriver(); | ||
Recorder.setupRecordArgs(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,43 @@ | ||
using NAudio.Wave; | ||
using Microsoft.Win32; | ||
using NAudio.Wave; | ||
using NAudio.Wave.Asio; | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Native_Modem | ||
{ | ||
public class Recorder | ||
{ | ||
public Recorder(int AsioDriverIndex = 0) | ||
private AsioOut asioOut; | ||
private string[] asioDriverName; | ||
private IWaveProvider iWaveProvider; | ||
public Recorder(int DriverNameIndex =0 ) | ||
{ | ||
asioOut = new AsioOut(listAsioDricerNames(DriverNameIndex)); | ||
Console.WriteLine("Choosing the Sound Card: {0}", asioDriverName[DriverNameIndex]); | ||
|
||
} | ||
|
||
|
||
public void setupRecordArgs(int inputChannelIndex = 0, int recordChannelCount = 1, int sampleRate = 44100 ) | ||
{ | ||
printASIODriver(); | ||
var drivernames = AsioOut.GetDriverNames(); | ||
var asioOut = new AsioOut(drivernames[AsioDriverIndex]); | ||
var inputChannels = asioOut.DriverInputChannelCount; | ||
asioOut.InputChannelOffset = inputChannelIndex; | ||
Console.WriteLine("We have {0} input recording Channels, and we are choosing the Channel {1}, recordChannelCount {2}, sampleRate {3}", inputChannels, inputChannelIndex, recordChannelCount, sampleRate); | ||
asioOut.InitRecordAndPlayback(iWaveProvider, recordChannelCount, sampleRate); | ||
|
||
} | ||
|
||
public void printASIODriver() | ||
private string listAsioDricerNames(int DriverNameIndex = 0) | ||
{ | ||
var drivernames = AsioOut.GetDriverNames(); | ||
foreach (var drivername in drivernames) | ||
asioDriverName = AsioOut.GetDriverNames(); | ||
foreach(var name in asioDriverName) | ||
{ | ||
Console.WriteLine(drivername); | ||
Console.WriteLine(name); | ||
} | ||
return asioDriverName[DriverNameIndex]; | ||
} | ||
|
||
|
||
} | ||
} |