mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-23 21:34:06 +00:00
Changes related to Windows build.
This commit is contained in:
parent
ba81094fa2
commit
d4c39f13af
@ -4,7 +4,8 @@ project(dingusppc)
|
|||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
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)
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
||||||
|
|
||||||
if (NOT WIN32)
|
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_EXAMPLE_PROGRAMS OFF CACHE BOOL "Build libsoundio example programs")
|
||||||
set(BUILD_TESTS OFF CACHE BOOL "Build libsoundio tests")
|
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")
|
add_subdirectory("${PROJECT_SOURCE_DIR}/thirdparty/libsoundio")
|
||||||
|
|
||||||
@ -48,7 +50,8 @@ add_executable(dingusppc ${SOURCES} $<TARGET_OBJECTS:debugger>
|
|||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(dingusppc "${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2.lib"
|
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()
|
else()
|
||||||
target_link_libraries(dingusppc libsoundio_static ${LIBSOUNDIO_LIBS} ${SDL2_LIBRARIES})
|
target_link_libraries(dingusppc libsoundio_static ${LIBSOUNDIO_LIBS} ${SDL2_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
@ -62,7 +65,8 @@ add_executable(testppc ${TEST_SOURCES} $<TARGET_OBJECTS:debugger>
|
|||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(testppc "${PROJECT_SOURCE_DIR}/thirdparty/SDL2/lib/x64/SDL2.lib"
|
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()
|
else()
|
||||||
target_link_libraries(testppc libsoundio_static ${LIBSOUNDIO_LIBS} ${SDL2_LIBRARIES})
|
target_link_libraries(testppc libsoundio_static ${LIBSOUNDIO_LIBS} ${SDL2_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
@ -144,10 +144,23 @@ static void sound_out_callback(struct SoundIoOutStream *outstream,
|
|||||||
struct SoundIoChannelArea *areas;
|
struct SoundIoChannelArea *areas;
|
||||||
DMAChannel *dma_ch = (DMAChannel *)outstream->userdata; /* C API baby! */
|
DMAChannel *dma_ch = (DMAChannel *)outstream->userdata; /* C API baby! */
|
||||||
int n_channels = outstream->layout.channel_count;
|
int n_channels = outstream->layout.channel_count;
|
||||||
bool stop = false;
|
//bool stop = false;
|
||||||
|
|
||||||
buf_len = (frame_count_max * n_channels) << 1;
|
if (!dma_ch->is_active()) {
|
||||||
frame_count = frame_count_max;
|
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_min=%d", frame_count_min);
|
||||||
//LOG_F(INFO, "frame_count_max=%d", frame_count_max);
|
//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 */
|
/* fill the buffer with silence */
|
||||||
//LOG_F(ERROR, "rem_len=%d", rem_len);
|
//LOG_F(ERROR, "rem_len=%d", rem_len);
|
||||||
insert_silence(areas, rem_len >> 2);
|
insert_silence(areas, rem_len >> 2);
|
||||||
stop = true;
|
//stop = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,10 +194,10 @@ static void sound_out_callback(struct SoundIoOutStream *outstream,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stop) {
|
//if (stop) {
|
||||||
LOG_F(INFO, "pausing result: %s",
|
// LOG_F(INFO, "pausing result: %s",
|
||||||
soundio_strerror(soundio_outstream_pause(outstream, true)));
|
// soundio_strerror(soundio_outstream_pause(outstream, true)));
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AWACDevice::open_stream(int sample_rate)
|
void AWACDevice::open_stream(int sample_rate)
|
||||||
|
@ -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 */
|
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()
|
void DMAChannel::start()
|
||||||
{
|
{
|
||||||
if (this->ch_stat & CH_STAT_PAUSE) {
|
if (this->ch_stat & CH_STAT_PAUSE) {
|
||||||
|
@ -76,6 +76,7 @@ public:
|
|||||||
void reg_write(uint32_t offset, uint32_t value, int size);
|
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);
|
int get_data(uint32_t req_len, uint32_t *avail_len, uint8_t **p_data);
|
||||||
|
bool is_active();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void get_next_cmd(uint32_t cmd_addr, DMACmd *p_cmd);
|
void get_next_cmd(uint32_t cmd_addr, DMACmd *p_cmd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user