@@ -83,8 +83,12 @@ namespace audio_tools {
83
83
LOGD (LOG_METHOD);
84
84
this ->p_source = &source;
85
85
this ->p_decoder = &decoder;
86
- this ->volume_out .setTarget (output);
87
- this ->p_out_decoding = new EncodedAudioStream (volume_out, decoder);
86
+ if (decoder.isResultPCM ()){
87
+ this ->volume_out .setTarget (output);
88
+ this ->p_out_decoding = new EncodedAudioStream (volume_out, decoder);
89
+ } else {
90
+ this ->p_out_decoding = new EncodedAudioStream (output, decoder);
91
+ }
88
92
this ->p_final_print = &output;
89
93
90
94
// notification for audio configuration
@@ -104,8 +108,12 @@ namespace audio_tools {
104
108
LOGD (LOG_METHOD);
105
109
this ->p_source = &source;
106
110
this ->p_decoder = &decoder;
107
- this ->volume_out .setTarget (output);
108
- this ->p_out_decoding = new EncodedAudioStream (volume_out, decoder);
111
+ if (decoder.isResultPCM ()){
112
+ this ->volume_out .setTarget (output);
113
+ this ->p_out_decoding = new EncodedAudioStream (volume_out, decoder);
114
+ } else {
115
+ this ->p_out_decoding = new EncodedAudioStream (output, decoder);
116
+ }
109
117
setNotify (notify);
110
118
}
111
119
@@ -120,8 +128,12 @@ namespace audio_tools {
120
128
AudioPlayer (AudioSource& source, AudioStream& output, AudioDecoder& decoder) {
121
129
LOGD (LOG_METHOD);
122
130
this ->p_source = &source;
123
- this ->volume_out .setTarget (output);
124
- this ->p_out_decoding = new EncodedAudioStream (volume_out, decoder);
131
+ if (decoder.isResultPCM ()){
132
+ this ->volume_out .setTarget (output);
133
+ this ->p_out_decoding = new EncodedAudioStream (volume_out, decoder);
134
+ } else {
135
+ this ->p_out_decoding = new EncodedAudioStream (output, decoder);
136
+ }
125
137
this ->p_final_stream = &output;
126
138
127
139
// notification for audio configuration
0 commit comments