jack1 codebase
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.

120 lines
2.4KB

  1. /*
  2. * AudioRenderBridge.c
  3. * jack_coreaudio
  4. * Under Artistic License.
  5. *
  6. * Created by Johnny Petrantoni on Fri Jan 30 2004.
  7. * Copyright (c) 2004 Johnny Petrantoni. All rights reserved.
  8. *
  9. */
  10. #include "AudioRenderBridge.h"
  11. #include "AudioRender.h"
  12. void *openPandaAudioInstance(float sampleRate, long bufferSize,
  13. int inChannels, int outChannels, char *device)
  14. {
  15. AudioRender *newInst =
  16. new AudioRender(sampleRate, bufferSize, inChannels, outChannels,
  17. device);
  18. if (newInst->status)
  19. return newInst;
  20. return NULL;
  21. }
  22. void closePandaAudioInstance(void *instance)
  23. {
  24. if (instance) {
  25. AudioRender *inst = (AudioRender *) instance;
  26. inst->StopAudio();
  27. delete inst;
  28. }
  29. }
  30. int startPandaAudioProcess(void *instance)
  31. {
  32. if (instance) {
  33. AudioRender *inst = (AudioRender *) instance;
  34. return inst->StartAudio();
  35. }
  36. return FALSE;
  37. }
  38. int stopPandaAudioProcess(void *instance)
  39. {
  40. if (instance) {
  41. AudioRender *inst = (AudioRender *) instance;
  42. return inst->StopAudio();
  43. }
  44. return FALSE;
  45. }
  46. float **getPandaAudioInputs(void *instance)
  47. {
  48. if (instance) {
  49. AudioRender *inst = (AudioRender *) instance;
  50. return inst->inBuffers;
  51. }
  52. return NULL;
  53. }
  54. float **getPandaAudioOutputs(void *instance)
  55. {
  56. if (instance) {
  57. AudioRender *inst = (AudioRender *) instance;
  58. return inst->outBuffers;
  59. }
  60. return NULL;
  61. }
  62. void *getHostData(void *instance)
  63. {
  64. if (instance) {
  65. AudioRender *inst = (AudioRender *) instance;
  66. return inst->jackData;
  67. }
  68. return NULL;
  69. }
  70. void setHostData(void *instance, void *hostData)
  71. {
  72. if (instance) {
  73. AudioRender *inst = (AudioRender *) instance;
  74. inst->jackData = hostData;
  75. }
  76. }
  77. void setCycleFun(void *instance, JackRunCyclePtr fun)
  78. {
  79. if (instance) {
  80. AudioRender *inst = (AudioRender *) instance;
  81. inst->f_JackRunCycle = fun;
  82. }
  83. }
  84. void setParameter(void *instance, int id, void *data)
  85. {
  86. if (instance) {
  87. AudioRender *inst = (AudioRender *) instance;
  88. switch (id) {
  89. case 'inte':
  90. inst->isInterleaved = (int *) data;
  91. break;
  92. case 'nstr':
  93. inst->numberOfStreams = (int *) data;
  94. *inst->numberOfStreams = inst->n_streams;
  95. break;
  96. case 'cstr':
  97. inst->channelsPerStream = (int *) data;
  98. break;
  99. case 'nstO':
  100. inst->out_numberOfStreams = (int *) data;
  101. *inst->out_numberOfStreams = inst->n_out_streams;
  102. break;
  103. case 'cstO':
  104. inst->out_channelsPerStream = (int *) data;
  105. break;
  106. }
  107. }
  108. }