3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
* Copyright (C) 2005 - 2020 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
744 |
* Entry point for the thread. |
* Entry point for the thread. |
745 |
*/ |
*/ |
746 |
int AudioOutputDeviceAlsa::Main() { |
int AudioOutputDeviceAlsa::Main() { |
747 |
|
#if DEBUG |
748 |
|
Thread::setNameOfCaller("AlsaAudio"); |
749 |
|
#endif |
750 |
|
|
751 |
while (true) { |
while (true) { |
752 |
|
TestCancel(); |
753 |
|
|
754 |
|
// prevent thread from being cancelled |
755 |
|
// (e.g. to prevent deadlocks while holding mutex lock(s)) |
756 |
|
pushCancelable(false); |
757 |
|
|
758 |
// let all connected engines render 'FragmentSize' sample points |
// let all connected engines render 'FragmentSize' sample points |
759 |
RenderAudio(FragmentSize); |
RenderAudio(FragmentSize); |
777 |
fprintf(stderr, "Alsa: Audio output error, exiting.\n"); |
fprintf(stderr, "Alsa: Audio output error, exiting.\n"); |
778 |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
779 |
} |
} |
780 |
|
|
781 |
|
// now allow thread being cancelled again |
782 |
|
// (since all mutexes are now unlocked) |
783 |
|
popCancelable(); |
784 |
} |
} |
785 |
// just to suppress compiler warning |
// just to suppress compiler warning |
786 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |