Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building on Windows #8

Open
lm8 opened this issue Apr 1, 2014 · 1 comment
Open

building on Windows #8

lm8 opened this issue Apr 1, 2014 · 1 comment

Comments

@lm8
Copy link

lm8 commented Apr 1, 2014

Tried building cursynth on Windows using MinGW and msys. It builds successfully, but it needed the following patches to do so. While either ncurses of pdcurses is available on both Linux, BSD and Windows platforms, Windows builds typically use pdcurses. I replaced the link to the ncurses library in src/Makefile with -lpdcurses and the patches switch from the ncurses header to the pdcurses header file on Windows. Might be nicer to give the user the option to pick ncurses or pdcurses instead of defaulting by platform. Also, on most systems mkdir takes to arguments, but on Windows, it just takes one. Windows streams are typically text instead of binary based unless specified as binary.

diff -Naurp src/cursynth-1.4/rtaudio/RtAudio.cpp tmp/cursynth-1.4/rtaudio/RtAudio.cpp
--- src/cursynth-1.4/rtaudio/RtAudio.cpp 2014-01-21 21:31:39 -0500
+++ tmp/cursynth-1.4/rtaudio/RtAudio.cpp
@@ -3558,6 +3558,7 @@ static const char* getAsioErrorString( A
#pragma comment( lib, "winmm.lib" ) // then, auto-link winmm.lib. Otherwise, it has to be added manually.
#endif

+#include <stdio.h>
static inline DWORD dsPointerBetween( DWORD pointer, DWORD laterPointer, DWORD earlierPointer, DWORD bufferSize )
{
if ( pointer > bufferSize ) pointer -= bufferSize;
@@ -7130,6 +7131,9 @@ bool RtApiOss :: probeDeviceOpen( unsign

// Try to open the device.
int fd;
+#ifdef _WIN32

  • flags |-= O_BINARY;
    +#endif
    fd = open( ainfo.devnode, flags, 0 );
    if ( fd == -1 ) {
    if ( errno == EBUSY )
    diff -Naurp src/cursynth-1.4/src/cursynth.cpp tmp/cursynth-1.4/src/cursynth.cpp
    --- src/cursynth-1.4/src/cursynth.cpp 2014-02-04 20:43:48 -0500
    +++ tmp/cursynth-1.4/src/cursynth.cpp
    @@ -22,7 +22,11 @@

include <dirent.h>

include

include

+#ifdef _WIN32
+#include <curses.h>
+#else

include <ncurses.h>

+#endif

include

include

include <stdio.h>

@@ -56,8 +60,10 @@ namespace {
RtAudioStreamStatus status, void *user_data) {
UNUSED(in_buffer);
UNUSED(stream_time);
+#ifndef _WIN32
if (status)
std::cout << "Stream underflow detected!" << std::endl;
+#endif

mopo::Cursynth* cursynth = static_castmopo::Cursynth*(user_data);
cursynth->processAudio((mopo::mopo_float*)out_buffer, n_frames);
@@ -88,7 +94,11 @@ namespace {
// Check if the directory path exists, if not, create it.
void confirmPathExists(std::string path) {
if (opendir(path.c_str()) == NULL)
+#ifdef _WIN32

  •  mkdir(path.c_str());
    

    +#else
    mkdir(path.c_str(), 0755);
    +#endif
    }

    // Returns all files in directory dir with extenstion ext.
    diff -Naurp src/cursynth-1.4/src/cursynth_gui.cpp tmp/cursynth-1.4/src/cursynth_gui.cpp
    --- src/cursynth-1.4/src/cursynth_gui.cpp 2014-03-15 18:26:00 -0400
    +++ tmp/cursynth-1.4/src/cursynth_gui.cpp
    @@ -21,7 +21,11 @@

    include <libintl.h>

    include <locale.h>

    include <math.h>

    +#ifdef _WIN32
    +#include <curses.h>
    +#else

    include <ncurses.h>

    +#endif

    include <stdlib.h>

    include

    include <unistd.h>

    diff -Naurp src/cursynth-1.4/src/cursynth_gui.h tmp/cursynth-1.4/src/cursynth_gui.h
    --- src/cursynth-1.4/src/cursynth_gui.h 2014-02-04 20:43:48 -0500
    +++ tmp/cursynth-1.4/src/cursynth_gui.h
    @@ -22,7 +22,11 @@

    include "cursynth_common.h"

    include

    +#ifdef _WIN32
    +#include <curses.h>
    +#else

    include <ncurses.h>

    +#endif

    include

    namespace mopo {

@iyoko
Copy link
Collaborator

iyoko commented Apr 14, 2014

Hey! Sorry I didn't respond for a while.
I'll look this over and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants