#BUGFIX by exept
class: SoundStream::PortAudio
changed:
#reopenStream
#supportedAudioFormats
--- a/SoundStream.st Fri Jan 03 22:00:20 2020 +0100
+++ b/SoundStream.st Fri Jan 03 22:10:34 2020 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
@@ -3454,6 +3452,8 @@
reopenStream
|ok errorStringOrNil error|
+ handle1 isNil ifTrue:[^ self].
+
%{
#ifdef SUPPORT_PORTAUDIO
static PaStreamParameters outputParameters;
@@ -3462,9 +3462,14 @@
struct paStreamData* paStreamData;
int nChannels, sampleRate, bytesPerSample;
# define FRAMES_PER_BUFFER 128
+ OBJ str;
ok = false;
+ str = __INST(handle1);
+ paStreamData = (struct paStreamData*)__externalAddressVal(str);
+ Pa_CloseStream( paStreamData->stream );
+
/* default output device */
outputParameters.device = Pa_GetDefaultOutputDevice();
if (outputParameters.device == paNoDevice) {
@@ -3606,122 +3611,29 @@
supportedAudioFormats
"return a collection of supported audio formats.
possibly returned symbols are:
- U8 unsigned 8bit samples
- S8 signed 8bit samples
- U16 unsigned 16bit samples in native format
- U16_LE unsigned 16bit big endian samples
- U16_BE unsigned 16bit big endian samples
- S16 signed 16bit little endian samples in native format
- S16_LE signed 16bit little endian samples
- S16_BE signed 16bit big endian samples
- S24 signed 24bit little endian samples in native format
- S24_LE signed 24bit little endian samples
- S24_BE signed 24bit big endian samples
- S32 signed 32bit little endian samples in native format
- S32_LE signed 32bit little endian samples
- S32_BE signed 32bit big endian samples
- F32 float samples
- MPEG audio mpeg encoded
- MU_LAW u-law encoded 8bit samples
- A_LAW a-law encoded 8bit samples
- IMA_ADPCM adpcm encoded
+ U8 unsigned 8bit samples
+ S8 signed 8bit samples
+ U16 unsigned 16bit samples in native format
+ U16_LE unsigned 16bit big endian samples
+ U16_BE unsigned 16bit big endian samples
+ S16 signed 16bit little endian samples in native format
+ S16_LE signed 16bit little endian samples
+ S16_BE signed 16bit big endian samples
+ S24 signed 24bit little endian samples in native format
+ S24_LE signed 24bit little endian samples
+ S24_BE signed 24bit big endian samples
+ S32 signed 32bit little endian samples in native format
+ S32_LE signed 32bit little endian samples
+ S32_BE signed 32bit big endian samples
+ F32 float samples
+ MPEG audio mpeg encoded
+ MU_LAW u-law encoded 8bit samples
+ A_LAW a-law encoded 8bit samples
+ IMA_ADPCM adpcm encoded
the set of returned symbols depends on the underlying sound hardware.
"
- |fd audioFormatMask
- supportedFormats
- supports_MU_LAW supports_A_LAW supports_MPEG
- supports_IMA_ADPCM
- supports_S8 supports_U8
- supports_S16_LE supports_S16_BE
- supports_U16_LE supports_U16_BE
- supports_U32_LE supports_U32_BE
- supports_S24_LE supports_S24_BE
- supports_S32_LE supports_S32_BE
- supports_F32
- |
-
-%{
-#ifdef SUPPORT_PORTAUDIO
- supports_U8 = true;
- supports_S8 = true;
- supports_S16_LE = true;
- supports_S24_LE = true;
- supports_S32_LE = true;
- supports_F32 = true;
-#endif
-%}.
- supportedFormats := IdentitySet new.
- (supports_MU_LAW ? false) ifTrue:[
- supportedFormats add:#'MU_LAW'
- ].
- (supports_A_LAW ? false) ifTrue:[
- supportedFormats add:#'A_LAW'
- ].
- (supports_IMA_ADPCM ? false) ifTrue:[
- supportedFormats add:#'IMA_ADPCM'
- ].
- (supports_MPEG ? false) ifTrue:[
- supportedFormats add:#'MPEG'
- ].
- (supports_S8 ? false) ifTrue:[
- supportedFormats add:#'S8'
- ].
- (supports_U8 ? false) ifTrue:[
- supportedFormats add:#'U8'
- ].
- (supports_S16_LE ? false) ifTrue:[
- supportedFormats add:#'S16_LE'.
- UninterpretedBytes isBigEndian ifFalse:[
- supportedFormats add:#'S16'.
- ]
- ].
- (supports_S16_BE ? false) ifTrue:[
- supportedFormats add:#'S16_BE'.
- UninterpretedBytes isBigEndian ifTrue:[
- supportedFormats add:#'S16'.
- ]
- ].
- (supports_S24_LE ? false) ifTrue:[
- supportedFormats add:#'S24_LE'.
- UninterpretedBytes isBigEndian ifFalse:[
- supportedFormats add:#'S24'.
- ]
- ].
- (supports_S24_BE ? false) ifTrue:[
- supportedFormats add:#'S24_BE'.
- UninterpretedBytes isBigEndian ifTrue:[
- supportedFormats add:#'S24'.
- ]
- ].
- (supports_S32_LE ? false) ifTrue:[
- supportedFormats add:#'S32_LE'.
- UninterpretedBytes isBigEndian ifFalse:[
- supportedFormats add:#'S32'.
- ]
- ].
- (supports_S32_BE ? false) ifTrue:[
- supportedFormats add:#'S32_BE'.
- UninterpretedBytes isBigEndian ifTrue:[
- supportedFormats add:#'S32'.
- ]
- ].
- (supports_U16_LE ? false) ifTrue:[
- supportedFormats add:#'U16_LE'.
- UninterpretedBytes isBigEndian ifFalse:[
- supportedFormats add:#'U16'.
- ]
- ].
- (supports_U16_BE ? false) ifTrue:[
- supportedFormats add:#'U16_BE'.
- UninterpretedBytes isBigEndian ifTrue:[
- supportedFormats add:#'U16'.
- ]
- ].
- (supports_F32 ? false) ifTrue:[
- supportedFormats add:#'F32'
- ].
- ^ supportedFormats.
+ ^ #(U8 S8 S16_LE S16 S24_LE S24 S32_LE S32 F32)
"
|s formats|