bugGNU Octave - Bugs: bug #43964, octave 4.1.0+ audio changes will...

 
 

bug #43964: octave 4.1.0+ audio changes will not compile on Windows

Submitted by:  John Donoghue <lostbard>
Submitted on:  Fri 09 Jan 2015 06:26:31 PM UTC  
 
Category:  Configuration and Build System Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build Failure
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Microsoft Windows

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Tue 20 Jan 2015 01:46:12 PM UTC, comment #21: 

Just for info, since the last changes it passes the audio tests each time!

John Donoghue <lostbard>
Project Member
Thu 15 Jan 2015 08:42:49 PM UTC, comment #20: 

I was f64cdbe11621  doc: Periodic spellcheck of documentation.

John Donoghue <lostbard>
Project Member
Thu 15 Jan 2015 08:28:35 PM UTC, comment #19: 

Yes the destructor should be called.  I made the following change to audiodevinfo.cc:

diff --git a/libinterp/dldfcn/audiodevinfo.cc b/libinterp/dldfcn/audiodevinfo.cc
--- a/libinterp/dldfcn/audiodevinfo.cc
+++ b/libinterp/dldfcn/audiodevinfo.cc
@@ -1295,7 +1295,7 @@
{
public:
   audiorecorder (void);
-  ~audiorecorder (void) {};
+  ~audiorecorder (void);

   // Overloaded base functions
   double player_value (void) const { return 0; }
@@ -1539,6 +1539,15 @@
     left (), right (), stream (0), input_parameters (), type ()
{ }

+audiorecorder::~audiorecorder (void)
+{
+  if (isrecording ())
+    {
+      warning ("audiorecorder::~audiorecorder: Interrupting recording audiorecorder");
+      stop ();
+    }
+}
+
void
audiorecorder::print (std::ostream& os, bool pr_as_read_syntax) const
{

I do see the message from the destructor if I do

  r = audiorecorder ();
  record (r);
  r = audiorecorder ();

The destructor should be called even if the object is not currently recording, but I think stopping recording should only be needed if it is actually currently recording.  What is your hg ID?  Mine is

  0cc52d752f99+ tip @

John W. Eaton <jwe>
Project Administrator
Thu 15 Jan 2015 01:18:22 PM UTC, comment #18: 

I haven't has much to do with creating own types in octave, but when I have:

a = audiorecorder

a = audiorecorder

shouldn't the deconstructor of the octave value of the old 'a' be called?

If I change the code to print something out whenever Pa_StoStream is called, only one case in the tests calls stop, and that's when multiple records are called on the same audio recorder. Which is probally why the tests work if I call stop explicitly in the octave code.

If I also add a print in the deconstructor of the audiorecorder c++ object, I never see it printed out - originally I though adding a stop in the c++ code at the end of recordblocking, and one in the deconstructor if it has a valid stream would be needed.

John Donoghue <lostbard>
Project Member
Wed 14 Jan 2015 05:49:02 PM UTC, comment #17: 

If I add a call to stop(recorder) after each test in the audiorecorder.m tests that calls record or recordblocking, then I appear to be consistently passing the audio tests.

John Donoghue <lostbard>
Project Member
Wed 14 Jan 2015 05:06:12 PM UTC, comment #16: 

Should audiorecorder::recordblocking call Pa_StopStream after getting the required data?

Just running the 1st test the audio recorder tests repeatedly would some times fail being able to open the audio device.

If I call stop(recorder) after the test, it allows me to repeatedly run the 1st test without fails.

John Donoghue <lostbard>
Project Member
Wed 14 Jan 2015 03:06:42 PM UTC, comment #15: 

Windows build from:

No more crashes for me, however audioplayer and autorecorder tests runs sometimes pass, sometimes do not.

Log reports errors such as:

>>>>> processing C:\Octave\Octave-4.1.0+\share\octave\4.1.0+\m\audio\@audiorecorder\audiorecorder.m
***** testif HAVE_PORTAUDIO
recorder = audiorecorder (44100, 16, 2);
recordblocking (recorder, 1);
data = getaudiodata (recorder, "int16");
assert (strcmp (class (data), "int16"));
data = getaudiodata (recorder, "int8");
assert (strcmp (class (data), "int8"));
data = getaudiodata (recorder, "uint8");
assert (strcmp (class (data), "uint8"));
assert (size (data)(1), recorder.TotalSamples);
assert (size (data)(2), 2);
assert (size (data)(1) != 0);
!!!!! test failed
audiorecorder: unable to open audio recording stream
***** testif HAVE_PORTAUDIO
recorder = audiorecorder (44100, 16, 2);
record (recorder, 1)
sleep (2);
record (recorder, 1);
sleep (2);
data = getaudiodata (recorder);
assert (size (data)(1) < 44100 * 2);
!!!!! test failed
audiorecorder: unable to open audio recording stream
***** testif HAVE_PORTAUDIO
recorder = audiorecorder (44100, 16, 2);
record (recorder, 1);
sleep (2);
player1 = audioplayer (recorder);
player2 = getplayer (recorder);
play (player1);
sleep (2);
play (player2);
sleep (2);
assert (player1.TotalSamples, recorder.TotalSamples);
assert (player2.TotalSamples, recorder.TotalSamples);
!!!!! test failed
audiorecorder: unable to open audio recording stream

John Donoghue <lostbard>
Project Member
Wed 14 Jan 2015 01:37:11 PM UTC, comment #14: 

lablab would be octave :)

John Donoghue <lostbard>
Project Member
Wed 14 Jan 2015 01:36:23 PM UTC, comment #13: 

For info, on my lablab version currently:

>> audiodevinfo.input
ans =

  1x5 struct array containing the fields:

    Name
    DriverVersion
    ID

>> audiodevinfo.input(1)
ans =

  scalar structure containing the fields:

    Name = Microsoft Sound Mapper - Input (MME)
    DriverVersion = MME
    ID = 0

>>

John Donoghue <lostbard>
Project Member
Wed 14 Jan 2015 11:50:43 AM UTC, comment #12: 

I used the test program that is created in portaudio.mk as thought that would verify that the portaudio library actually finds things ok.

It doesnt get installed though - I grabbed it when compiling the library.

John Donoghue <lostbard>
Project Member
Wed 14 Jan 2015 04:08:29 AM UTC, comment #11: 

I checked in some more changes for the audio functions.  Now I don't get crashes when running the tests, but the system I'm using for testing doesn't pass the tests because Octve isn't finding any audio input devices.  I don't know if that's a bug in Octave or that the system actually doesn't have any audio input devices.  How can I check that with a Windows utility?

John W. Eaton <jwe>
Project Administrator
Tue 13 Jan 2015 09:46:51 PM UTC, comment #10: 

There have been a couple of audio changes made since I built for mxe last, so will try with them.

John Donoghue <lostbard>
Project Member
Tue 13 Jan 2015 09:43:58 PM UTC, comment #9: 

No - still crashes most times.

Also, callbacks are not implemented for the audio, so those last 2 tests wont work anyway (removing them doesn't stop the crash)

John Donoghue <lostbard>
Project Member
Tue 13 Jan 2015 09:37:40 PM UTC, comment #8: 

I'd say yes, in that test we should be stopping the recorder.

If you make that change, does it avoid the problem?

But even so, Octave should not crash.

John W. Eaton <jwe>
Project Administrator
Tue 13 Jan 2015 09:07:29 PM UTC, comment #7: 

Running it a couple of times, it occasionally will pass the recorder tests.

In line 129 of audiorecorder.m, is it supposed to be "stop(recorder)" ?

John Donoghue <lostbard>
Project Member
Tue 13 Jan 2015 06:45:09 PM UTC, comment #6: 

I built gdb and added it to the install and ran the tests with gdb.  I forgot to skip the strip step, but I still found that it crashed at line 1511 of audiodevinfo.cc.  That line is

 output_parameters.suggestedLatency = Pa_GetDeviceInfo (device)->defaultHighOutputLatency;

so I'm guessing Pa_GetDeviceInfo is returning NULL.

I also see that we sometimes check the number returned from Pa_GetDeviceCount < 0 and other times < 1.  What's the right thing?  In any case, we need to be more defensive with the pointers that we grab from portaudio...  I think I can work on this a bit more later today.

John W. Eaton <jwe>
Project Administrator
Tue 13 Jan 2015 05:40:02 PM UTC, comment #5: 

I had played audio ok - but hadn't run with test suite.

On running test suite,

I get audioplayer.m pass 5/6
audiorecoder.m: crashes

>>>>> processing C:\Octave\Octave-4.1.0+\share\octave\4.1.0+\m\audio\@audioplayer\audioplayer.m
***** testif HAVE_PORTAUDIO
audio = randn (2, 88200) - 0.5;
fs = 44100;
player = audioplayer (audio, fs);
assert (!isplaying (player));
play (player);
assert (isplaying (player));
sleep (1);
stop (player);
sleep (1);
assert (!isplaying (player));
assert (player.CurrentSample, 0);
!!!!! test failed
ASSERT errors for:  assert (player.CurrentSample,0)

  Location  |  Observed  |  Expected  |  Reason
     ()         49152          0         Abs err 49152 exceeds tol 0
>>>>> processing C:\Octave\Octave-4.1.0+\share\octave\4.1.0+\m\audio\@audiorecorder\audiorecorder.m

John Donoghue <lostbard>
Project Member
Tue 13 Jan 2015 05:26:16 PM UTC, comment #4: 

Have you tried _run_test_suite_?  Does it work for you?  I tried with mxe-octave hg id

  80b2b5cfde0f tip @

and octave hg id

  62ca016dbb2a tip @

and it crashes during one of the audio tests.  It does play some sounds so at least some audio features are working, but then crashes.

John W. Eaton <jwe>
Project Administrator
Tue 13 Jan 2015 02:39:38 PM UTC, comment #3: 

Thanks - closing bug with  a successful build for Windows

John Donoghue <lostbard>
Project Member
Fri 09 Jan 2015 08:52:20 PM UTC, comment #2: 

I pushed your changeset.

Thanks.

John W. Eaton <jwe>
Project Administrator
Fri 09 Jan 2015 06:55:01 PM UTC, comment #1: 

Patch attached changing audio_type enum names to TYPE_XXXX.

(file #32801)

John Donoghue <lostbard>
Project Member
Fri 09 Jan 2015 06:26:31 PM UTC, original submission:  

Currently failing at because UINT8, INT8 etc are already defined.

/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/octave-value -I/home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/operators -Iparse-tree -I/home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/parse-tree -Icorefcn -I/home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/corefcn -I../libgnu -I/home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libgnu -I/home/john/git-repo/mxe-octave-dev3/usr/i686-w64-mingw32/include -mieee-fp -Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual -g -O2 -pthread -MT dldfcn/dldfcn_audiodevinfo_la-audiodevinfo.lo -MD -MP -MF dldfcn/.deps/dldfcn_audiodevinfo_la-audiodevinfo.Tpo -c /home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/dldfcn/audiodevinfo.cc  -DDLL_EXPORT -DPIC -o dldfcn/.libs/dldfcn_audiodevinfo_la-audiodevinfo.o
/home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/dldfcn/audiodevinfo.cc:436:19: error: 'INT8' redeclared as different kind of symbol
enum audio_type { INT8, UINT8, INT16, DOUBLE };
                   ^
In file included from /home/john/git-repo/mxe-octave-dev3/usr/i686-w64-mingw32/include/winnt.h:134:0,
                 from /home/john/git-repo/mxe-octave-dev3/usr/i686-w64-mingw32/include/minwindef.h:146,
                 from /home/john/git-repo/mxe-octave-dev3/usr/i686-w64-mingw32/include/windef.h:8,
                 from /home/john/git-repo/mxe-octave-dev3/usr/i686-w64-mingw32/include/windows.h:69,
                 from /home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/liboctave/cruft/misc/quit.h:39,
                 from /home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/liboctave/util/lo-utils.h:31,
                 from /home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/liboctave/array/Array.h:38,
                 from /home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/liboctave/util/str-vec.h:31,
                 from /home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/octave-value/ov-fcn.h:29,
                 from /home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/octave-value/ov-builtin.h:28,
                 from /home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/corefcn/defun-int.h:28,
                 from /home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/corefcn/defun-dld.h:30,
                 from /home/john/git-repo/mxe-octave-dev3/tmp-default-octave/octave-4.1.0+/libinterp/dldfcn/audiodevinfo.cc:33:
/home/john/git-repo/mxe-octave-dev3/usr/i686-w64-mingw32/include/basetsd.h:29:23: note: previous declaration 'typedef signed char INT8'

John Donoghue <lostbard>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #32801:  bug43964.patch added by lostbard (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by lostbard (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-01-13 lostbard StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2015-01-09 lostbard Attached File- => Added bug43964.patch, #32801
        StatusNone => Patch Submitted

    Back to the top


    Powered by Savane 3.5