aRts audio server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.2KB

  1. /*
  2. Copyright (C) 2000 Stefan Westerfeld stefan@space.twc.de
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  14. Permission is also granted to link this program with the Qt
  15. library, treating Qt like a library that normally accompanies the
  16. operating system kernel, whether or not that is in fact the case.
  17. */
  18. #include <stdio.h>
  19. #include <soundserver.h>
  20. #include <iostream>
  21. using namespace std;
  22. using namespace Arts;
  23. /*
  24. * This is a little test program that illustrates remote dynamic casting.
  25. * Arts_SimpleSoundServer is a global object that is a SimpleSoundServer,
  26. * so the first dynamic cast should succeed, while it is no Synth_PLAY,
  27. * so the second dynamic cast should fail.
  28. */
  29. int main()
  30. {
  31. Dispatcher dispatcher;
  32. Object obj = Reference("global:Arts_SimpleSoundServer");
  33. if(obj.isNull())
  34. {
  35. cerr << "this test will only work if artsd is running" << endl;
  36. exit(1);
  37. }
  38. /*
  39. * TODO: fix this. This fails currently as in the first line only an
  40. * Object_stub will get created, no SimpleSoundServer_stub, and _cast
  41. * which is used by DynamicCast wil only try to cast the _stub object,
  42. * not do any further tricks.
  43. */
  44. SimpleSoundServer server = DynamicCast(obj);
  45. if(server.isNull())
  46. {
  47. cerr << "remote dynamic casting is too restrictive" << endl;
  48. exit(1);
  49. }
  50. Synth_PLAY play = DynamicCast(obj);
  51. if(!play.isNull())
  52. {
  53. cerr << "remote dynamic casting doesn't do proper checks" << endl;
  54. exit(1);
  55. }
  56. cout << "remote dynamic casting seems to be fine" << endl;
  57. return 0;
  58. }