Changes related to Windows build.

This commit is contained in:
Maxim Poliakovski 2020-05-09 14:29:37 +02:00
parent ba81094fa2
commit d4c39f13af
4 changed files with 40 additions and 12 deletions

View File

@ -4,7 +4,8 @@ project(dingusppc)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
#set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
if (NOT WIN32)
@ -20,7 +21,8 @@ add_subdirectory("${PROJECT_SOURCE_DIR}/thirdparty/loguru/")
set(BUILD_EXAMPLE_PROGRAMS OFF CACHE BOOL "Build libsoundio example programs")
set(BUILD_TESTS OFF CACHE BOOL "Build libsoundio tests")
set(BUILD_DYNAMIC_LIBS OFF CACHE BOOL "Build libsoundio dynamic libs")
set(BUILD_DYNAMIC_LIBS ON CACHE BOOL "Build libsoundio dynamic libs")
set(BUILD_STATIC_LIBS ON CACHE BOOL "Build libsoundio static libs")
add_subdirectory("${PROJECT_SOURCE_DIR}/thirdparty/libsoundio")
@ -48,7 +50,8 @@ add_executable(dingusppc ${SOURCES} $<TARGET_OBJECTS:debugger>
if (WIN32)
target_link_libraries(dingusppc "${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2.lib"
"${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2main.lib")
"${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2main.lib"
libsoundio_static ${LIBSOUNDIO_LIBS})
else()
target_link_libraries(dingusppc libsoundio_static ${LIBSOUNDIO_LIBS} ${SDL2_LIBRARIES})
endif()
@ -62,7 +65,8 @@ add_executable(testppc ${TEST_SOURCES} $<TARGET_OBJECTS:debugger>
if (WIN32)
target_link_libraries(testppc "${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2.lib"
"${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2main.lib")
"${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2main.lib"
libsoundio_static ${LIBSOUNDIO_LIBS})
else()
target_link_libraries(testppc libsoundio_static ${LIBSOUNDIO_LIBS} ${SDL2_LIBRARIES})
endif()

View File

@ -144,10 +144,23 @@ static void sound_out_callback(struct SoundIoOutStream *outstream,
struct SoundIoChannelArea *areas;
DMAChannel *dma_ch = (DMAChannel *)outstream->userdata; /* C API baby! */
int n_channels = outstream->layout.channel_count;
bool stop = false;
//bool stop = false;
buf_len = (frame_count_max * n_channels) << 1;
frame_count = frame_count_max;
if (!dma_ch->is_active()) {
LOG_F(INFO, "pausing result: %s",
soundio_strerror(soundio_outstream_pause(outstream, true)));
return;
}
if (frame_count_max > 512) {
frame_count = 512;
}
else {
frame_count = frame_count_max;
}
buf_len = (frame_count * n_channels) << 1;
//frame_count = frame_count_max;
//LOG_F(INFO, "frame_count_min=%d", frame_count_min);
//LOG_F(INFO, "frame_count_max=%d", frame_count_max);
@ -171,7 +184,7 @@ static void sound_out_callback(struct SoundIoOutStream *outstream,
/* fill the buffer with silence */
//LOG_F(ERROR, "rem_len=%d", rem_len);
insert_silence(areas, rem_len >> 2);
stop = true;
//stop = true;
break;
}
}
@ -181,10 +194,10 @@ static void sound_out_callback(struct SoundIoOutStream *outstream,
return;
}
if (stop) {
LOG_F(INFO, "pausing result: %s",
soundio_strerror(soundio_outstream_pause(outstream, true)));
}
//if (stop) {
// LOG_F(INFO, "pausing result: %s",
// soundio_strerror(soundio_outstream_pause(outstream, true)));
//}
}
void AWACDevice::open_stream(int sample_rate)

View File

@ -220,6 +220,16 @@ int DMAChannel::get_data(uint32_t req_len, uint32_t *avail_len, uint8_t **p_data
return -1; /* tell the caller there is no more data */
}
bool DMAChannel::is_active()
{
if (this->ch_stat & CH_STAT_DEAD || !(this->ch_stat & CH_STAT_ACTIVE)) {
return false;
}
else {
return true;
}
}
void DMAChannel::start()
{
if (this->ch_stat & CH_STAT_PAUSE) {

View File

@ -76,6 +76,7 @@ public:
void reg_write(uint32_t offset, uint32_t value, int size);
int get_data(uint32_t req_len, uint32_t *avail_len, uint8_t **p_data);
bool is_active();
protected:
void get_next_cmd(uint32_t cmd_addr, DMACmd *p_cmd);