-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MIDI file playback using Sonivox library
- Loading branch information
Showing
15 changed files
with
479 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>icon.png</file> | ||
<file>open.png</file> | ||
<file>play.png</file> | ||
<file>stop.png</file> | ||
</qresource> | ||
</RCC> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
Sonivox EAS Synthesizer for Qt applications | ||
Copyright (C) 2016, Pedro Lopez-Cabanillas <[email protected]> | ||
This library is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#include <QDebug> | ||
#include "filewrapper.h" | ||
|
||
static int | ||
readAt(void *handle, void *buffer, int pos, int size) { | ||
return ((FileWrapper*)handle)->readAt(buffer, pos, size); | ||
} | ||
|
||
static int | ||
size(void *handle) { | ||
return ((FileWrapper*)handle)->size(); | ||
} | ||
|
||
FileWrapper::FileWrapper(const QString path) | ||
{ | ||
//qDebug() << Q_FUNC_INFO << path; | ||
m_file = new QFile(path); | ||
m_file->open(QIODevice::ReadOnly); | ||
m_Base = 0; | ||
m_Length = m_file->size(); | ||
} | ||
|
||
FileWrapper::FileWrapper(const char *path) | ||
{ | ||
//qDebug("FileWrapper(path=%s)", path); | ||
m_file = new QFile(path); | ||
m_file->open(QIODevice::ReadOnly); | ||
m_Base = 0; | ||
m_Length = m_file->size(); | ||
} | ||
|
||
FileWrapper::~FileWrapper() { | ||
//qDebug("~FileWrapper"); | ||
m_file->close(); | ||
} | ||
|
||
int | ||
FileWrapper::readAt(void *buffer, int offset, int size) { | ||
//qDebug("readAt(%p, %d, %d)", buffer, offset, size); | ||
m_file->seek(offset); | ||
if (offset + size > m_Length) { | ||
size = m_Length - offset; | ||
} | ||
return m_file->read((char *)buffer, size); | ||
} | ||
|
||
int | ||
FileWrapper::size() { | ||
//qDebug("size() = %d", int(mLength)); | ||
return m_Length; | ||
} | ||
|
||
EAS_FILE_LOCATOR | ||
FileWrapper::getLocator() { | ||
m_easFile.handle = this; | ||
m_easFile.readAt = ::readAt; | ||
m_easFile.size = ::size; | ||
return &m_easFile; | ||
} |
Oops, something went wrong.