Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for recent alsa libs

  • Loading branch information...
commit 461a02891d3ac0bffb55c75e95a911298935515e 1 parent 135c84b
flithm authored
Showing with 10 additions and 8 deletions.
  1. +7 −5 libGizmod/Alsa.cpp
  2. +3 −3 libGizmod/AlsaSoundCard.cpp
View
12 libGizmod/Alsa.cpp
@@ -112,15 +112,17 @@ void Alsa::init() {
shutdown();
// initialize
- int ret = -1, CardID;
+ int ret = -1;
+ int CardID = -1;
do {
// get the next sound card
- if ((CardID = snd_card_next(&ret)) < 0) {
- cerr << "Failed to Query Sound Card [" << ret + 1 << "] -- Error Code: " << CardID;
+ if ((ret = snd_card_next(&CardID)) < 0) {
+ cerr << "Failed to Query Sound Card [" << CardID + 1 << "] -- Error Code: " << ret << endl;
continue;
}
- if (ret > -1) {
+ if (CardID > -1) {
try {
+ cdbg3 << "Initializing Sound Card [" << CardID << "] w/ret [" << ret << "]..." << endl;
shared_ptr<AlsaSoundCard> pSoundCard = shared_ptr<AlsaSoundCard>(new AlsaSoundCard(this, CardID));
mSoundCards.push_back(pSoundCard);
} catch (H::Exception & e) {
@@ -128,7 +130,7 @@ void Alsa::init() {
cdbg1 << e.getExceptionMessage() << endl;
}
}
- } while (ret != -1);
+ } while (CardID != -1);
}
/**
View
6 libGizmod/AlsaSoundCard.cpp
@@ -203,15 +203,15 @@ void AlsaSoundCard::init() {
mCardHWID = str(format("hw:%1%") % mCardID);
// get the card name
- char * Name;
- if (snd_card_get_name(mCardID, &Name) == -1) {
+ char * Name = NULL;
+ if (snd_card_get_name(mCardID, &Name) < 0) {
mCardName = CARD_NAME_UNKNOWN;
cdbg << "Failed to retreive name of Sound Card [" << mCardID << "]" << endl;
} else
mCardName = Name;
// long name
- if (snd_card_get_longname(mCardID, &Name) == -1) {
+ if (snd_card_get_longname(mCardID, &Name) < 0) {
mCardNameLong = CARD_NAME_UNKNOWN;
cdbg << "Failed to retreive long name of Sound Card [" << mCardID << "]" << endl;
} else

0 comments on commit 461a028

Please sign in to comment.
Something went wrong with that request. Please try again.