Skip to content

Commit

Permalink
fixed frequency and default selected device
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadMD1383 committed Jul 25, 2024
1 parent aec7330 commit b56c8a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SoundLooper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ class SoundLooper final : public QObject {
}

Q_INVOKABLE void start() {
if (not BASS_Init(-1, 48'000, BASS_DEVICE_DEFAULT, nullptr, nullptr))
if (not BASS_Init(-1, 96'000, BASS_DEVICE_DEFAULT, nullptr, nullptr))
exit(-10);

if (not BASS_RecordInit(2))
if (not BASS_RecordInit(0))
exit(-11);

recording = BASS_RecordStart(96'000, 1, 0, nullptr, nullptr);
if (not recording)
exit(-12);

stream = BASS_StreamCreate(48'000, 2, 0, &streamRecordProc, this);
stream = BASS_StreamCreate(96'000, 1, 0, &streamRecordProc, this);
if (not stream)
exit(-13);

Expand Down
11 changes: 11 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <iostream>
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
Expand All @@ -17,6 +18,16 @@ int main(int argc, char* argv[]) {
QQmlApplicationEngine engine;
const QUrl url("qrc:/qml/main.qml");

std::cout << "+++++++ Input Devices:" << std::endl;
for (const auto&info: SoundLooper::getAllRecordingDevices()) {
std::cout << info.id << " | " << info.name << std::endl;
}
std::cout << "+++++++ Output Devices:" << std::endl;
for (const auto&info: SoundLooper::getAllOutputDevices()) {
std::cout << info.id << " | " << info.name << std::endl;
}
std::cout << std::flush;

SoundLooper looper;
engine.rootContext()->setContextProperty("soundLooper", &looper);
engine.load(url);
Expand Down

0 comments on commit b56c8a1

Please sign in to comment.